#include <Simulator.h>
Inheritance diagram for Physsim::Simulator:

Public Member Functions | |
| Simulator () | |
| Sets up the simulator. | |
| virtual void | determine_external_forces () |
| Explicitly computes all of the external forces applied to bodies. | |
| virtual bool | is_struct_identical (BaseConstPtr object) const |
| Verifies that two object structures are identical. | |
| virtual void | clone (BasePtr &cloned, bimap< BasePtr, BasePtr > *obj_map=NULL) const |
| Clones this simulator. | |
| virtual void | load_state (BaseConstPtr object, bimap< BasePtr, BasePtr > *correspondence=NULL) |
| Loads this object with data from a clone. | |
| virtual void | save_state (BasePtr object, bimap< BasePtr, BasePtr > *correspondence=NULL) const |
| Saves this to a given object. | |
| virtual Real | step (Real step_size) |
| Steps the Simulator forward in time without contact. | |
| DynamicBodyPtr | find_dynamic_body (const std::string &name) const |
| Finds the dynamic body in the simulator, if any. | |
| RigidBodyPtr | find_rigid_body (const std::string &name) const |
| Finds an unarticulated rigid body or link in an articulated rigid body in the simulator, if any. | |
| ArticulatedBodyPtr | find_articulated_body (const std::string &name) const |
| Finds the articulated body in the simulator, if any. | |
| std::list< RigidBodyPtr > | get_all_rigid_bodies () const |
| Gets all rigid bodies in the simulator (i.e., both free bodies and links in articulated bodies). | |
| void | add_dynamic_body (DynamicBodyPtr body) |
| Adds a dynamic body to the simulator. | |
| void | set_dynamic_bodies (const std::vector< DynamicBodyPtr > &bodies) |
| Sets the vector of dynamic bodies. | |
| void | update_visualization () |
| Updates all visualization under the simulator. | |
| virtual void | save_to_xml (XMLTreePtr node, std::list< BaseConstPtr > &shared_objects) const |
| Implements Base::save_to_xml(). | |
| virtual void | load_from_xml (XMLTreeConstPtr node, std::map< std::string, BasePtr > &id_map) |
| Implements Base::load_from_xml(). | |
| void | set_recurrent_forces (const std::vector< RecurrentForcePtr > &forces) |
| Sets the list of recurrent forces. | |
| void | add_recurrent_force (RecurrentForcePtr force) |
| Adds a recurrent force to the simulator and enables it. | |
| void | set_recurrent_forces_enabled (bool flag) |
| Sets whether recurrent forces are disabled or enabled. | |
| const std::vector< RecurrentForcePtr > & | get_recurrent_forces () const |
| Gets the set of recurrent forces for the simulator. | |
| bool | get_recurrent_force_enabled (RecurrentForcePtr force) |
| void | set_recurrent_force_enabled (RecurrentForcePtr force, bool flag) |
| Sets a recurrent force to enabled or disabled. | |
| const std::vector< DynamicBodyPtr > & | get_dynamic_bodies () const |
| Gets the vector of dynamic bodies in the simulator. | |
| IntegratorPtr | get_integrator () |
| Real | get_time () const |
| Gets the current time. | |
| Real | get_regression_factor () const |
| Gets the factor to use for regressing the simulator. | |
| void | set_integrator (IntegratorPtr integrator) |
| Sets the integration mechanism for the simulator. | |
| void | set_time (Real time) |
| Sets the current time. | |
| void | set_regression_factor (Real regression_factor) |
| Sets the factor to use for regressing the simulator. | |
| void | add_transient_vdata (SoNode *vdata) |
| Adds a SoNode to the list of transient data. | |
| SoSeparator * | get_persistent_vdata () const |
| Gets the persistent visualization data. | |
| SoSeparator * | get_transient_vdata () const |
| Gets the transient (one-step) visualization data. | |
Protected Member Functions | |
| void | integrate (Real step_size) |
| Calculates the forward dynamics of all bodies and sets the new state. | |
Protected Attributes | |
| SoSeparator * | _persistent_vdata |
| SoSeparator * | _transient_vdata |
| std::vector< DynamicBodyPtr > | _bodies |
| std::vector< RecurrentForcePtr > | _recurrent_forces |
| std::set< RecurrentForcePtr > | _active_forces |
| Real | _regression_factor |
| bool | _external_forces_determined |
| If set to true the external forces have been determined. | |
Class used for performing dynamics simulation of rigid bodies without contact. Rigid body simulation of articulated bodies is supported using both maximal and reduced coordinate approaches.
| Simulator::Simulator | ( | ) |
Sets up the simulator.
The simulator properties are set as follows:
| void Simulator::determine_external_forces | ( | ) | [virtual] |
Explicitly computes all of the external forces applied to bodies.
This method explicitly computes all external forces applied to the bodies in the simulation, including gravity. This method is called by step() automatically if needed, or the user can call this manually before step() (if the user needs to know all of the applied forces).
Reimplemented in Physsim::ImpulseContactSimulator, and Physsim::ThreshContactSimulator.
| void Simulator::clone | ( | BasePtr & | cloned, | |
| bimap< BasePtr, BasePtr > * | object_map = NULL | |||
| ) | const [virtual] |
Clones this simulator.
Performs a shallow copy of all underlying collision geometries and visualization data.
Reimplemented from Physsim::Base.
Reimplemented in Physsim::ImpulseContactSimulator, and Physsim::ThreshContactSimulator.
| void Simulator::load_state | ( | BaseConstPtr | object, | |
| bimap< BasePtr, BasePtr > * | correspondence = NULL | |||
| ) | [virtual] |
Loads this object with data from a clone.
This and the clone must have exactly the same structure (i.e., same number of bodies, same number of recurrent forces, and one/no integrator. Additionally, bodies, recurrent forces, and integrator must have the same structure.
Reimplemented from Physsim::Base.
Reimplemented in Physsim::ImpulseContactSimulator, and Physsim::ThreshContactSimulator.
| void Simulator::save_state | ( | BasePtr | object, | |
| bimap< BasePtr, BasePtr > * | correspondence = NULL | |||
| ) | const [virtual] |
Saves this to a given object.
This and the clone must have exactly the same structure (i.e., same number of bodies, same number of recurrent forces, and one/no integrator. Additionally, bodies, recurrent forces, and integrator must have the same structure.
Reimplemented from Physsim::Base.
Reimplemented in Physsim::ImpulseContactSimulator, and Physsim::ThreshContactSimulator.
| Real Simulator::step | ( | Real | step_size | ) | [virtual] |
Steps the Simulator forward in time without contact.
This pseudocode was inspired from [Baraff 1997] and [Mirtich 1996]. Note that any requisite impulses should be applied before calling this method.
| step_size | the step size |
Reimplemented in Physsim::ImpulseContactSimulator, and Physsim::ThreshContactSimulator.
| DynamicBodyPtr Simulator::find_dynamic_body | ( | const std::string & | name | ) | const |
Finds the dynamic body in the simulator, if any.
Searches unarticulated bodies, articulated bodies, and links of articulated bodies.
| void Simulator::set_recurrent_forces | ( | const std::vector< RecurrentForcePtr > & | forces | ) |
Sets the list of recurrent forces.
| void Simulator::set_recurrent_forces_enabled | ( | bool | flag | ) |
Sets whether recurrent forces are disabled or enabled.
Sets all recurrent forces to either disabled or enabled.
| const std::vector<DynamicBodyPtr>& Physsim::Simulator::get_dynamic_bodies | ( | ) | const [inline] |
Gets the vector of dynamic bodies in the simulator.
| Real Physsim::Simulator::get_regression_factor | ( | ) | const [inline] |
Gets the factor to use for regressing the simulator.
This scalar, which can range from one to infinity, specifies the degree that the simulator regresses when discontinuities arise in the simulation (e.g., from colliding contact, joint limit violations, etc.). Higher numbers result in further regression, at the cost of simulation speed. Lower numbers may result in visible artifacts (e.g., interpenetration of bodies, joint limit violations, etc.).
| void Physsim::Simulator::set_regression_factor | ( | Real | regression_factor | ) | [inline] |
Sets the factor to use for regressing the simulator.
This scalar, which can range from one to infinity, specifies the degree that the simulator regresses when discontinuities arise in the simulation (e.g., from colliding contact, joint limit violations, etc.). Higher numbers result in further regression, at the cost of simulation speed. Lower numbers may result in visible artifacts (e.g., interpenetration of bodies, joint limit violations, etc.).
bool Physsim::Simulator::_external_forces_determined [protected] |
If set to true the external forces have been determined.
This flag should be used by implementations of the determine_external_forces() method to see whether external forces remain to be computed for a simulation step; similarly, methods that re-implement step() must remember to clear this flag at the end of that method.
1.5.1