Physsim::RCArticulatedBody Class Reference

Defines an articulated body for use with reduced-coordinate dynamics algorithms. More...

#include <RCArticulatedBody.h>

Inheritance diagram for Physsim::RCArticulatedBody:

Physsim::ArticulatedBody Physsim::DynamicBody Physsim::Visualizable Physsim::Base List of all members.

Public Member Functions

 RCArticulatedBody ()
 Default constructor.
 RCArticulatedBody (const RCArticulatedBody &source)
 Copy constructor.
virtual void clone (BasePtr &cloned, bimap< BasePtr, BasePtr > *obj_map=NULL) const
 Clones this body.
virtual bool is_struct_identical (BaseConstPtr object) const
 Verifies that two object structures are identical.
virtual void load_state (BaseConstPtr object, bimap< BasePtr, BasePtr > *correspondence=NULL)
 Loads this object with data from a RCArticulatedBody object.
virtual void save_state (BasePtr object, bimap< BasePtr, BasePtr > *correspondence=NULL) const
 Save this to a RCArticulatedBody object.
void set_links (const std::vector< RigidBodyPtr > &links)
 Sets the list of articulated links.
RigidBodyPtr find_link (const std::string &linkname) const
 Finds the link with the given name.
JointPtr find_joint (const std::string &jointname) const
 Finds the joint with the given name.
void add_link (RigidBodyPtr link)
 Appends a link to the list of links.
virtual VectorN get_state_deriv ()
 Gets the derivative of the state-vector for this articulated body.
virtual VectorN get_state ()
 Gets the state vector for this articulated body.
virtual void set_state (const VectorN &state)
 Sets the state vector this articulated body.
MatrixN calc_jacobian_column (JointPtr joint, const Vector3 &point)
 Calculates column(s) of a Jacobian matrix.
MatrixNN calc_jacobian_floating_base (const VectorN &point)
 Calculates the column of a Jacobian matrix for a floating base with respect to a given point.
virtual std::list< RigidBodyPtr > get_rigid_bodies () const
 Gets the list of links as rigid body objects.
virtual void reset_accumulators ()
 Resets the force and torque accumulators for all links and joints in the rigid body.
virtual std::list< sorted_pair<
RigidBodyPtr > > 
get_adjacent_links () const
 Retrieves all adjacent links as pairs of rigid bodies.
void add_joint (JointPtr joint)
 Appends a joint to the list of joints.
void set_joints (const std::vector< JointPtr > joints)
 Sets the list of joints.
void update_link_transforms () const
 Updates the transforms of the links based on the current joint positions.
void update_link_velocities ()
 Updates the link velocities.
void apply_impulse (const Vector3 &j, const Vector3 &k, const Vector3 &p, RigidBodyPtr link)
 Applies a linear impulse at the specified point and propagates it up the articulated body chain.
virtual void compile ()
 Compiles this body (updates the link transforms and velocities).
virtual void calc_fwd_dyn ()
 Computes the forward dynamics.
virtual void update_visualization ()
 Synchronizes the visualization for all links and joints of this body to their corresponding transforms.
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().
RCArticulatedBodyPtr get_this ()
RCArticulatedBodyConstPtr get_this () const
virtual bool joint_limit_collision (Real collision_tolerance) const
 Abstract method for determining whether or not there is a collision at the joint-limit.
virtual void correct_joint_limit_collisions (Real collision_tolerance)
 Abstract method for correcting joint limit collisions.
virtual void correct_joint_limit_violations ()
 Abstract method for correcting joint limit violations.
RigidBodyPtr get_base_link () const
 Gets the base link.
const std::vector< RigidBodyPtr > & get_links () const
 Gets the list of links; the base is the first link.
const std::vector< JointPtr > & get_joints () const
 Gets the list of joints.
bool is_floating_base () const
 Gets whether this articulated body uses a floating base.
void set_floating_base (bool flag)
 Sets whether this articulated body uses a floating base.
RigidBodyPtr get_base () const
 Gets the base link.
void set_computation_ref_frame (ReferenceFrameType type)
 Sets the reference frame for computation.
ReferenceFrameType get_computation_ref_frame () const
 Gets the reference frame for computation.
boost::shared_ptr< RCArticulatedBodyFwdDynAlgoget_forward_dynamics_algorithm () const
 Gets the algorithm for forward dynamics computation.
void set_forward_dynamics_algorithm (boost::shared_ptr< RCArticulatedBodyFwdDynAlgo > algorithm)
 Sets the algorithm for forward dynamics computation.

Detailed Description

Defines an articulated body for use with reduced-coordinate dynamics algorithms.

Reduced-coordinate articulated bodies cannot rely upon the integrator to automatically update the states (i.e., positions, velocities) of the links, as is done with maximal-coordinate articulated bodies. Rather, the integrator updates the joint positions and velocities; the states are obtained from this reduced-coordinate representation. Notes about concurrency:

It is generally desirable to be able to run forward dynamics and inverse dynamics algorithms concurrently to simulate actual robotic systems. In general, derived classes should not operate on state variables (joint positions, velocities, accelerations and floating base positions, velocites, and accelerations) directly during execution of the algorithm. Rather, derived classes should operate on copies of the state variables, updating the state variables on conclusion of the algorithms.


Constructor & Destructor Documentation

RCArticulatedBody::RCArticulatedBody (  ) 

Default constructor.

Constructs a reduced-coordinate articulated body with no joints and no links.


Member Function Documentation

void RCArticulatedBody::clone ( BasePtr &  cloned,
bimap< BasePtr, BasePtr > *  object_map = NULL 
) const [virtual]

Clones this body.

Performs a shallow copy of the underlying collision geometry and visualization data.

Reimplemented from Physsim::Visualizable.

void RCArticulatedBody::load_state ( BaseConstPtr  object,
bimap< BasePtr, BasePtr > *  correspondence = NULL 
) [virtual]

Loads this object with data from a RCArticulatedBody object.

This and the clone must have exactly the same structure (i.e., same number of links, joints, one/none parent link, and one/none inner joint; additionally, child links, parent link (if any), and inner joint (if any) must have the same structure.

Reimplemented from Physsim::Visualizable.

void RCArticulatedBody::save_state ( BasePtr  object,
bimap< BasePtr, BasePtr > *  correspondence = NULL 
) const [virtual]

Save this to a RCArticulatedBody object.

This and the clone must have exactly the same structure (i.e., same number of links, joints, one/none parent link, and one/none inner joint; additionally, child links, parent link (if any), and inner joint (if any) must have the same structure.

Reimplemented from Physsim::Visualizable.

RigidBodyPtr RCArticulatedBody::find_link ( const std::string &  linkname  )  const

Finds the link with the given name.

Returns:
NULL if the link was not found

JointPtr RCArticulatedBody::find_joint ( const std::string &  jointname  )  const

Finds the joint with the given name.

Returns:
NULL if the joint wasboost::shared_ptr<void> not found

VectorN RCArticulatedBody::get_state_deriv (  )  [virtual]

Gets the derivative of the state-vector for this articulated body.

The state vector consists of the joint-space positions and velocities of the robot as well as the base position and momentum; therefore, the derivative of the state vector is composed of the joint-space velocities and accelerations and base velocities and forces (and torques).

Implements Physsim::ArticulatedBody.

VectorN RCArticulatedBody::get_state (  )  [virtual]

Gets the state vector for this articulated body.

The state vector consists of the joint-space positions and velocities of the robot and base positions and momenta.

Implements Physsim::ArticulatedBody.

void RCArticulatedBody::set_state ( const VectorN state  )  [virtual]

Sets the state vector this articulated body.

The state vector consists of the joint-space positions and velocities of the robot and base positions and momenta. Note that this method is responsible for setting the transforms of the individual links as well.

Implements Physsim::ArticulatedBody.

MatrixNN RCArticulatedBody::calc_jacobian_floating_base ( const VectorN point  ) 

Calculates the column of a Jacobian matrix for a floating base with respect to a given point.

Parameters:
point the point in 3D space which the Jacobian is calculated against
Returns:
a pointer to a 6x6 matrix; top three dimensions will be linear velocity and bottom three dimensions will be angular velocity

std::list< RigidBodyPtr > RCArticulatedBody::get_rigid_bodies (  )  const [virtual]

Gets the list of links as rigid body objects.

Needed for implementation of ArticulatedBody::get_rigid_bodies().

Implements Physsim::ArticulatedBody.

void RCArticulatedBody::update_link_transforms (  )  const

Updates the transforms of the links based on the current joint positions.

Note:
all transforms for the body are recalculated, not just joint values that have changed

void RCArticulatedBody::apply_impulse ( const Vector3 j,
const Vector3 k,
const Vector3 contact_point,
RigidBodyPtr  link 
) [virtual]

Applies a linear impulse at the specified point and propagates it up the articulated body chain.

Parameters:
j the linear impulse
k the angular impulse
contact_point the point of collision
link the link that the impulse is applied to
fsab_algo if non-null, already computed quanities from dynamics algorithm will be used; otherwise, forward dynamics algorithm will be called using FSAB algorithm

Implements Physsim::ArticulatedBody.

void RCArticulatedBody::calc_fwd_dyn (  )  [virtual]

Computes the forward dynamics.

Given the joint positions and velocities, joint forces, and external forces on the links, determines the joint and link accelerations as well as floating base accelerations (if applicable). The joint accelerations are stored in the individual joints and the link accelerations are stored in the individual links.

Note:
only computes the forward dynamics if the state-derivative is no longer valid

Implements Physsim::DynamicBody.

void RCArticulatedBody::load_from_xml ( XMLTreeConstPtr  node,
std::map< std::string, BasePtr > &  id_map 
) [virtual]

Implements Base::load_from_xml().

Precondition:
all links and joints must be loaded using their respective serialization methods before this method is called

Reimplemented from Physsim::Visualizable.

void Physsim::RCArticulatedBody::set_computation_ref_frame ( ReferenceFrameType  type  )  [inline]

Sets the reference frame for computation.

Note:
this should be done before any forward or inverse dynamics calculation is run


The documentation for this class was generated from the following files:
Generated on Wed Oct 24 14:54:23 2007 for Physsim by  doxygen 1.5.1