Moby
Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
Moby::TimeSteppingSimulator Class Reference

An event-driven simulator. More...

#include <TimeSteppingSimulator.h>

Inheritance diagram for Moby::TimeSteppingSimulator:
Moby::ConstraintSimulator Moby::Simulator Moby::Base

Public Member Functions

 TimeSteppingSimulator ()
 Default constructor.
 
virtual void load_from_xml (boost::shared_ptr< const XMLTree > node, std::map< std::string, BasePtr > &id_map)
 Implements Base::load_from_xml()
 
virtual void save_to_xml (XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const
 Implements Base::save_to_xml()
 
virtual double step (double dt)
 Steps the simulator forward by the given step size.
 
boost::shared_ptr
< ContactParameters
get_contact_parameters (CollisionGeometryPtr geom1, CollisionGeometryPtr geom2) const
 
boost::shared_ptr
< TimeSteppingSimulator
get_this ()
 Gets the shared pointer for this.
 
- Public Member Functions inherited from Moby::ConstraintSimulator
 ConstraintSimulator ()
 Default constructor.
 
boost::shared_ptr
< ContactParameters
get_contact_parameters (CollisionGeometryPtr geom1, CollisionGeometryPtr geom2) const
 Gets the contact data between a pair of geometries (if any) More...
 
const std::vector
< PairwiseDistInfo > & 
get_pairwise_distances () const
 
std::vector
< UnilateralConstraint > & 
get_compliant_constraints ()
 Gets the (sorted) compliant constraint data.
 
std::vector
< UnilateralConstraint > & 
get_rigid_constraints ()
 Gets the (sorted) rigid constraint data.
 
boost::shared_ptr
< CollisionDetection
get_collision_detection () const
 Gets the collision detection mechanism.
 
- Public Member Functions inherited from Moby::Simulator
 Simulator ()
 Sets up the simulator. More...
 
ControlledBodyPtr find_dynamic_body (const std::string &name) const
 Finds the dynamic body in the simulator, if any. More...
 
void add_dynamic_body (ControlledBodyPtr body)
 Adds a dynamic body to the simulator. More...
 
void remove_dynamic_body (ControlledBodyPtr body)
 Removes a dynamic body from the simulator.
 
void update_visualization ()
 Updates all visualization under the simulator.
 
const std::vector
< ControlledBodyPtr > & 
get_dynamic_bodies () const
 Gets the list of dynamic bodies in the simulator. More...
 
void add_transient_vdata (osg::Node *vdata)
 Adds transient visualization data to the simulator.
 
osg::Node * get_persistent_vdata () const
 Gets the persistent visualization data.
 
osg::Node * get_transient_vdata () const
 Gets the transient (one-step) visualization data.
 
template<class ForwardIterator >
double integrate (double dt, ForwardIterator begin, ForwardIterator end)
 Integrates both position and velocity of rigid _bodies. More...
 
- Public Member Functions inherited from Moby::Base
 Base (const Base *b)
 

Public Attributes

double min_step_size
 
std::set< Ravelin::sorted_pair
< CollisionGeometryPtr > > 
unchecked_pairs
 Determines whether two geometries are not checked.
 
std::vector< std::pair
< ControlledBodyPtr,
Ravelin::VectorNd > > 
_x0
 Vectors set and passed to collision detection.
 
std::vector< std::pair
< ControlledBodyPtr,
Ravelin::VectorNd > > 
_x1
 
- Public Attributes inherited from Moby::ConstraintSimulator
ConstraintStabilization cstab
 The constraint stabilization mechanism.
 
std::set< Ravelin::sorted_pair
< CollisionGeometryPtr > > 
unchecked_pairs
 Determines whether two geometries are not checked.
 
std::vector< std::pair
< ControlledBodyPtr,
Ravelin::VectorNd > > 
_x0
 Vectors set and passed to collision detection.
 
std::vector< std::pair
< ControlledBodyPtr,
Ravelin::VectorNd > > 
_x1
 
boost::shared_ptr
< ContactParameters >(* 
get_contact_parameters_callback_fn )(CollisionGeometryPtr g1, CollisionGeometryPtr g2)
 Callback function for getting contact parameters.
 
void(* post_mini_step_callback_fn )(ConstraintSimulator *s)
 Callback function after a mini-step is completed.
 
void(* constraint_callback_fn )(std::vector< UnilateralConstraint > &, boost::shared_ptr< void >)
 The callback function (called when constraints have been determined) More...
 
void(* constraint_post_callback_fn )(const std::vector< UnilateralConstraint > &, boost::shared_ptr< void >)
 The callback function (called after forces/impulses are applied)
 
boost::shared_ptr< void > constraint_callback_data
 Data passed to unilateral constraint callback.
 
boost::shared_ptr< void > constraint_post_callback_data
 Data passed to post-constraint callback.
 
std::map< Ravelin::sorted_pair
< BasePtr >, boost::shared_ptr
< ContactParameters > > 
contact_params
 Mapping from objects to contact parameters.
 
bool render_contact_points
 If set to 'true' simulator will process contact points for rendering.
 
- Public Attributes inherited from Moby::Simulator
double current_time
 The current simulation time.
 
boost::shared_ptr< Dissipationdissipator
 The dissipation mechanism for larger time steps.
 
void(* post_step_callback_fn )(Simulator *s)
 Callback function after a step is completed.
 
double dynamics_time
 User time spent by dynamics on the last step.
 
std::vector< JointPtrimplicit_joints
 Set of implicit joints maintained in the simulation (does not include implicit joints belonging to RCArticulatedBody objects)
 
- Public Attributes inherited from Moby::Base
boost::shared_ptr< void > userdata
 Any relevant userdata.
 
std::string id
 The unique ID for this object.
 

Protected Member Functions

bool constraints_met (const std::vector< PairwiseDistInfo > &current_pairwise_distances)
 Checks to see whether all constraints are met.
 
std::set< Ravelin::sorted_pair
< CollisionGeometryPtr > > 
get_current_contact_geoms () const
 Gets the current set of contact geometries.
 
double do_mini_step (double dt)
 Does a full integration cycle (but not necessarily a full step)
 
void step_si_Euler (double dt)
 Does a semi-implicit step. More...
 
double calc_next_CA_Euler_step () const
 Finds the next event time assuming constant velocity. More...
 
- Protected Member Functions inherited from Moby::ConstraintSimulator
void calc_impacting_unilateral_constraint_forces (double dt)
 Handles constraints.
 
void find_unilateral_constraints ()
 Finds the set of unilateral constraints.
 
void calc_compliant_unilateral_constraint_forces ()
 Computes compliant contact forces.
 
void preprocess_constraint (UnilateralConstraint &e)
 Performs necessary preprocessing on an constraint.
 
void determine_geometries ()
 Sets up the list of collision geometries.
 
void broad_phase (double dt)
 Does broad phase collision detection, identifying which pairs of geometries may come into contact over time step of dt.
 
void calc_pairwise_distances ()
 Computes pairwise distances of geometries at their current poses, using broad phase results to determine which pairs should be checked. More...
 
void visualize_contact (UnilateralConstraint &constraint)
 Draws a ray directed from a contact point along the contact normal.
 
double calc_CA_step ()
 
double calc_next_CA_Euler_step (double contact_dist_thresh) const
 
- Protected Member Functions inherited from Moby::Simulator
void apply_impulse (boost::shared_ptr< Ravelin::DynamicBodyd > db, const Ravelin::SharedVectorNd &gj)
 Applies a generalized impulse to a dynamic body. More...
 
void solve (const std::vector< boost::shared_ptr< Ravelin::DynamicBodyd > > &island, const std::vector< JointPtr > &island_joints, const Ravelin::VectorNd &v, const Ravelin::VectorNd &f, double dt, Ravelin::VectorNd &a, Ravelin::VectorNd &lambda) const
 
virtual double check_pairwise_constraint_violations (double t)
 
void find_islands (std::vector< std::vector< boost::shared_ptr< Ravelin::DynamicBodyd > > > &islands)
 Finds islands.
 
unsigned num_generalized_coordinates (const std::vector< boost::shared_ptr< Ravelin::DynamicBodyd > > &island) const
 Gets the number of generalized coordinates in an island.
 
void calc_fwd_dyn (double dt)
 Calculates forward dynamics for bodies (does not consider unilateral constraints)
 
void precalc_fwd_dyn ()
 Prepares to calculate forward dynamics for bodies.
 
template<class ForwardIterator >
double integrate (double step_size, ForwardIterator begin, ForwardIterator end)
 Integrates both position and velocity of rigid _bodies. More...
 
double integrate (double step_size)
 Integrates all dynamic bodies.
 

Friends

class CollisionDetection
 

Additional Inherited Members

- Static Public Member Functions inherited from Moby::Base
template<class T >
static boost::shared_ptr< T > clone (boost::shared_ptr< T > x)
 Static method for cloning a shared pointer.
 
- Protected Attributes inherited from Moby::ConstraintSimulator
ImpactConstraintHandler _impact_constraint_handler
 Object for handling impact constraints.
 
PenaltyConstraintHandler _penalty_constraint_handler
 Object for handling penalty constraints.
 
std::vector< UnilateralConstraint_rigid_constraints
 The vector of rigid constraints.
 
std::vector< UnilateralConstraint_compliant_constraints
 The vector of compliant constraints.
 
std::vector< PairwiseDistInfo_pairwise_distances
 Pairwise distances at bodies' current configurations.
 
Ravelin::VectorNd _workV
 Work vector.
 
boost::shared_ptr
< CollisionDetection
_coldet
 The collision detection mechanism.
 
std::vector< CollisionGeometryPtr_geometries
 The geometries in the simulator.
 
std::vector< std::pair
< CollisionGeometryPtr,
CollisionGeometryPtr > > 
_pairs_to_check
 Geometric pairs that should be checked for unilateral constraints (according to broad phase collision detection)
 
- Protected Attributes inherited from Moby::Simulator
osg::Group * _persistent_vdata
 
osg::Group * _transient_vdata
 
std::vector< ControlledBodyPtr_bodies
 The set of bodies in the simulation.
 
Ravelin::VectorNd _current_dx
 The derivative at the current time.
 

Detailed Description

An event-driven simulator.

Member Function Documentation

double TimeSteppingSimulator::calc_next_CA_Euler_step ( ) const
protected

Finds the next event time assuming constant velocity.

This method returns the next possible time of contact, discarding current contacts from consideration.

Note
proper operation of this function is critical. If the function improperly designates an event as not occuring at the current time, calc_next_CA_Euler_step(.) will return a small value and prevent large integration steps from being taken. If the function improperly designates an event as occuring at the current time, constraint violation could occur.
void TimeSteppingSimulator::step_si_Euler ( double  dt)
protected

Does a semi-implicit step.

Does a semi-implicit step (version with conservative advancement)


The documentation for this class was generated from the following files: