Physsim::Joint Class Reference

Defines a joint used in articulated rigid body dynamics simulation. More...

#include <Joint.h>

Inheritance diagram for Physsim::Joint:

Physsim::Visualizable Physsim::Base Physsim::PrismaticJoint Physsim::RevoluteJoint Physsim::SphericalJoint Physsim::UniversalJoint List of all members.

Public Types

enum  DOFs {
  DOF_1 = 0, DOF_2 = 1, DOF_3 = 2, DOF_4 = 3,
  DOF_5 = 4, DOF_6 = 5
}

Public Member Functions

 Joint ()
 Initializes the joint.
 Joint (boost::weak_ptr< RigidBody > inboard, boost::weak_ptr< RigidBody > outboard)
 Initializes the joint with the specified inboard and outboard links.
virtual void clone (BasePtr &cloned, bimap< BasePtr, BasePtr > *obj_map=NULL) const
 Clones this link.
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 an object.
virtual void save_state (BasePtr object, bimap< BasePtr, BasePtr > *correspondence=NULL) const
 Saves this data state to a Joint object.
void set_q (const VectorN &q)
 Sets the position(s) for this joint.
void set_qd (const VectorN &qd)
 Sets the velocity for this joint.
void add_force (const VectorN &force)
 Adds to the force / torque produced by this joint's actuator.
void reset_force ()
 Resets the force / torque produced by this joint's actuator.
virtual const SMatrixNget_spatial_axes (ReferenceFrameType type)
 Gets the spatial axis for this joint.
void reset_spatial_axis ()
 Resets the computation for this joint.
Vector3 get_position_global () const
 Gets the global position of this joint.
VectorN get_scaled_force ()
 Gets the scaled and limited actuator forces.
VectorN compute_joint_friction_forces () const
 Gets the frictional forces, if any, at this joint.
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().
virtual void set_inboard_link (RigidBodyPtr link)
 Sets the pointer to the inboard link for this joint (and updates the spatial axis, if the outboard link has been set).
virtual void set_outboard_link (RigidBodyPtr link)
 Sets the pointer to the outboard link for this joint.
virtual bool is_singular_config () const=0
 Gets whether this joint is in a singular configuration.
JointPtr get_this ()
 Gets the shared pointer to this joint.
JointConstPtr get_this () const
 Gets the constant shared pointer to this joint.
virtual const SMatrixNget_spatial_axes_deriv (ReferenceFrameType type)=0
 Abstract method to get the spatial axis derivative for this joint.
virtual const Matrix4get_transform ()=0
 Abstract method to get the local transform for this joint.
virtual void update_spatial_axes ()=0
 Abstract method to update the local spatial axes.
virtual void determine_Q ()=0
 Abstract method to determine the value of Q (joint position) from current transforms.
virtual unsigned get_num_dof () const=0
 Gets the number of degrees-of-freedom for this joint.
const VectorNget_max_force () const
 Gets the maximum allowable force / torque that the actuator of this joint is capable of producing.
const VectorNget_q () const
 Gets the current position of this joint.
const VectorNget_qd () const
 Gets the current velocity of this joint.
const VectorNget_qdd () const
 Gets the current acceleration of this joint.
const VectorNget_low_limit () const
 Gets the lower positional limit for this joint.
const VectorNget_high_limit () const
 Gets the upper positional limit for this joint.
Real get_joint_limit_rcoeff () const
 Gets the coefficient of restitution for joint limit violations (0..1).
Real get_joint_limit_kp () const
 Gets the spring constant value for joint limit violations (0..infinity).
Real get_joint_limit_kv () const
 Gets the damping constant value for joint limit violations (0..infinity).
const VectorNget_joint_viscous_mu () const
 Gets the viscous friction coefficients for this joint (zero by default).
const VectorNget_joint_coulomb_mu () const
 Gets the Coulomb friction coefficients for this joint (zero by default).
boost::weak_ptr< RigidBodyget_inboard_link () const
 Gets the inboard link for this joint.
boost::weak_ptr< RigidBodyget_outboard_link () const
 Gets the outboard link for this joint.
const VectorNget_force () const
 Gets the force / torque applied by this joint's actuator.
void set_joint_limit_rcoeff (Real joint_limit_rcoeff)
 Sets the coefficient of restitution for joint limit violations (0..1).
void set_joint_limit_kp (Real kp)
 Sets the spring constant value for joint limit violations (0..infinity).
void set_joint_limit_kv (Real kv)
 Sets the damping constant value for joint limit violations (0..infinity).
void set_max_force (const VectorN &maxforce)
 Sets the maximum producable force / torque by this joint's actuator.
void set_qdd (const VectorN &qdd)
 Sets the acceleration for this joint.
void set_joint_viscous_mu (const VectorN &mu)
 Sets the viscous friction coefficients for this joint (zero by default).
void set_joint_coulomb_mu (const VectorN &mu)
 Sets the Coulomb friction coefficients for this joint (zero by default).
void set_low_limit (const VectorN &lolimit)
 Sets the lower positional limits for this joint.
void set_high_limit (const VectorN &hilimit)
 Sets the upper positional limits for this joint.
boost::weak_ptr< ArticulatedBodyget_articulated_body ()
 Gets the articulated body corresponding to this body.
void set_articulated_body (ArticulatedBodyPtr abody)
 Sets the articulated body corresponding to this body.

Protected Member Functions

void init_data ()
 Method for initializing all variables in the joint.

Protected Attributes

SMatrixN _si
SMatrixNPtr _s0

Detailed Description

Defines a joint used in articulated rigid body dynamics simulation.

Todo:
implement a rest position for q?


Constructor & Destructor Documentation

Joint::Joint (  ) 

Initializes the joint.

The coefficient of restitution and the spring and damping constants for the joint limits are set to 0. The inboard and outboard links are set to NULL.

Joint::Joint ( boost::weak_ptr< RigidBody inboard,
boost::weak_ptr< RigidBody outboard 
)

Initializes the joint with the specified inboard and outboard links.

The joint-limit coefficient of restitution and the spring and damping constants for the joint limits are set to 0. Note that it is possible that the inboard link is NULL, indicating that this joint connects the base to the outboard link.


Member Function Documentation

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

Clones this link.

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

Reimplemented from Physsim::Visualizable.

Reimplemented in Physsim::PrismaticJoint, Physsim::RevoluteJoint, Physsim::SphericalJoint, and Physsim::UniversalJoint.

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

Loads this object with data from an object.

This and the object must have exactly the same structure (i.e., one/none inboard link, one/none outboard link, one/none art. body pointer; additionally, inboard and outboard links and articulated body must have the same structure.

Reimplemented from Physsim::Visualizable.

Reimplemented in Physsim::PrismaticJoint, Physsim::RevoluteJoint, Physsim::SphericalJoint, and Physsim::UniversalJoint.

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

Saves this data state to a Joint object.

This and the object must have exactly the same structure (i.e., one/none inboard link, one/none outboard link, one/none art. body pointer; additionally, inboard and outboard links and articulated body must have the same structure.

Reimplemented from Physsim::Visualizable.

Reimplemented in Physsim::PrismaticJoint, Physsim::RevoluteJoint, Physsim::SphericalJoint, and Physsim::UniversalJoint.

void Joint::set_q ( const VectorN q  ) 

Sets the position(s) for this joint.

Parameters:
q the new position for the joint
Note:
link transforms are not updated

void Joint::set_qd ( const VectorN qd  ) 

Sets the velocity for this joint.

Note:
link linear and angular velocities are not updated

VectorN Joint::compute_joint_friction_forces (  )  const

Gets the frictional forces, if any, at this joint.

The model is somewhat simple: each joint has associated Coulombic friction and viscous friction coefficients. Coulomb friction is computed as -mu_coulomb * sgn(qd) while viscous friction is computed as -mu_viscous * qd.

void Joint::set_outboard_link ( RigidBodyPtr  outboard  )  [virtual]

Sets the pointer to the outboard link for this joint.

Note:
also points the outboard link to this joint

virtual const SMatrixN& Physsim::Joint::get_spatial_axes_deriv ( ReferenceFrameType  type  )  [pure virtual]

Abstract method to get the spatial axis derivative for this joint.

The time-derivative of the constraint equation is a scalar function that returns zero when the constraint is perfectly satisfied.

Implemented in Physsim::PrismaticJoint, Physsim::RevoluteJoint, Physsim::SphericalJoint, and Physsim::UniversalJoint.

const VectorN& Physsim::Joint::get_low_limit (  )  const [inline]

Gets the lower positional limit for this joint.

Note:
joint limits are currently not enforced

const VectorN& Physsim::Joint::get_high_limit (  )  const [inline]

Gets the upper positional limit for this joint.

Note:
joint limits are currently not enforced

Real Physsim::Joint::get_joint_limit_rcoeff (  )  const [inline]

Gets the coefficient of restitution for joint limit violations (0..1).

Note:
currently unused

Real Physsim::Joint::get_joint_limit_kp (  )  const [inline]

Gets the spring constant value for joint limit violations (0..infinity).

Note:
currently unused

Real Physsim::Joint::get_joint_limit_kv (  )  const [inline]

Gets the damping constant value for joint limit violations (0..infinity).

Note:
currently unused

const VectorN& Physsim::Joint::get_joint_viscous_mu (  )  const [inline]

Gets the viscous friction coefficients for this joint (zero by default).

The friction coefficients do not permit covariance between joints.

const VectorN& Physsim::Joint::get_joint_coulomb_mu (  )  const [inline]

Gets the Coulomb friction coefficients for this joint (zero by default).

The friction coefficients do not permit covariance between joints.

void Physsim::Joint::set_joint_limit_kp ( Real  kp  )  [inline]

Sets the spring constant value for joint limit violations (0..infinity).

Note:
currently unused

void Physsim::Joint::set_joint_limit_kv ( Real  kv  )  [inline]

Sets the damping constant value for joint limit violations (0..infinity).

Note:
currently unused

void Physsim::Joint::set_joint_viscous_mu ( const VectorN mu  )  [inline]

Sets the viscous friction coefficients for this joint (zero by default).

The friction coefficients do not permit covariance between joints. a vector of non-negative friction coefficients

void Physsim::Joint::set_joint_coulomb_mu ( const VectorN mu  )  [inline]

Sets the Coulomb friction coefficients for this joint (zero by default).

The friction coefficients do not permit covariance between joints. a vector of non-negative friction coefficients

void Physsim::Joint::set_low_limit ( const VectorN lolimit  )  [inline]

Sets the lower positional limits for this joint.

Note:
joint limits are currently not enforced

void Physsim::Joint::set_high_limit ( const VectorN hilimit  )  [inline]

Sets the upper positional limits for this joint.

Note:
joint limits are currently not enforced

boost::weak_ptr<ArticulatedBody> Physsim::Joint::get_articulated_body (  )  [inline]

Gets the articulated body corresponding to this body.

Returns:
a pointer to the articulated body, or NULL if this body is not a link an articulated body

void Physsim::Joint::set_articulated_body ( ArticulatedBodyPtr  abody  )  [inline]

Sets the articulated body corresponding to this body.

Parameters:
body a pointer to the articulated body or NULL if this body is not a link in an articulated body

void Joint::init_data (  )  [protected]

Method for initializing all variables in the joint.

This method should be called at the beginning of all constructors of all derived classes.


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