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

Public Member Functions | |
| ThreshContactSimulator () | |
| Constructs a ThreshContactSimulator with no parameters. | |
| virtual void | step_full (Real step_size, Real smallest_step) |
| Steps a full step (for a variable stepping method). | |
| 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_impacting_contacts () const |
| Gets the list of impacting contacts determined on the last step. | |
| const std::list< ContactPtr > & | get_resting_contacts () const |
| Gets the list of resting 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). | |
| Real | get_contact_resting_vel_thresh () const |
| Gets the non-negative threshold below which the simulator considers a contact as resting and above which it is considered impacting. | |
| void | set_contact_resting_vel_thresh (Real resting_vel_thresh) |
| Sets the threshold below which the simulator considers a contact as resting and above which it is considered impacting (default is .1). | |
Protected Member Functions | |
| void | update_contact_phases (const std::map< sorted_pair< CollisionGeometryPtr >, QueryPtr > &colliding_pairs) |
| Updates the contact phases given the current pairs of collision geometries in contact. | |
| void | preprocess_contact (ContactPtr contact) const |
| Performs necessary preprocessing on a contact. | |
| Contact::ContactPhaseType | det_contact_type (ContactPtr c, Contact::ContactPhaseType current_phase) |
| Determines the type of contact in the simulation. | |
| boost::shared_ptr< ContactData > | get_contact_data (CollisionGeometryPtr g1, boost::shared_ptr< CollisionGeometry > g2) const |
| bool | impact_contact (boost::shared_ptr< TCSMinimalStateStruct > state_t0, boost::shared_ptr< TCSMinimalStateStruct > state_tf) |
| Determines whether there is an impact contact in the interval [t0, tf]. | |
| void | regress_to_first_TOI (boost::shared_ptr< TCSMinimalStateStruct > state_t0, boost::shared_ptr< TCSMinimalStateStruct > 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< TCSMinimalStateStruct > | clone_minimal () const |
| Clones the state of the simulator minimally. | |
| void | load_state_minimal (boost::shared_ptr< TCSMinimalStateStruct > mss) |
| Loads the state of the simulator from a minimal description. | |
Protected Attributes | |
| std::list< ContactPtr > | _resting_contacts |
| std::list< ContactPtr > | _impacting_contacts |
| Real | _contact_resting_vel_thresh |
| Real | _collision_tolerance |
|
std::map< sorted_pair< BasePtr >, boost::shared_ptr< ContactData > > | _contact_data |
| boost::shared_ptr< CollisionDetection > | _coll_det |
| void(* | _callback_fn )(ContactPtr) |
The ThreshContactSimulator class operates using a specific model. In particular, the simulation proceeds in the following manner on each call of step(step_size):
The ThreshContactSimulator is the more primitive contact simulator; it is generally better to use ImpulseContactSimulator, which is more stable, simpler, and faster.
| ThreshContactSimulator::ThreshContactSimulator | ( | ) |
Constructs a ThreshContactSimulator with no parameters.
The parameters default to the following values:
| void ThreshContactSimulator::step_full | ( | Real | step_size, | |
| Real | smallest_step | |||
| ) | [virtual] |
Steps a full step (for a variable stepping method).
Calls step() repeatedly until simulation has been integrated by the specified step-size.
| void ThreshContactSimulator::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, contact forces, etc. 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 ThreshContactSimulator::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 ThreshContactSimulator::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 ThreshContactSimulator::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 ThreshContactSimulator::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 ThreshContactSimulator::impact_contact | ( | boost::shared_ptr< TCSMinimalStateStruct > | state_t0, | |
| boost::shared_ptr< TCSMinimalStateStruct > | 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 ThreshContactSimulator::regress_to_first_TOI | ( | boost::shared_ptr< TCSMinimalStateStruct > | state_t0, | |
| boost::shared_ptr< TCSMinimalStateStruct > | 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< TCSMinimalStateStruct > ThreshContactSimulator::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