opal::ODEJoint Class Reference

The ODE implementation of the Joint class. More...

#include <ODEJoint.h>

Inheritance diagram for opal::ODEJoint:

opal::Joint List of all members.

Public Member Functions

 ODEJoint (dWorldID worldID)
virtual ~ODEJoint ()
virtual void OPAL_CALL init (const JointData &data)
virtual real OPAL_CALL getAngle (int axisNum) const
virtual real OPAL_CALL getDistance (int axisNum) const
virtual real OPAL_CALL getVelocity (int axisNum) const
virtual void OPAL_CALL setLimitsEnabled (int axisNum, bool e)
virtual void OPAL_CALL setEnabled (bool e)
virtual void OPAL_CALL setLimitRange (int axisNum, real low, real high)
virtual void OPAL_CALL setLimitHardness (int axisNum, real h)
virtual void OPAL_CALL setLimitBounciness (int axisNum, real b)
virtual JointAxis OPAL_CALL getAxis (int axisNum) const
virtual Point3r OPAL_CALL getAnchor () const
virtual void OPAL_CALL internal_update ()
virtual void OPAL_CALL internal_setDesiredVel (int axisNum, real value)
virtual void OPAL_CALL internal_setMaxTorque (int axisNum, real value)
dJointID OPAL_CALL internal_getJointID () const

Protected Member Functions

virtual void setAxis (int axisNum, const JointAxis &axis)
virtual void setAnchor (const Point3r &anchor)
void setJointParam (int parameter, dReal value)
virtual real calcStress ()
virtual void attachODEBodies (Solid *s0, Solid *s1)
void filterSolidForStaticness (Solid *s0, Solid *s1)

Protected Attributes

dJointID mJointID
dJointID mAMotorID
dWorldID mWorldID
dJointFeedback mJointFeedback

Detailed Description

The ODE implementation of the Joint class.

Definition at line 39 of file ODEJoint.h.


Constructor & Destructor Documentation

opal::ODEJoint::ODEJoint dWorldID  worldID  ) 
 

Definition at line 33 of file ODEJoint.cpp.

References mAMotorID, mJointID, and mWorldID.

opal::ODEJoint::~ODEJoint  )  [virtual]
 

Definition at line 40 of file ODEJoint.cpp.

References mAMotorID, and mJointID.


Member Function Documentation

void opal::ODEJoint::attachODEBodies Solid s0,
Solid s1
[protected, virtual]
 

Attaches the ODE Joint to the given ODESolids.

Definition at line 1016 of file ODEJoint.cpp.

References opal::BALL_JOINT, opal::JointData::getType(), mAMotorID, opal::Joint::mData, and mJointID.

Referenced by setEnabled().

real opal::ODEJoint::calcStress  )  [protected, virtual]
 

Returns the current amount of stress on this Joint.

Definition at line 968 of file ODEJoint.cpp.

References opal::ACCUMULATED_MODE, opal::JointData::breakMode, opal::Vec3r::length(), opal::Joint::mData, mJointID, opal::THRESHOLD_MODE, and opal::UNBREAKABLE_MODE.

Referenced by internal_update().

void opal::ODEJoint::filterSolidForStaticness Solid s0,
Solid s1
[protected]
 

Static solids are set to NULL internally.

Note:
this handles the cases when either both are being set to NULL or both are the same Solid.

Definition at line 213 of file ODEJoint.cpp.

References opal::JointData::enabled, opal::Solid::isStatic(), opal::Joint::mData, and opal::Joint::setSolids().

Referenced by setEnabled().

Point3r opal::ODEJoint::getAnchor  )  const [virtual]
 

Returns the current anchor point in global coordinates. Passing in an invalid axis number will return invalid data.

Implements opal::Joint.

Definition at line 524 of file ODEJoint.cpp.

References opal::defaults::joint::anchor, opal::BALL_JOINT, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, opal::Joint::mData, mJointID, opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

real opal::ODEJoint::getAngle int  axisNum  )  const [virtual]
 

For rotational axes, returns the current angle in degrees measured from the initial Joint configuration. For translational axes, simply returns 0.

Implements opal::Joint.

Definition at line 239 of file ODEJoint.cpp.

References opal::BALL_JOINT, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, mAMotorID, opal::Joint::mData, mJointID, opal::Joint::mNumAxes, opal::radToDeg(), opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

JointAxis opal::ODEJoint::getAxis int  axisNum  )  const [virtual]
 

Returns the current specified axis in global coordinates. Passing in an invalid axis number will return invalid data.

Implements opal::Joint.

Definition at line 452 of file ODEJoint.cpp.

References opal::BALL_JOINT, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, mAMotorID, opal::Joint::mData, mJointID, opal::Joint::mNumAxes, opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

real opal::ODEJoint::getDistance int  axisNum  )  const [virtual]
 

For translational axes, returns the distance from the initial Joint configuration. For rotational axes, simply returns 0.

Implements opal::Joint.

Definition at line 292 of file ODEJoint.cpp.

References opal::BALL_JOINT, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, opal::Joint::mData, mJointID, opal::Joint::mNumAxes, opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

real opal::ODEJoint::getVelocity int  axisNum  )  const [virtual]
 

Returns the current rate (degrees per second for rotational axes, distance units per second for translational axes) for a given axis.

Implements opal::Joint.

Definition at line 327 of file ODEJoint.cpp.

References opal::BALL_JOINT, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, mAMotorID, opal::Joint::mData, mJointID, opal::Joint::mNumAxes, opal::radToDeg(), opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

void opal::ODEJoint::init const JointData data  )  [virtual]
 

Note: For a perfect save/restore in ODE, the "warm starting" data should be stored in JointData. However, there is currently no easy way to get this data.

Reimplemented from opal::Joint.

Definition at line 49 of file ODEJoint.cpp.

References opal::BALL_JOINT, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, opal::Joint::init(), opal::defaults::ode::jointFudgeFactor, mAMotorID, opal::Joint::mAxisRotational, opal::Joint::mInitCalled, opal::Joint::mJointBreakEventHandler, mJointID, opal::Joint::mNumAxes, mWorldID, setJointParam(), opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

dJointID opal::ODEJoint::internal_getJointID  )  const
 

Returns the ODE joint ID of this ODEJoint.

Definition at line 1004 of file ODEJoint.cpp.

References opal::BALL_JOINT, opal::JointData::getType(), mAMotorID, and opal::Joint::mData.

void opal::ODEJoint::internal_setDesiredVel int  axisNum,
real  value
[virtual]
 

Set the desired linear or angular velocity for this Joint. This is to be used internally by Motors.

Implements opal::Joint.

Definition at line 566 of file ODEJoint.cpp.

References opal::Joint::mNumAxes, and setJointParam().

void opal::ODEJoint::internal_setMaxTorque int  axisNum,
real  value
[virtual]
 

Set the max force this Joint can use to attain its desired velocity. This is to be used internally by Motors.

Implements opal::Joint.

Definition at line 587 of file ODEJoint.cpp.

References opal::Joint::mNumAxes, and setJointParam().

void opal::ODEJoint::internal_update  )  [virtual]
 

Various things could be updated here, including damage values. If the Joint breaks during this update, it will automatically be disabled, and the event handler will be notified.

Implements opal::Joint.

Definition at line 557 of file ODEJoint.cpp.

References calcStress(), opal::JointData::enabled, opal::Joint::mData, and opal::Joint::updateDamage().

void opal::ODEJoint::setAnchor const Point3r anchor  )  [protected, virtual]
 

Sets the anchor point for this Joint. Both Solids must be valid (non-NULL) before this is called for it to affect anything. This Joint's Solids must be positioned and attached before calling this function.

Reimplemented from opal::Joint.

Definition at line 704 of file ODEJoint.cpp.

References opal::defaults::joint::anchor, opal::BALL_JOINT, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, opal::Joint::mData, mJointID, opal::Joint::setAnchor(), opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

void opal::ODEJoint::setAxis int  axisNum,
const JointAxis axis
[protected, virtual]
 

Specifies the given axis for this Joint. Invalid axes numbers will be silently ignored. The axis direction vector will be normalized. This Joint's Solids must be positioned and attached before calling this function.

Reimplemented from opal::Joint.

Definition at line 608 of file ODEJoint.cpp.

References opal::defaults::sensor::incline::axis, opal::BALL_JOINT, opal::JointAxis::direction, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, mAMotorID, opal::Joint::mData, mJointID, opal::Joint::mNumAxes, opal::Vec3r::normalize(), opal::Joint::setAxis(), opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

void opal::ODEJoint::setEnabled bool  e  )  [virtual]
 

Set whether the Joint can affect its Solids. If both Solids are NULL, this will remain disabled. If the Joint has not yet been initialized, this will have no effect.

Reimplemented from opal::Joint.

Definition at line 821 of file ODEJoint.cpp.

References attachODEBodies(), filterSolidForStaticness(), opal::Joint::mData, opal::Joint::mInitCalled, opal::Joint::setEnabled(), opal::JointData::solid0, and opal::JointData::solid1.

void opal::ODEJoint::setJointParam int  parameter,
dReal  value
[protected]
 

Helper function to make it easier to set parameters for various ODE Joint types.

Definition at line 908 of file ODEJoint.cpp.

References opal::BALL_JOINT, opal::FIXED_JOINT, opal::JointData::getType(), opal::HINGE_JOINT, mAMotorID, opal::Joint::mData, mJointID, opal::SLIDER_JOINT, opal::UNIVERSAL_JOINT, and opal::WHEEL_JOINT.

Referenced by init(), internal_setDesiredVel(), internal_setMaxTorque(), setLimitBounciness(), setLimitHardness(), setLimitRange(), and setLimitsEnabled().

void opal::ODEJoint::setLimitBounciness int  axisNum,
real  b
[virtual]
 

Sets the bounciness for the given axis' limits. Bounciness (i.e. restitution) represents how much the Joint will bounce when it hits a limit. Bounciness must be between 0 and 1, inclusive.

Reimplemented from opal::Joint.

Definition at line 425 of file ODEJoint.cpp.

References opal::defaults::ode::maxERP, opal::defaults::ode::minERP, setJointParam(), and opal::Joint::setLimitBounciness().

void opal::ODEJoint::setLimitHardness int  axisNum,
real  h
[virtual]
 

Sets the hardness for the given axis' limits. Hardness represents how "squishy" the limit is. Hardness must be between 0 and 1, inclusive. Setting the hardness for axis 1 of the Wheel Joint will adjust its suspension.

Reimplemented from opal::Joint.

Definition at line 391 of file ODEJoint.cpp.

References opal::JointData::getType(), opal::defaults::ode::maxERP, opal::Joint::mData, opal::defaults::ode::minERP, setJointParam(), opal::Joint::setLimitHardness(), and opal::WHEEL_JOINT.

void opal::ODEJoint::setLimitRange int  axisNum,
real  low,
real  high
[virtual]
 

Sets the Joint's limit angles (in degrees for rotational axes, distance for translational axes). No limits are applied if this is not called. The Wheel Joint does not use limits for axis 1, so setting this will do nothing.

Reimplemented from opal::Joint.

Definition at line 853 of file ODEJoint.cpp.

References opal::JointData::axis, opal::degToRad(), opal::Joint::isRotational(), opal::JointAxis::limitsEnabled, opal::Joint::mData, setJointParam(), and opal::Joint::setLimitRange().

void opal::ODEJoint::setLimitsEnabled int  axisNum,
bool  e
[virtual]
 

Enables or disables the given Joint axis' limits.

Reimplemented from opal::Joint.

Definition at line 740 of file ODEJoint.cpp.

References opal::JointData::axis, opal::degToRad(), opal::JointLimits::high, opal::Joint::isRotational(), opal::JointAxis::limits, opal::JointLimits::low, opal::Joint::mData, setJointParam(), and opal::Joint::setLimitsEnabled().


Member Data Documentation

dJointID opal::ODEJoint::mAMotorID [protected]
 

The ODE AMotor ID, only used for ball Joints.

Definition at line 109 of file ODEJoint.h.

Referenced by attachODEBodies(), getAngle(), getAxis(), getVelocity(), init(), internal_getJointID(), ODEJoint(), setAxis(), setJointParam(), and ~ODEJoint().

dJointFeedback opal::ODEJoint::mJointFeedback [protected]
 

An ODE JointFeedback struct that must be allocated somewhere in order to get the Joint data necessary to calculate Joint stress.

Definition at line 117 of file ODEJoint.h.

dJointID opal::ODEJoint::mJointID [protected]
 

The ODE Joint ID.

Definition at line 106 of file ODEJoint.h.

Referenced by attachODEBodies(), calcStress(), getAnchor(), getAngle(), getAxis(), getDistance(), getVelocity(), init(), ODEJoint(), setAnchor(), setAxis(), setJointParam(), and ~ODEJoint().

dWorldID opal::ODEJoint::mWorldID [protected]
 

The ID of the ODE World containing this Joint.

Definition at line 112 of file ODEJoint.h.

Referenced by init(), and ODEJoint().


The documentation for this class was generated from the following files:
Generated on Tue May 16 17:49:56 2006 for OPAL by  doxygen 1.4.6-NO