Physsim::Constraint Class Reference

Defines an abstract constraint used for maximal coordinate methods. More...

#include <Constraint.h>

Inheritance diagram for Physsim::Constraint:

Physsim::Base List of all members.

Public Member Functions

virtual void read (const char *filename)=0
virtual void write (const char *filename)=0
int getBodyIndex (const RigidBody *body) const
 Gets the index of a body in the given list.
bool isEnabled () const
 Determines whether this constraint is currently enabled.
void setEnabled (bool flag)
 Sets whether this constraint is currently enabled.
virtual std::string getJointType () const=0
 Gets the type of the constraint.
RigidBodygetBodyFirst () const
 Gets the pointer to the first rigid body managed by this constraint; if the pointer is NULL, the body is constrained to the environment.
RigidBodygetBodySecond () const
 Gets the pointer to the second rigid body managed by this constraint; if the pointer is NULL, the body is constrained to the environment.
void setBodies (const RigidBody *body1, const RigidBody *body2)
 Sets both rigid bodies managed by this constraint.
Vector3 getBodyFirstTorque () const
 Gets the torque that would be applied to the first body by this constraint.
Vector3 getBodyFirstForce () const
 Gets the force that would be applied to the first body by this constraint.
Vector3 getBodySecondTorque () const
 Gets the torque that would be applied to the second body by this constraint.
Vector3 getBodySecondForce () const
 Gets the force that would be applied to the second body by this constraint.
void setBodyFirstTorque (const Vector3 &torque)
 Sets the torque that would be applied to the first body by this constraint.
void setBodyFirstForce (const Vector3 &force)
 Sets the force that would be applied to the first body by this constraint.
void setBodySecondTorque (const Vector3 &torque)
 Sets the torque that would be applied to the second body by this constraint.
void setBodySecondForce (const Vector3 &force)
 Sets the force that would be applied to the second body by this constraint.
Real getMaxForce () const
 Gets the magnitude of the maximum possible force that this constraint can apply.
Real getMaxTorque () const
 Gets the magnitude of the maximum possible torque that this constraint can apply.
void setMaxForce (Real maxforce)
 Sets the magnitude of the maximum possible force that this constraint can apply.
void setMaxTorque (Real maxtorque)
 Sets the magnitude of the maximum possible torque that this constraint can apply.
virtual Real getImplicit (const std::vector< RigidBody * > body_list) const=0
 Gets the value of the scalar implicit function for this constraint.
virtual Real getImplicitD (const std::vector< RigidBody * > body_list) const=0
 Gets the value of the derivative of the scalar implicit function for this constraint.
virtual VectorN getJacobian (const std::vector< RigidBody * > body_list) const=0
 Gets the Jacobian of the constraint.
virtual VectorN getJacobianD (const std::vector< RigidBody * > body_list) const=0
 Gets the derivative of the Jacobian of the constraint.
Real getKP () const
 Gets the value of the spring drift-correction term.
void setKP (Real kp)
 Sets the value of the spring drift-correction term.
Real getKD () const
 Gets the value of the damper drift-correction term.
void setKD (Real kd)
 Sets the value of the damper drift-correction term.

Protected Attributes

RigidBody_body1
 Pointer to the first body.
RigidBody_body2
 Pointer to the second body.
Vector3 _f1
 Force applied by this constraint to the first body.
Vector3 _t1
 Torque applied by this constraint to the first body.
Vector3 _f2
 Force applied by this constraint to the second body.
Vector3 _t2
 Torque applied by this constraint to the second body.
Real _kp
 Spring constant used to correct numerical drift.
Real _kd
 Damper constant used to correct numerical drift.
Real _maxforce
 Magnitude of the maximum possible force that this constraint can apply.
Real _maxtorque
 Magnitude of the maximum possible torque that this constraint can apply.

Detailed Description

Defines an abstract constraint used for maximal coordinate methods.

This class will be replaced completely by the Joint class, which will implement constraints for both reduced and maximal-coordinate articulated bodies.


Member Function Documentation

int Physsim::Constraint::getBodyIndex ( const RigidBody body  )  const

Gets the index of a body in the given list.

Returns:
the 0-index of the body, or -1 if the body does not exist in the list

void Physsim::Constraint::setBodies ( const RigidBody body1,
const RigidBody body2 
)

Sets both rigid bodies managed by this constraint.

Note that if either body is NULL, then the other body is constrained to the environment. If both bodies are NULL, the constraint is effectively disabled (though it is more efficient to set the constraint to disabled via setEnabled().

virtual Real Physsim::Constraint::getImplicit ( const std::vector< RigidBody * >  body_list  )  const [pure virtual]

Gets the value of the scalar implicit function for this constraint.

In ideal circumstances, this method will return zero. In the presence of drift, however, the value will be nonzero. This method, as well as getImplicitD(), is used to enforce the constraints via a spring and damper system.

virtual Real Physsim::Constraint::getImplicitD ( const std::vector< RigidBody * >  body_list  )  const [pure virtual]

Gets the value of the derivative of the scalar implicit function for this constraint.

In ideal circumstances, this method will return zero. In the presence of drift, however, this value will be nonzero. This method, as well as getImplicit(), is used to enforce the constraints via a spring and damper system.

virtual VectorN Physsim::Constraint::getJacobian ( const std::vector< RigidBody * >  body_list  )  const [pure virtual]

Gets the Jacobian of the constraint.

The the Jacobian is a row-vector of dimension N*3, where N is the number of bodies in the system.

virtual VectorN Physsim::Constraint::getJacobianD ( const std::vector< RigidBody * >  body_list  )  const [pure virtual]

Gets the derivative of the Jacobian of the constraint.

The derivative of the Jacobian is a row-vector of dimension N*3, where N is the number of bodies in the system.


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