Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

oxygen::Joint Class Reference

ODE joint object. More...

#include <joint.h>

Inheritance diagram for oxygen::Joint:

Inheritance graph
[legend]
Collaboration diagram for oxygen::Joint:

Collaboration graph
[legend]
List of all members.

Public Types

enum  EBodyIndex { BI_FIRST = 0, BI_SECOND = 1 }
enum  EAxisIndex { AI_FIRST = 0, AI_SECOND = 1, AI_THIRD = 2 }

Public Member Functions

 Joint ()
virtual ~Joint ()
virtual void Attach (boost::shared_ptr< Body > body1, boost::shared_ptr< Body > body2)
 attaches the joint to some new bodies.
void Attach (const std::string &path1, const std::string &path2)
 attaches the joint to some new bodies, that are given as path expressions.
boost::shared_ptr< BodyGetBody (EBodyIndex idx)
 returns one of the bodies that this joint connects, according to the given EBodyIndex
int GetType ()
 returns the type of the managed ODE joint, possible return values are dJointTypeNone, dJointTypeBall, dJointTypeHinge, dJointTypeSlider, dJointTypeContact, dJointTypeUniversal, dJointTypeHinge2, dJointTypeFixed or dJointTypeAMotor.
void EnableFeedback (bool enable)
 during the world time step, the forces that are applied by each joint are added directly to the joined bodies, and the user normally has no way of telling which joint contributed how much force.
bool FeedBackEnabled ()
 returns true if the joint is set to collect feedback information
salt::Vector3f GetFeedbackForce (EBodyIndex idx)
 queries the force that the joint applied to one body attached to it during the last timestep.
salt::Vector3f GetFeedbackTorque (EBodyIndex idx)
 queries the torque that the joint applied to one body attached to it during the last timestep.
void SetBounce (EAxisIndex idx, float bounce)
 sets the bouncyness of the stops.
float GetBounce (EAxisIndex idx)
 returns the bouncyness of the stops
void SetLowStopDeg (EAxisIndex idx, float deg)
 sets the low stop angle in degrees, this stop must be greater than -180 to be effective
float GetLowStopDeg (EAxisIndex idx)
 returns the low stop angle in degrees
void SetHighStopDeg (EAxisIndex idx, float deg)
 sets the high stop angle in degrees, this stop must be less than +180 to be effective
float GetHighStopDeg (EAxisIndex idx)
 returns the high stop angle in degrees
void SetLowStopPos (EAxisIndex idx, float deg)
 sets the low stop position
float GetLowStopPos (EAxisIndex idx)
 returns the low stop position
void SetHighStopPos (EAxisIndex idx, float deg)
 sets the high stop position
float GetHighStopPos (EAxisIndex idx)
 returns the high stop position
void SetCFM (EAxisIndex idx, float cfm)
 the constraint force mixing (CFM) value used when not at a stop
float GetCFM (EAxisIndex idx)
 returns the constraint force mixing value used when not a a stop
void SetStopCFM (EAxisIndex idx, float cfm)
 sets the constraint force mixing (CFM) value used by the stops.
float GetStopCFM (EAxisIndex idx)
 returns the constraint force mixing value used by the stops
void SetStopERP (EAxisIndex idx, float erp)
 sets the error reduction parameter (ERP) used by the stops.
float GetStopERP (EAxisIndex idx)
 returns the error reduction parameter used by the stops
void SetSuspensionERP (EAxisIndex idx, float erp)
 sets the suspension error reduction parameter (ERP).
float GetSuspensionERP (EAxisIndex idx)
 returns the suspension error reduction parameter (ERP).
void SetSuspensionCFM (EAxisIndex idx, float cfm)
 sets the suspension constraint force mixing value.
float GetSuspensionCFM (EAxisIndex idx)
 returns the suspension constraint force mixing value.
void SetLinearMotorVelocity (EAxisIndex idx, float vel)
 sets the linear motor velocity
float GetLinearMotorVelocity (EAxisIndex idx)
 returns the linear motor velocity
void SetAngularMotorVelocity (EAxisIndex idx, float deg)
 sets the angular motor velocity in degrees
float GetAngularMotorVelocity (EAxisIndex idx)
 returns the angular motor velocity in degrees
void SetMaxMotorForce (EAxisIndex idx, float f)
 sets the maximum force or torque that the motor will use to achieve the desired velocity.
float GetMaxMotorForce (EAxisIndex idx)
 returns the maximum force or torque that the motor will use to achieve the desired velocity.

Static Public Member Functions

static boost::shared_ptr<
Joint
GetJoint (dJointID id)
 returns the Joint node corresponding to the given ODE joint
static bool AreConnected (boost::shared_ptr< Body > body1, boost::shared_ptr< Body > body2)
 returns true if the two given bodies are connected by a joint
static bool AreConnectedExcluding (boost::shared_ptr< Body > body1, boost::shared_ptr< Body > body2, int joint_type)
 returns true if the two given bodies are connected together by a joint that does not have the given joint type.

Protected Member Functions

virtual void OnLink ()
 associated the created ODE joint with this node
boost::shared_ptr< BodyGetBody (const std::string &path)
 get the node at 'path' and tries a cast to Body
virtual void SetParameter (int parameter, float value)=0
 sets a joint parameter value
virtual float GetParameter (int parameter)=0
 returns a joint parameter value

Protected Attributes

dJointID mODEJoint
 the managed ODE joint
boost::shared_ptr< dJointFeedback > mFeedback
 the allocated joint feedback structure

Detailed Description

ODE joint object.

A joint is a relationship (a constraint) that is enforced between two bodies so that they can only have certain positions and orientations relative to each other.

Note that the joint geometry parameter setting functions should only be called after the joint has been attached to bodies, and those bodies have been correctly positioned, otherwise the joint may not be initialized correctly. If the joint is not already attached, these functions will do nothing.

The default anchor for all joints is global (0,0,0). The default axis for all joints is global (1,0,0).

There are no functions to set joint angles or positions (or their rates) directly, instead you must set the corresponding body positions and velocities.

Definition at line 49 of file joint.h.


Member Enumeration Documentation

enum oxygen::Joint::EAxisIndex
 

Enumerator:
AI_FIRST 
AI_SECOND 
AI_THIRD 

Definition at line 58 of file joint.h.

enum oxygen::Joint::EBodyIndex
 

Enumerator:
BI_FIRST 
BI_SECOND 

Definition at line 52 of file joint.h.


Constructor & Destructor Documentation

Joint::Joint  ) 
 

Definition at line 29 of file joint.cpp.

Joint::~Joint  )  [virtual]
 

Definition at line 33 of file joint.cpp.

References EnableFeedback(), and mODEJoint.

Here is the call graph for this function:


Member Function Documentation

static bool oxygen::Joint::AreConnected boost::shared_ptr< Body body1,
boost::shared_ptr< Body body2
[static]
 

returns true if the two given bodies are connected by a joint

static bool oxygen::Joint::AreConnectedExcluding boost::shared_ptr< Body body1,
boost::shared_ptr< Body body2,
int  joint_type
[static]
 

returns true if the two given bodies are connected together by a joint that does not have the given joint type.

For possible joint type constants see GetType()

void Joint::Attach const std::string &  path1,
const std::string &  path2
 

attaches the joint to some new bodies, that are given as path expressions.

These path expressions are allowed to be relative to this joint node.

Definition at line 156 of file joint.cpp.

References Attach(), and GetBody().

Here is the call graph for this function:

virtual void oxygen::Joint::Attach boost::shared_ptr< Body body1,
boost::shared_ptr< Body body2
[virtual]
 

attaches the joint to some new bodies.

If the joint is already attached, it will be detached from the old bodies first. To attach this joint to only one body, set body1 or body2 to null. A null body refers to the static environment. Setting both bodies to zero puts the joint into "limbo", i.e. it will have no effect on the simulation.

Reimplemented in oxygen::SliderJoint.

Referenced by Attach().

void Joint::EnableFeedback bool  enable  ) 
 

during the world time step, the forces that are applied by each joint are added directly to the joined bodies, and the user normally has no way of telling which joint contributed how much force.

If this information is desired the joint can be enabled to collect feedback information. By default a joint does not collect any feedback information.

Definition at line 203 of file joint.cpp.

References mFeedback, and mODEJoint.

Referenced by ~Joint().

bool Joint::FeedBackEnabled  ) 
 

returns true if the joint is set to collect feedback information

Definition at line 223 of file joint.cpp.

References mODEJoint.

float Joint::GetAngularMotorVelocity EAxisIndex  idx  ) 
 

returns the angular motor velocity in degrees

Definition at line 401 of file joint.cpp.

References GetParameter(), and salt::gRadToDeg().

Here is the call graph for this function:

shared_ptr< Body > Joint::GetBody const std::string &  path  )  [protected]
 

get the node at 'path' and tries a cast to Body

Definition at line 124 of file joint.cpp.

References zeitgeist::Object::GetCore(), zeitgeist::Object::GetLog(), and zeitgeist::Object::GetSelf().

Here is the call graph for this function:

boost::shared_ptr< Body > Joint::GetBody EBodyIndex  idx  ) 
 

returns one of the bodies that this joint connects, according to the given EBodyIndex

Definition at line 169 of file joint.cpp.

References oxygen::Body::GetBody(), and mODEJoint.

Referenced by Attach().

Here is the call graph for this function:

float Joint::GetBounce EAxisIndex  idx  ) 
 

returns the bouncyness of the stops

Definition at line 291 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

float Joint::GetCFM EAxisIndex  idx  ) 
 

returns the constraint force mixing value used when not a a stop

Definition at line 341 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

Vector3f Joint::GetFeedbackForce EBodyIndex  idx  ) 
 

queries the force that the joint applied to one body attached to it during the last timestep.

Definition at line 228 of file joint.cpp.

References BI_FIRST, BI_SECOND, and mFeedback.

Vector3f Joint::GetFeedbackTorque EBodyIndex  idx  ) 
 

queries the torque that the joint applied to one body attached to it during the last timestep.

Definition at line 257 of file joint.cpp.

References BI_FIRST, BI_SECOND, and mFeedback.

float Joint::GetHighStopDeg EAxisIndex  idx  ) 
 

returns the high stop angle in degrees

Definition at line 331 of file joint.cpp.

References GetParameter(), and salt::gRadToDeg().

Here is the call graph for this function:

float Joint::GetHighStopPos EAxisIndex  idx  ) 
 

returns the high stop position

Definition at line 311 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

shared_ptr< Joint > Joint::GetJoint dJointID  id  )  [static]
 

returns the Joint node corresponding to the given ODE joint

Definition at line 53 of file joint.cpp.

References zeitgeist::Object::GetSelf().

Here is the call graph for this function:

float Joint::GetLinearMotorVelocity EAxisIndex  idx  ) 
 

returns the linear motor velocity

Definition at line 391 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

float Joint::GetLowStopDeg EAxisIndex  idx  ) 
 

returns the low stop angle in degrees

Definition at line 321 of file joint.cpp.

References GetParameter(), and salt::gRadToDeg().

Here is the call graph for this function:

float Joint::GetLowStopPos EAxisIndex  idx  ) 
 

returns the low stop position

Definition at line 301 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

float Joint::GetMaxMotorForce EAxisIndex  idx  ) 
 

returns the maximum force or torque that the motor will use to achieve the desired velocity.

Definition at line 411 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

virtual float oxygen::Joint::GetParameter int  parameter  )  [protected, pure virtual]
 

returns a joint parameter value

Implemented in oxygen::AngularMotor, oxygen::BallJoint, oxygen::FixedJoint, oxygen::Hinge2Joint, oxygen::HingeJoint, oxygen::SliderJoint, and oxygen::UniversalJoint.

Referenced by GetAngularMotorVelocity(), GetBounce(), GetCFM(), GetHighStopDeg(), GetHighStopPos(), GetLinearMotorVelocity(), GetLowStopDeg(), GetLowStopPos(), GetMaxMotorForce(), GetStopCFM(), GetStopERP(), GetSuspensionCFM(), and GetSuspensionERP().

float Joint::GetStopCFM EAxisIndex  idx  ) 
 

returns the constraint force mixing value used by the stops

Definition at line 351 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

float Joint::GetStopERP EAxisIndex  idx  ) 
 

returns the error reduction parameter used by the stops

Definition at line 361 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

float Joint::GetSuspensionCFM EAxisIndex  idx  ) 
 

returns the suspension constraint force mixing value.

As of ode 0.039 this is only implemented on the hinge-2 joint.

Definition at line 381 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

float Joint::GetSuspensionERP EAxisIndex  idx  ) 
 

returns the suspension error reduction parameter (ERP).

As of ode 0.039 this is only implemented on the hinge-2 joint.

Definition at line 371 of file joint.cpp.

References GetParameter().

Here is the call graph for this function:

int Joint::GetType  ) 
 

returns the type of the managed ODE joint, possible return values are dJointTypeNone, dJointTypeBall, dJointTypeHinge, dJointTypeSlider, dJointTypeContact, dJointTypeUniversal, dJointTypeHinge2, dJointTypeFixed or dJointTypeAMotor.

Definition at line 164 of file joint.cpp.

References mODEJoint.

void Joint::OnLink  )  [protected, virtual]
 

associated the created ODE joint with this node

Reimplemented from zeitgeist::Leaf.

Reimplemented in oxygen::AngularMotor, oxygen::BallJoint, oxygen::FixedJoint, oxygen::Hinge2Joint, oxygen::HingeJoint, oxygen::SliderJoint, and oxygen::UniversalJoint.

Definition at line 43 of file joint.cpp.

References mODEJoint.

void Joint::SetAngularMotorVelocity EAxisIndex  idx,
float  deg
 

sets the angular motor velocity in degrees

Definition at line 396 of file joint.cpp.

References salt::gDegToRad(), and SetParameter().

Here is the call graph for this function:

void Joint::SetBounce EAxisIndex  idx,
float  bounce
 

sets the bouncyness of the stops.

This is a restitution parameter in the range 0..1. 0 means the stops are not bouncy at all, 1 means maximum bouncyness.

Definition at line 286 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

void Joint::SetCFM EAxisIndex  idx,
float  cfm
 

the constraint force mixing (CFM) value used when not at a stop

Definition at line 336 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

void Joint::SetHighStopDeg EAxisIndex  idx,
float  deg
 

sets the high stop angle in degrees, this stop must be less than +180 to be effective

Definition at line 326 of file joint.cpp.

References salt::gDegToRad(), and SetParameter().

Here is the call graph for this function:

void Joint::SetHighStopPos EAxisIndex  idx,
float  deg
 

sets the high stop position

Definition at line 306 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

void Joint::SetLinearMotorVelocity EAxisIndex  idx,
float  vel
 

sets the linear motor velocity

Definition at line 386 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

void Joint::SetLowStopDeg EAxisIndex  idx,
float  deg
 

sets the low stop angle in degrees, this stop must be greater than -180 to be effective

Definition at line 316 of file joint.cpp.

References salt::gDegToRad(), and SetParameter().

Here is the call graph for this function:

void Joint::SetLowStopPos EAxisIndex  idx,
float  deg
 

sets the low stop position

Definition at line 296 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

void Joint::SetMaxMotorForce EAxisIndex  idx,
float  f
 

sets the maximum force or torque that the motor will use to achieve the desired velocity.

This must always be greater than or equal to zero. Setting this to zero (the default value) turns off the motor

Definition at line 406 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

virtual void oxygen::Joint::SetParameter int  parameter,
float  value
[protected, pure virtual]
 

sets a joint parameter value

Implemented in oxygen::AngularMotor, oxygen::BallJoint, oxygen::FixedJoint, oxygen::Hinge2Joint, oxygen::HingeJoint, oxygen::SliderJoint, and oxygen::UniversalJoint.

Referenced by SetAngularMotorVelocity(), SetBounce(), SetCFM(), SetHighStopDeg(), SetHighStopPos(), SetLinearMotorVelocity(), SetLowStopDeg(), SetLowStopPos(), SetMaxMotorForce(), SetStopCFM(), SetStopERP(), SetSuspensionCFM(), and SetSuspensionERP().

void Joint::SetStopCFM EAxisIndex  idx,
float  cfm
 

sets the constraint force mixing (CFM) value used by the stops.

Together with the ERP value this can be used to get spongy or soft stops. This is intended for unpowered joints, it does not really work as expected when a powered joint reaches its limit.

Definition at line 346 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

void Joint::SetStopERP EAxisIndex  idx,
float  erp
 

sets the error reduction parameter (ERP) used by the stops.

Definition at line 356 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

void Joint::SetSuspensionCFM EAxisIndex  idx,
float  cfm
 

sets the suspension constraint force mixing value.

As of ode 0.039 this is only implemented on the hinge-2 joint.

Definition at line 376 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:

void Joint::SetSuspensionERP EAxisIndex  idx,
float  erp
 

sets the suspension error reduction parameter (ERP).

As of ode 0.039 this is only implemented on the hinge-2 joint.

Definition at line 366 of file joint.cpp.

References SetParameter().

Here is the call graph for this function:


Member Data Documentation

boost::shared_ptr<dJointFeedback> oxygen::Joint::mFeedback [protected]
 

the allocated joint feedback structure

Definition at line 259 of file joint.h.

Referenced by EnableFeedback(), GetFeedbackForce(), and GetFeedbackTorque().

dJointID oxygen::Joint::mODEJoint [protected]
 

the managed ODE joint

Definition at line 256 of file joint.h.

Referenced by EnableFeedback(), FeedBackEnabled(), oxygen::UniversalJoint::GetAnchor(), oxygen::HingeJoint::GetAnchor(), oxygen::Hinge2Joint::GetAnchor(), oxygen::BallJoint::GetAnchor(), oxygen::UniversalJoint::GetAngle(), oxygen::HingeJoint::GetAngle(), oxygen::Hinge2Joint::GetAngle(), oxygen::UniversalJoint::GetAngleRate(), oxygen::HingeJoint::GetAngleRate(), oxygen::Hinge2Joint::GetAngleRate(), oxygen::UniversalJoint::GetAxis(), oxygen::HingeJoint::GetAxis(), oxygen::AngularMotor::GetAxisAnchor(), oxygen::AngularMotor::GetAxisAngle(), oxygen::AngularMotor::GetAxisAngleRate(), GetBody(), oxygen::AngularMotor::GetMode(), oxygen::AngularMotor::GetMotorAxis(), oxygen::AngularMotor::GetNumAxes(), oxygen::UniversalJoint::GetParameter(), oxygen::SliderJoint::GetParameter(), oxygen::HingeJoint::GetParameter(), oxygen::Hinge2Joint::GetParameter(), oxygen::AngularMotor::GetParameter(), oxygen::SliderJoint::GetPosition(), oxygen::SliderJoint::GetPositionRate(), GetType(), oxygen::UniversalJoint::OnLink(), oxygen::SliderJoint::OnLink(), OnLink(), oxygen::HingeJoint::OnLink(), oxygen::Hinge2Joint::OnLink(), oxygen::FixedJoint::OnLink(), oxygen::BallJoint::OnLink(), oxygen::AngularMotor::OnLink(), oxygen::UniversalJoint::SetAnchor(), oxygen::HingeJoint::SetAnchor(), oxygen::Hinge2Joint::SetAnchor(), oxygen::BallJoint::SetAnchor(), oxygen::HingeJoint::SetAxis(), oxygen::UniversalJoint::SetAxis1(), oxygen::UniversalJoint::SetAxis2(), oxygen::AngularMotor::SetAxisAngle(), oxygen::AngularMotor::SetMode(), oxygen::AngularMotor::SetMotorAxis(), oxygen::AngularMotor::SetNumAxes(), oxygen::UniversalJoint::SetParameter(), oxygen::SliderJoint::SetParameter(), oxygen::HingeJoint::SetParameter(), oxygen::Hinge2Joint::SetParameter(), oxygen::AngularMotor::SetParameter(), and ~Joint().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:46:10 2006 for rcssserver3d by  doxygen 1.4.4