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

Public Member Functions | |
| ImpulseContactSimulator () | |
| Constructs a ImpulseContactSimulator with no parameters. | |
| virtual void | determine_external_forces () |
| Explicitly computes all of the external forces applied to bodies. | |
| CollisionGeometryPtr | find_collision_geometry (const std::string &name) const |
| Finds the collision geometry in the contact simulator, if any. | |
| virtual void | clone (BasePtr &cloned, bimap< BasePtr, BasePtr > *object_map=NULL) const |
| Clones this object and all objects underneath. | |
| virtual bool | is_struct_identical (BaseConstPtr object) const |
| Verifies that structure is identical. | |
| virtual void | load_state (BaseConstPtr object, bimap< BasePtr, BasePtr > *object_map=NULL) |
| Loads object data. | |
| virtual void | save_state (BasePtr object, bimap< BasePtr, BasePtr > *object_map=NULL) const |
| Saves all object data. | |
| virtual void | load_from_xml (XMLTreeConstPtr node, std::map< std::string, BasePtr > &id_map) |
| Implements Base::load_from_xml(). | |
| virtual void | save_to_xml (XMLTreePtr node, std::list< BaseConstPtr > &shared_objects) const |
| Implements Base::save_to_xml(). | |
| virtual void | output_object_state (std::ostream &out) const |
| Outputs this class data to the stream. | |
|
const std::map< sorted_pair< BasePtr >, boost::shared_ptr< ContactData > > & | get_contact_data () const |
| Gets the map of contact data for this simulator. | |
| const std::list< ContactPtr > & | get_contacts () const |
| Gets the list of contacts determined on the last step. | |
| void | clear_contact_data () |
| Clears the set of contact data. | |
| void | add_contact_data (boost::shared_ptr< ContactData > cd) |
| Adds the given ContactData object to the set of contact data. | |
| boost::shared_ptr< CollisionDetection > | get_collision_detection () |
| Gets the collision detection method for the simulator. | |
| void | set_collision_detection (boost::shared_ptr< CollisionDetection > colldet) |
| Gets the collision detection method for the simulator. | |
| virtual Real | step (Real step_size) |
| Steps the simulation forward. | |
| void | set_callback_function (void(*fn)(ContactPtr)) |
| Sets the callback function for processing found contacts. | |
| void(* | get_callback_function ())(ContactPtr) |
| Gets the callback function for processing found method (if any). | |
| Real | get_collision_tolerance () const |
| Gets the non-negative tolerance with which the simulator tests for collision. | |
| void | set_collision_tolerance (Real collision_tolerance) |
| Sets the non-negative tolerance with which the simulator tests for collision (default is zero). | |
Protected Member Functions | |
| void | preprocess_contact (ContactPtr contact) const |
| Performs necessary preprocessing on a contact. | |
| boost::shared_ptr< ContactData > | get_contact_data (CollisionGeometryPtr g1, boost::shared_ptr< CollisionGeometry > g2) const |
| bool | impact_contact (boost::shared_ptr< ICSMinimalStateStruct > state_t0, boost::shared_ptr< ICSMinimalStateStruct > state_tf) |
| Determines whether there is an impact contact in the interval [t0, tf]. | |
| void | regress_to_first_TOI (boost::shared_ptr< ICSMinimalStateStruct > state_t0, boost::shared_ptr< ICSMinimalStateStruct > state_tf, Real tolerance) |
| Finds and integrates the simulation to right after the first time-of-impact (TOI) for a simulation with impacts. | |
| boost::shared_ptr< ICSMinimalStateStruct > | clone_minimal () const |
| Clones the state of the simulator minimally. | |
| void | load_state_minimal (boost::shared_ptr< ICSMinimalStateStruct > mss) |
| Loads the state of the simulator from a minimal description. | |
| void | update_contacts () |
| Calls collision detection and updates list of contacts. | |
Static Protected Member Functions | |
| static void * | find_contact (void *arg) |
Protected Attributes | |
| std::list< ContactPtr > | _contacts |
| Real | _collision_tolerance |
|
std::map< sorted_pair< BasePtr >, boost::shared_ptr< ContactData > > | _contact_data |
| boost::shared_ptr< CollisionDetection > | _coll_det |
| void(* | _callback_fn )(ContactPtr) |
ImpulseContactSimulator::step(step_size) operates using the following model:
The ImpulseContactSimulator is more advanced than the ThreshContactSimulator: it is simpler, more stable, and faster.
| ImpulseContactSimulator::ImpulseContactSimulator | ( | ) |
Constructs a ImpulseContactSimulator with no parameters.
The parameters default to the following values:
| void ImpulseContactSimulator::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 from Physsim::Simulator.
| void ImpulseContactSimulator::load_state | ( | BaseConstPtr | object, | |
| bimap< BasePtr, BasePtr > * | correspondence = NULL | |||
| ) | [virtual] |
Loads object data.
The underlying structure between this and object must be identical. In particular, the vectors of dynamic bodies and recurrent forces must be identical (same length and identical structure), the sets of contact data are identically sized, and identically one/none collision detector, collision method, resting contact, and integrator.
Reimplemented from Physsim::Simulator.
| void ImpulseContactSimulator::save_state | ( | BasePtr | object, | |
| bimap< BasePtr, BasePtr > * | correspondence = NULL | |||
| ) | const [virtual] |
Saves all object data.
The underlying structure between this and object must be identical. In particular, the vectors of dynamic bodies and recurrent forces must be identical (same length and identical structure), the sets of contact data are identically sized, and identically one/none collision detector, collision method, resting contact, and integrator.
Reimplemented from Physsim::Simulator.
| void ImpulseContactSimulator::output_object_state | ( | std::ostream & | out | ) | const [virtual] |
Outputs this class data to the stream.
This method outputs all of the low-level details to the stream; if serialization is desired, use save_to_xml() instead.
Reimplemented from Physsim::Base.
| Real ImpulseContactSimulator::step | ( | Real | step_size | ) | [virtual] |
Steps the simulation forward.
The simulator will take less than the step_size requested if collision impulses are applied. If the full step size is requested, call step_full().
Reimplemented from Physsim::Simulator.
| bool ImpulseContactSimulator::impact_contact | ( | boost::shared_ptr< ICSMinimalStateStruct > | state_t0, | |
| boost::shared_ptr< ICSMinimalStateStruct > | state_tf | |||
| ) | [protected] |
Determines whether there is an impact contact in the interval [t0, tf].
This method may be made more complex in the future, but it currently checks whether an impact exists at time tf.
| void ImpulseContactSimulator::regress_to_first_TOI | ( | boost::shared_ptr< ICSMinimalStateStruct > | state_t0, | |
| boost::shared_ptr< ICSMinimalStateStruct > | state_tf, | |||
| Real | tolerance | |||
| ) | [protected] |
Finds and integrates the simulation to right after the first time-of-impact (TOI) for a simulation with impacts.
The simulation regresses to immediately after either the first joint-limit impact or the first contact impact, whichever occurs before the other.
| state_t0 | the simulation at the previous step | |
| state_tf | the simulation at/after time-of-impact |
| boost::shared_ptr< ICSMinimalStateStruct > ImpulseContactSimulator::clone_minimal | ( | ) | const [protected] |
Clones the state of the simulator minimally.
All bodies are cloned, time is saved, and contact data is saved.
1.5.1