opal::Joint Class Reference

#include <Joint.h>

Inheritance diagram for opal::Joint:

opal::ODEJoint List of all members.

Public Member Functions

 Joint ()
virtual void OPAL_CALL init (const JointData &data)
virtual const JointData &OPAL_CALL getData ()
virtual void OPAL_CALL setName (const std::string &name)
virtual const std::string
&OPAL_CALL 
getName () const
virtual void OPAL_CALL setContactsEnabled (bool e)
virtual bool OPAL_CALL areContactsEnabled () const
virtual JointType OPAL_CALL getType () const
virtual void OPAL_CALL setBreakParams (JointBreakMode mode, real breakThresh, real accumThresh=0)
virtual JointBreakMode OPAL_CALL getBreakingMode () const
virtual real OPAL_CALL getBreakThresh () const
virtual real OPAL_CALL getAccumulatedDamage () const
virtual real OPAL_CALL getAccumulatedThresh () const
virtual bool OPAL_CALL isBroken () const
virtual void OPAL_CALL repairAccumDamage ()
virtual void OPAL_CALL setJointBreakEventHandler (JointBreakEventHandler *eventHandler)
virtual JointBreakEventHandler
*OPAL_CALL 
getJointBreakEventHandler () const
virtual void OPAL_CALL setLimitsEnabled (int axisNum, bool e)
virtual bool OPAL_CALL areLimitsEnabled (int axisNum)
virtual void OPAL_CALL setLimitRange (int axisNum, real low, real high)
virtual real OPAL_CALL getLowLimit (int axisNum) const
virtual real OPAL_CALL getHighLimit (int axisNum) const
virtual void OPAL_CALL setLimitHardness (int axisNum, real h)
virtual real OPAL_CALL getLimitHardness (int axisNum) const
virtual void OPAL_CALL setLimitBounciness (int axisNum, real b)
virtual real OPAL_CALL getLimitBounciness (int axisNum) const
virtual real OPAL_CALL getAngle (int axisNum) const =0
virtual real OPAL_CALL getDistance (int axisNum) const =0
virtual real OPAL_CALL getVelocity (int axisNum) const =0
virtual void OPAL_CALL addForce (int axisNum, real magnitude, real duration, bool singleStep=false)
virtual void OPAL_CALL addTorque (int axisNum, real magnitude, real duration, bool singleStep=false)
virtual void OPAL_CALL wakeSolids ()
virtual Solid *OPAL_CALL getSolid0 () const
virtual Solid *OPAL_CALL getSolid1 () const
virtual JointAxis OPAL_CALL getAxis (int axisNum) const =0
virtual Point3r OPAL_CALL getAnchor () const =0
virtual int OPAL_CALL getNumAxes () const
virtual bool OPAL_CALL isEnabled () const
virtual void OPAL_CALL setEnabled (bool e)
virtual bool OPAL_CALL isRotational (int axisNum) const
virtual void OPAL_CALL setUserData (void *data)
virtual void *OPAL_CALL getUserData ()
virtual void OPAL_CALL internal_update ()=0
virtual void OPAL_CALL internal_setDesiredVel (int axisNum, real value)=0
virtual void OPAL_CALL internal_setMaxTorque (int axisNum, real value)=0
virtual bool OPAL_CALL internal_dependsOnSolid (Solid *s)
virtual void OPAL_CALL internal_destroy ()

Protected Member Functions

virtual ~Joint ()
void setSolids (Solid *s0, Solid *s1)
virtual void setAnchor (const Point3r &anchor)
virtual void setAxis (int axisNum, const JointAxis &axis)
void updateDamage (real currentStress)

Protected Attributes

JointData mData
JointBreakEventHandlermJointBreakEventHandler
void * mUserData
bool mInitCalled
int mNumAxes
bool mAxisRotational [3]

Detailed Description

A constraint between two Solids or between a Solid and the static environment. There is a variety of Joint types, each constraining Solid motion in different ways. There are 6 degrees of freedom for a Solid that can be constrained: 3 rotational and 3 linear. Each Joint type constrains a different subset of these 6. When specifying the two Solids affected by the Joint, if at least one Solid is non-NULL, the Joint will be enabled. If both Solids are NULL, the Joint will be disabled. If only one Solid is NULL, the Joint will attach the other Solid to the static environment. If both Solids are the same, the Joint's Solids will both be set to NULL and the Joint will be disabled. If either Solid is static, both will be set to NULL, and the Joint will be disabled. Note that some Joint types do not use all of the anchor and axis parameters. An unused anchor or axis will be ignored (see the JointType description for more details). Joints remain ineffective until they are initialized.

Definition at line 54 of file Joint.h.


Constructor & Destructor Documentation

opal::Joint::Joint  ) 
 

Definition at line 33 of file Joint.cpp.

References mAxisRotational, mInitCalled, mNumAxes, setJointBreakEventHandler(), and setUserData().

opal::Joint::~Joint  )  [protected, virtual]
 

Definition at line 45 of file Joint.cpp.


Member Function Documentation

void opal::Joint::addForce int  axisNum,
real  magnitude,
real  duration,
bool  singleStep = false
[virtual]
 

Applies a force to this Joint's Solid(s). To be used for translational axes. This does nothing if the Joint is disabled.

Definition at line 223 of file Joint.cpp.

References opal::Solid::addForce(), opal::JointData::axis, opal::JointAxis::direction, opal::Force::duration, opal::JointData::enabled, opal::LOCAL_FORCE, mData, mNumAxes, opal::Force::singleStep, opal::JointData::solid0, opal::JointData::solid1, opal::Force::type, and opal::Force::vec.

void opal::Joint::addTorque int  axisNum,
real  magnitude,
real  duration,
bool  singleStep = false
[virtual]
 

Applies a torque to this Joint's Solid(s). To be used for rotational Joints. This does nothing if the Joint is disabled.

Definition at line 258 of file Joint.cpp.

References opal::Solid::addForce(), opal::JointData::axis, opal::defaults::sensor::incline::axis, opal::JointAxis::direction, opal::Force::duration, opal::JointData::enabled, opal::LOCAL_TORQUE, mData, mNumAxes, opal::Force::singleStep, opal::JointData::solid0, opal::JointData::solid1, opal::Force::type, and opal::Force::vec.

Referenced by opal::GearedMotor::internal_update().

bool opal::Joint::areContactsEnabled  )  const [virtual]
 

Returns whether the Joint's two Solids are constrained by physical contacts.

Definition at line 86 of file Joint.cpp.

References opal::JointData::contactsEnabled, and mData.

Referenced by opal::ode_hidden::internal_collisionCallback().

bool opal::Joint::areLimitsEnabled int  axisNum  )  [virtual]
 

Returns true if the given Joint axis' limits are enabled.

Definition at line 157 of file Joint.cpp.

References opal::JointData::axis, opal::JointAxis::limitsEnabled, mData, and mNumAxes.

real opal::Joint::getAccumulatedDamage  )  const [virtual]
 

How much damage has a Joint taken so far?

Definition at line 119 of file Joint.cpp.

References opal::JointData::accumDamage, and mData.

real opal::Joint::getAccumulatedThresh  )  const [virtual]
 

What is minimum amount of damage that will be recorded?

Note:
if the damaga is lower than this value, that damage will be ignored

Definition at line 124 of file Joint.cpp.

References opal::JointData::accumThresh, and mData.

virtual Point3r OPAL_CALL opal::Joint::getAnchor  )  const [pure virtual]
 

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

Implemented in opal::ODEJoint.

virtual real OPAL_CALL opal::Joint::getAngle int  axisNum  )  const [pure virtual]
 

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

Implemented in opal::ODEJoint.

Referenced by opal::ServoMotor::internal_update().

virtual JointAxis OPAL_CALL opal::Joint::getAxis int  axisNum  )  const [pure virtual]
 

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

Implemented in opal::ODEJoint.

Referenced by getData().

JointBreakMode opal::Joint::getBreakingMode  )  const [virtual]
 

What is the mode of breaking?

Definition at line 109 of file Joint.cpp.

References opal::JointData::breakMode, and mData.

real opal::Joint::getBreakThresh  )  const [virtual]
 

How much damage can a Joint take?

Definition at line 114 of file Joint.cpp.

References opal::JointData::breakThresh, and mData.

const JointData & opal::Joint::getData  )  [virtual]
 

Returns all data describing the Joint.

Definition at line 58 of file Joint.cpp.

References opal::JointData::axis, getAxis(), mData, and mNumAxes.

virtual real OPAL_CALL opal::Joint::getDistance int  axisNum  )  const [pure virtual]
 

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

Implemented in opal::ODEJoint.

real opal::Joint::getHighLimit int  axisNum  )  const [virtual]
 

Returns the high limit for a given axis (angle in degrees for rotational axes, distance for translational axes).

Definition at line 191 of file Joint.cpp.

References opal::JointData::axis, opal::JointLimits::high, opal::JointAxis::limits, mData, and mNumAxes.

Referenced by opal::ServoMotor::setDesiredAngle(), and opal::ServoMotor::setDesiredAngleNorm().

JointBreakEventHandler * opal::Joint::getJointBreakEventHandler  )  const [virtual]
 

Returns the Joint's break event handler. If this returns NULL, the Joint is not using one.

Definition at line 146 of file Joint.cpp.

References mJointBreakEventHandler.

real opal::Joint::getLimitBounciness int  axisNum  )  const [virtual]
 

Returns the bounciness for the given axis' limits.

Definition at line 217 of file Joint.cpp.

References opal::JointData::axis, opal::JointLimits::bounciness, opal::JointAxis::limits, mData, and mNumAxes.

real opal::Joint::getLimitHardness int  axisNum  )  const [virtual]
 

Returns the hardness for the given axis' limits.

Definition at line 204 of file Joint.cpp.

References opal::JointData::axis, opal::JointLimits::hardness, opal::JointAxis::limits, mData, and mNumAxes.

real opal::Joint::getLowLimit int  axisNum  )  const [virtual]
 

Returns the low limit for a given axis (angle in degrees for rotational axes, distance for translational axes).

Definition at line 185 of file Joint.cpp.

References opal::JointData::axis, opal::JointAxis::limits, opal::JointLimits::low, mData, and mNumAxes.

Referenced by opal::ServoMotor::setDesiredAngle(), and opal::ServoMotor::setDesiredAngleNorm().

const std::string & opal::Joint::getName  )  const [virtual]
 

Returns the Joint's name.

Definition at line 76 of file Joint.cpp.

References mData, and opal::JointData::name.

Referenced by opal::BlueprintInstance::internal_addJoint().

int opal::Joint::getNumAxes  )  const [virtual]
 

Returns the number of axes used by this Joint.

Definition at line 323 of file Joint.cpp.

References mNumAxes.

Referenced by opal::ServoMotor::init().

Solid * opal::Joint::getSolid0  )  const [virtual]
 

Returns a pointer to Solid0.

Definition at line 307 of file Joint.cpp.

References mData, and opal::JointData::solid0.

Solid * opal::Joint::getSolid1  )  const [virtual]
 

Returns a pointer to Solid1.

Definition at line 312 of file Joint.cpp.

References mData, and opal::JointData::solid1.

JointType opal::Joint::getType  )  const [virtual]
 

Returns the Joint type.

Definition at line 91 of file Joint.cpp.

References opal::JointData::getType(), and mData.

Referenced by opal::ode_hidden::internal_collisionCallback().

void * opal::Joint::getUserData  )  [virtual]
 

Returns the user data pointer (NULL if it has not been set).

Definition at line 359 of file Joint.cpp.

References mUserData.

virtual real OPAL_CALL opal::Joint::getVelocity int  axisNum  )  const [pure virtual]
 

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

Implemented in opal::ODEJoint.

Referenced by opal::GearedMotor::internal_update().

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

Initializes the Joint with the given data structure. Calling this more than once will automatically detach the Joint from its old Solids first.

Reimplemented in opal::ODEJoint.

Definition at line 53 of file Joint.cpp.

References mData.

Referenced by opal::ODEJoint::init().

bool opal::Joint::internal_dependsOnSolid Solid s  )  [virtual]
 

Returns true if this Joint depends on the given Solid.

Definition at line 364 of file Joint.cpp.

References mData, opal::JointData::solid0, and opal::JointData::solid1.

void opal::Joint::internal_destroy  )  [virtual]
 

Internal function used to destroy this object.

Definition at line 48 of file Joint.cpp.

virtual void OPAL_CALL opal::Joint::internal_setDesiredVel int  axisNum,
real  value
[pure virtual]
 

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

Implemented in opal::ODEJoint.

Referenced by opal::ServoMotor::internal_update(), opal::ServoMotor::setDesiredVel(), opal::ServoMotor::setEnabled(), and opal::ServoMotor::~ServoMotor().

virtual void OPAL_CALL opal::Joint::internal_setMaxTorque int  axisNum,
real  value
[pure virtual]
 

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

Implemented in opal::ODEJoint.

Referenced by opal::ServoMotor::setEnabled(), opal::ServoMotor::setMaxTorque(), and opal::ServoMotor::~ServoMotor().

virtual void OPAL_CALL opal::Joint::internal_update  )  [pure 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.

Implemented in opal::ODEJoint.

bool opal::Joint::isBroken  )  const [virtual]
 

Returns true if the Joint has been broken.

Definition at line 104 of file Joint.cpp.

References opal::JointData::isBroken, and mData.

bool opal::Joint::isEnabled  )  const [virtual]
 

Returns true if the Joint is enabled.

Definition at line 333 of file Joint.cpp.

References opal::JointData::enabled, and mData.

bool opal::Joint::isRotational int  axisNum  )  const [virtual]
 

Returns true if the given Joint axis is rotational, false if it is linear.

Definition at line 348 of file Joint.cpp.

References mAxisRotational, and mNumAxes.

Referenced by opal::ServoMotor::init(), opal::GearedMotor::init(), opal::ODEJoint::setLimitRange(), and opal::ODEJoint::setLimitsEnabled().

void opal::Joint::repairAccumDamage  )  [virtual]
 

Repairs accumulated damage to breakable Joints in accumulated damage mode. This does not reenable the Joint.

Definition at line 129 of file Joint.cpp.

References opal::JointData::accumDamage, and mData.

void opal::Joint::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 in opal::ODEJoint.

Definition at line 328 of file Joint.cpp.

References opal::defaults::joint::anchor, opal::JointData::anchor, and mData.

Referenced by opal::ODEJoint::setAnchor().

void opal::Joint::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 in opal::ODEJoint.

Definition at line 317 of file Joint.cpp.

References opal::defaults::sensor::incline::axis, opal::JointData::axis, mData, and mNumAxes.

Referenced by opal::ODEJoint::setAxis().

void opal::Joint::setBreakParams JointBreakMode  mode,
real  breakThresh,
real  accumThresh = 0
[virtual]
 

Sets the parameters that determine how this Joint will break, if at all.

Definition at line 96 of file Joint.cpp.

References opal::JointData::accumThresh, opal::JointData::breakMode, opal::JointData::breakThresh, and mData.

void opal::Joint::setContactsEnabled bool  e  )  [virtual]
 

Sets whether the Joint's two Solids are constrained by physical contacts.

Definition at line 81 of file Joint.cpp.

References opal::JointData::contactsEnabled, and mData.

void opal::Joint::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 in opal::ODEJoint.

Definition at line 338 of file Joint.cpp.

References opal::JointData::enabled, mData, and mInitCalled.

Referenced by opal::ODEJoint::setEnabled(), and updateDamage().

void opal::Joint::setJointBreakEventHandler JointBreakEventHandler eventHandler  )  [virtual]
 

Sets the Joint's break event handler.

Definition at line 140 of file Joint.cpp.

References mJointBreakEventHandler.

Referenced by Joint().

void opal::Joint::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 in opal::ODEJoint.

Definition at line 210 of file Joint.cpp.

References opal::JointData::axis, opal::JointLimits::bounciness, opal::JointAxis::limits, mData, and mNumAxes.

Referenced by opal::ODEJoint::setLimitBounciness().

void opal::Joint::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 in opal::ODEJoint.

Definition at line 197 of file Joint.cpp.

References opal::JointData::axis, opal::JointLimits::hardness, opal::JointAxis::limits, mData, and mNumAxes.

Referenced by opal::ODEJoint::setLimitHardness().

void opal::Joint::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 in opal::ODEJoint.

Definition at line 177 of file Joint.cpp.

References opal::JointData::axis, opal::JointLimits::high, opal::JointAxis::limits, opal::JointLimits::low, mData, and mNumAxes.

Referenced by opal::ODEJoint::setLimitRange().

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

Enables or disables the given Joint axis' limits.

Reimplemented in opal::ODEJoint.

Definition at line 151 of file Joint.cpp.

References opal::JointData::axis, opal::JointAxis::limitsEnabled, mData, and mNumAxes.

Referenced by opal::ODEJoint::setLimitsEnabled().

void opal::Joint::setName const std::string &  name  )  [virtual]
 

Sets the Joint's name.

Definition at line 71 of file Joint.cpp.

References mData, and opal::JointData::name.

void opal::Joint::setSolids Solid s0,
Solid s1
[protected]
 

Sets the Solids constrained by this Joint.

Definition at line 301 of file Joint.cpp.

References mData, opal::JointData::solid0, and opal::JointData::solid1.

Referenced by opal::ODEJoint::filterSolidForStaticness().

void opal::Joint::setUserData void *  data  )  [virtual]
 

Set the user data pointer to some external data. The user data is totally user-managed (i.e. it is not destroyed when the Joint is destroyed).

Definition at line 354 of file Joint.cpp.

References mUserData.

Referenced by Joint().

void opal::Joint::updateDamage real  currentStress  )  [protected]
 

Updates this Joint's current damage status based on the current amount of stress.

Definition at line 376 of file Joint.cpp.

References opal::JointData::accumDamage, opal::JointData::accumThresh, opal::ACCUMULATED_MODE, opal::JointData::breakMode, opal::JointData::breakThresh, opal::JointBreakEventHandler::handleJointBreakEvent(), opal::JointData::isBroken, mData, mJointBreakEventHandler, setEnabled(), opal::THRESHOLD_MODE, and opal::UNBREAKABLE_MODE.

Referenced by opal::ODEJoint::internal_update().

void opal::Joint::wakeSolids  )  [virtual]
 

Wakes up this Joint's two Solids.

Definition at line 293 of file Joint.cpp.

References mData, opal::Solid::setSleeping(), opal::JointData::solid0, and opal::JointData::solid1.

Referenced by opal::ServoMotor::internal_update().


Member Data Documentation

bool opal::Joint::mAxisRotational[3] [protected]
 

Definition at line 287 of file Joint.h.

Referenced by opal::ODEJoint::init(), isRotational(), and Joint().

JointData opal::Joint::mData [protected]
 

Stores data describing the Joint.

Definition at line 270 of file Joint.h.

Referenced by addForce(), addTorque(), areContactsEnabled(), areLimitsEnabled(), opal::ODEJoint::attachODEBodies(), opal::ODEJoint::calcStress(), opal::ODEJoint::filterSolidForStaticness(), getAccumulatedDamage(), getAccumulatedThresh(), opal::ODEJoint::getAnchor(), opal::ODEJoint::getAngle(), opal::ODEJoint::getAxis(), getBreakingMode(), getBreakThresh(), getData(), opal::ODEJoint::getDistance(), getHighLimit(), getLimitBounciness(), getLimitHardness(), getLowLimit(), getName(), getSolid0(), getSolid1(), getType(), opal::ODEJoint::getVelocity(), init(), internal_dependsOnSolid(), opal::ODEJoint::internal_getJointID(), opal::ODEJoint::internal_update(), isBroken(), isEnabled(), repairAccumDamage(), opal::ODEJoint::setAnchor(), setAnchor(), opal::ODEJoint::setAxis(), setAxis(), setBreakParams(), setContactsEnabled(), opal::ODEJoint::setEnabled(), setEnabled(), opal::ODEJoint::setJointParam(), setLimitBounciness(), opal::ODEJoint::setLimitHardness(), setLimitHardness(), opal::ODEJoint::setLimitRange(), setLimitRange(), opal::ODEJoint::setLimitsEnabled(), setLimitsEnabled(), setName(), setSolids(), updateDamage(), and wakeSolids().

bool opal::Joint::mInitCalled [protected]
 

This is set to true when the Joint is initialized.

Definition at line 280 of file Joint.h.

Referenced by opal::ODEJoint::init(), Joint(), opal::ODEJoint::setEnabled(), and setEnabled().

JointBreakEventHandler* opal::Joint::mJointBreakEventHandler [protected]
 

A pointer to the Joint's break event handler.

Definition at line 273 of file Joint.h.

Referenced by getJointBreakEventHandler(), opal::ODEJoint::init(), setJointBreakEventHandler(), and updateDamage().

int opal::Joint::mNumAxes [protected]
 

The number of axes used by the Joint.

Definition at line 283 of file Joint.h.

Referenced by addForce(), addTorque(), areLimitsEnabled(), opal::ODEJoint::getAngle(), opal::ODEJoint::getAxis(), getData(), opal::ODEJoint::getDistance(), getHighLimit(), getLimitBounciness(), getLimitHardness(), getLowLimit(), getNumAxes(), opal::ODEJoint::getVelocity(), opal::ODEJoint::init(), opal::ODEJoint::internal_setDesiredVel(), opal::ODEJoint::internal_setMaxTorque(), isRotational(), Joint(), opal::ODEJoint::setAxis(), setAxis(), setLimitBounciness(), setLimitHardness(), setLimitRange(), and setLimitsEnabled().

void* opal::Joint::mUserData [protected]
 

Pointer to user data. This is totally user-managed (i.e. OPAL will never delete it).

Definition at line 277 of file Joint.h.

Referenced by getUserData(), and setUserData().


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