#include <SoJoint.h>
Public Member Functions | |
virtual SoBaseKit * | copy (SbBool copyConnections) const |
void | destroyJoint () |
SoSFVec3f | getForce (int idx) |
dJointID | getJointID () |
SoSFVec3f | getTorque (int idx) |
virtual void | setForce (dReal force1=0.0f) |
virtual void | setParams () |
virtual void | setTorque (dReal torque1=0.0f, dReal torque2=0.0f, dReal torque3=0.0f) |
virtual SbBool | setUpConnections (SbBool onOff, SbBool doItAlways=FALSE) |
SoJoint (const SbString &BodyOne="", const SbString &BodyTwo="", const SbString &nodeName="") | |
virtual | ~SoJoint () |
Static Public Member Functions | |
static void | initClass () |
static SoCallbackAction::Response | InitOdeJointsCB (void *userdata, SoCallbackAction *action, const SoNode *node) |
Public Attributes | |
SoSFName | Bodyname1 |
SoSFName | Bodyname2 |
SoSFBool | drawVisualisationShape |
const float | INIT_CFM |
const float | INIT_ERP |
dJointFeedback * | soJointFeedback |
SoSFFloat | VisualisationScale |
Protected Member Functions | |
virtual void | createOdeJoint (const dWorldID soWorldId) |
virtual SoNode * | createVisualisation () |
SoPhysics * | getPhysicsBody (const SbName &bodyname) |
SoPhysics * | getPhysicsBody1 () |
SoPhysics * | getPhysicsBody2 () |
virtual void | updateOdeJointProperties (const SbMatrix &modelMatrix) |
Static Protected Member Functions | |
static void | GenerateCylinderAlignmentRotation (const SbVec3f &axis, SoTransform &transform) |
Protected Attributes | |
SoFieldSensor | drawVisualisationShapeSensor |
bool | isInitialised |
dJointGroupID | soJointGroupId |
dJointID | soJointId |
SoFieldSensor | updateOdeParametersSensor |
SoSFTrigger | updateOdeParametersTrigger |
Private Member Functions | |
SO_KIT_CATALOG_ENTRY_HEADER (visualisationShape) | |
SO_KIT_HEADER (SoJoint) | |
Static Private Member Functions | |
static void | IPSAJointDrawVisualisationChangedCB (void *data, SoSensor *) |
static void | IPSAUpdateOdeParametersCB (void *data, SoSensor *) |
There are different types of joints which are described more precisely in the inherited classes of SoJoint.
See How to create a new IPSA joint for detailed instructions on how to create new IPSA joints.
Definition at line 44 of file SoJoint.h.
SoJoint::SoJoint | ( | const SbString & | BodyOne = "" , |
|
const SbString & | BodyTwo = "" , |
|||
const SbString & | nodeName = "" | |||
) |
The standard constructor of SoJoint. The Constructor initialises the variable soJointGroupId which represents the ID of a JointGroup of size 0.
BodyOne | name of the first body to connect with (default = "") | |
BodyTwo | name of the second body to connect with (default = "") | |
nodeName | name of the node in the inventor graph (default = "") |
Definition at line 293 of file SoJoint.cpp.
References Bodyname1, Bodyname2, drawVisualisationShape, drawVisualisationShapeSensor, IPSAJointDrawVisualisationChangedCB(), IPSAUpdateOdeParametersCB(), soJointFeedback, soJointGroupId, updateOdeParametersSensor, and VisualisationScale.
SoJoint::~SoJoint | ( | ) | [virtual] |
The virtual standard destructor of SoJoint.
Definition at line 390 of file SoJoint.cpp.
References destroyJoint(), and soJointFeedback.
SoBaseKit * SoJoint::copy | ( | SbBool | copyConnections | ) | const [virtual] |
The overwritten copy() method
copyConnections | copy connections if true |
Definition at line 334 of file SoJoint.cpp.
References isInitialised, setUpConnections(), soJointFeedback, soJointGroupId, and soJointId.
void SoJoint::createOdeJoint | ( | const dWorldID | soWorldId | ) | [protected, virtual] |
This method sets SoJointId to NULL. Under normal circumstances it should not get called and would indicate an error.
soWorldId | the ODE world ID used for creating the joint |
Reimplemented in SoJointAMotor, SoJointBall, SoJointFixed, SoJointHinge, SoJointHinge2, SoJointSlider, and SoJointUniversal.
Definition at line 498 of file SoJoint.cpp.
References soJointId.
Referenced by InitOdeJointsCB().
SoJoint::createVisualisation | ( | ) | [inline, protected, virtual] |
This method must be overridden by any subclass of SoJoint to return a visualisation matching the joint type.
Reimplemented in SoJointAMotor, SoJointBall, SoJointHinge, SoJointHinge2, SoJointSlider, and SoJointUniversal.
Definition at line 87 of file SoJoint.h.
Referenced by IPSAJointDrawVisualisationChangedCB().
void SoJoint::destroyJoint | ( | ) |
Destroy underlying ODE-Joint directly. A joint destroyed using this function call may currently not be recreated except by renewing the SoJoint-Node object (TBD).
Definition at line 405 of file SoJoint.cpp.
References soJointGroupId.
Referenced by RemoveJoint::vExecute(), and ~SoJoint().
void SoJoint::GenerateCylinderAlignmentRotation | ( | const SbVec3f & | axis, | |
SoTransform & | transform | |||
) | [static, protected] |
The SoCylinder is aligned along the Y axis as default. If the rotation axis is to be displayed this method can be used to calculate the rotation needed to align an SoCylinder along the rotation axis given the axis.
axis | rotation axis along which the SoCylinder should be aligned | |
transform | the computed transformation is stored in this parameter |
Definition at line 690 of file SoJoint.cpp.
Referenced by SoJointUniversal::createVisualisation(), SoJointSlider::createVisualisation(), SoJointHinge2::createVisualisation(), and SoJointHinge::createVisualisation().
SoSFVec3f SoJoint::getForce | ( | int | idx | ) |
Reads the forces acting upon the joint. The value of idx must be 1 for the first body or 2 for the second body. In any other case the first body is used.
idx | specifies if the first (1) or the second (2) body is used for reading the force |
Definition at line 620 of file SoJoint.cpp.
References soJointFeedback, and soJointId.
Referenced by GetJointForce::vExecute().
dJointID SoJoint::getJointID | ( | ) |
Reads the value of the protected variable soJointId and returns it.
Definition at line 418 of file SoJoint.cpp.
References soJointId.
SoPhysics * SoJoint::getPhysicsBody | ( | const SbName & | bodyName | ) | [protected] |
Searches for a physicsbody by name.
bodyName | name of the body to retrieve |
Definition at line 520 of file SoJoint.cpp.
Referenced by getPhysicsBody1(), and getPhysicsBody2().
SoPhysics * SoJoint::getPhysicsBody1 | ( | ) | [protected] |
Returns the first body the joint is connected to by calling SoJoint::getPhysicsBody() with parameters set to those of body 1.
Definition at line 538 of file SoJoint.cpp.
References Bodyname1, and getPhysicsBody().
Referenced by InitOdeJointsCB().
SoPhysics * SoJoint::getPhysicsBody2 | ( | ) | [protected] |
Returns the second body the joint is connected to by calling SoJoint::getPhysicsBody() with parameters set to those of body 2.
Definition at line 549 of file SoJoint.cpp.
References Bodyname2, and getPhysicsBody().
Referenced by InitOdeJointsCB().
SoSFVec3f SoJoint::getTorque | ( | int | idx | ) |
Reads the torques acting upon the joint. The value of idx must be 1 for the first body or 2 for the second body. In any other case the first body is used.
idx | specifies if the first (1) or the second (2) body is used for reading the torque |
Definition at line 589 of file SoJoint.cpp.
References soJointFeedback, and soJointId.
Referenced by GetJointTorque::vExecute().
void SoJoint::initClass | ( | ) | [static] |
Initialises the class and it's type id variables.
Reimplemented in SoJointAMotor, SoJointBall, SoJointFixed, SoJointHinge, SoJointHinge2, SoJointSlider, and SoJointUniversal.
Definition at line 279 of file SoJoint.cpp.
SoCallbackAction::Response SoJoint::InitOdeJointsCB | ( | void * | userdata, | |
SoCallbackAction * | action, | |||
const SoNode * | node | |||
) | [static] |
This method creates the internal ODE joint for the passed in node
by calling SoJoint::createOdeJoint() if it is not present and sets isInitialised to TRUE. Afterwards SoJoint::updateOdeJointProperties() and SoJoint::setParams() are called to synchronise the joint properties with its ODE representation. Additionally it calls SoJoint::setUpConnections() on the instance which can not be done in the constructor since the method SoJoint::setUpConnections() is virtual and can not be called safely inside the constructor.
userdata | UNUSED | |
action | used to retrieve the current model matrix | |
node | points to current SoJoint node being hit by the search action |
Definition at line 439 of file SoJoint.cpp.
References createOdeJoint(), SoPhysics::getBody(), getPhysicsBody1(), getPhysicsBody2(), SoPhysics::getWorld(), isInitialised, setParams(), setUpConnections(), soJointFeedback, soJointId, and updateOdeJointProperties().
Referenced by SoWorldPhysics::initialiseWorld(), and SoWorldPhysics::resetWorld().
void SoJoint::IPSAJointDrawVisualisationChangedCB | ( | void * | data, | |
SoSensor * | ||||
) | [static, private] |
Static callback method which is executed everytime the member drawVisualisationShape is changed. It removes the joint visualisation if drawVisualisationShape is set to FALSE and adds the joint specific visualisation shape otherwise by calling the createVisualisation() method on the current joint.
data | pointer to an object of type SoJoint* (the this pointer of the joint to change) |
Definition at line 650 of file SoJoint.cpp.
References createVisualisation(), and drawVisualisationShape.
Referenced by setUpConnections(), and SoJoint().
void SoJoint::IPSAUpdateOdeParametersCB | ( | void * | data, | |
SoSensor * | ||||
) | [static, private] |
Static callback method which calls SoJoint::setParams on the passed in data
pointer if the object is of type SoJoint*. Does nothing if the object is not of type SoJoint*.
Definition at line 673 of file SoJoint.cpp.
References setParams().
Referenced by SoJoint().
void SoJoint::setForce | ( | dReal | force1 = 0.0f |
) | [virtual] |
This method should be overridden by any subclass of SoJoint. It does nothing.
force1 | applied to axis1 |
Reimplemented in SoJointSlider.
Definition at line 575 of file SoJoint.cpp.
Referenced by SetJointForce::vExecute().
SoJoint::setParams | ( | ) | [inline, virtual] |
This method must be overridden by any subclass of SoJoint to set the ODE parameters of the object.
Reimplemented in SoJointAMotor, SoJointBall, SoJointHinge, SoJointHinge2, SoJointSlider, and SoJointUniversal.
Definition at line 60 of file SoJoint.h.
Referenced by InitOdeJointsCB(), and IPSAUpdateOdeParametersCB().
void SoJoint::setTorque | ( | dReal | torque1 = 0.0f , |
|
dReal | torque2 = 0.0f , |
|||
dReal | torque3 = 0.0f | |||
) | [virtual] |
This method should be overridden by any subclass of SoJoint. It does nothing.
torque1 | applied to axis1 | |
torque2 | applied to axis2 (if available) | |
torque3 | applied to axis3 (if available) |
Reimplemented in SoJointAMotor, SoJointHinge, SoJointHinge2, and SoJointUniversal.
Definition at line 563 of file SoJoint.cpp.
Referenced by SetJointTorque2::vExecute(), and SetJointTorque::vExecute().
SbBool SoJoint::setUpConnections | ( | SbBool | onOff, | |
SbBool | doItAlways = FALSE | |||
) | [virtual] |
This method attachs different sensors to the corresponding fields. To monitor field-changes visualisationShapeSensor is connected to the field SoJoint::drawVisualisationShape. To update parameters in ODE automatically the SoJoint::updateOdeParametersSensor is connected to SoJoint::updateOdeParametersTrigger which should be changed by subclasses if an ODE related field is changed.
onOff | attach sensors if TRUE, detach sensors if FALSE | |
doItAlways | always perform attach/detach of sensors if this parameter is TRUE |
Definition at line 359 of file SoJoint.cpp.
References drawVisualisationShape, drawVisualisationShapeSensor, IPSAJointDrawVisualisationChangedCB(), updateOdeParametersSensor, and updateOdeParametersTrigger.
Referenced by copy(), and InitOdeJointsCB().
SoJoint::SO_KIT_CATALOG_ENTRY_HEADER | ( | visualisationShape | ) | [private] |
SoJoint::SO_KIT_HEADER | ( | SoJoint | ) | [private] |
void SoJoint::updateOdeJointProperties | ( | const SbMatrix & | modelMatrix | ) | [protected, virtual] |
This method does nothing and should be overridden in the subclasses.
modelMatrix | UNUSED |
Reimplemented in SoJointAMotor, SoJointBall, SoJointFixed, SoJointHinge, SoJointHinge2, SoJointSlider, and SoJointUniversal.
Definition at line 509 of file SoJoint.cpp.
Referenced by InitOdeJointsCB().
The name of the first body the joint is connected to (default = "").
Definition at line 71 of file SoJoint.h.
Referenced by getPhysicsBody1(), SoJoint(), and SoPrefixNode::UpdateJointsCB().
The name of the second body the joint is connected to (default = "").
Definition at line 72 of file SoJoint.h.
Referenced by getPhysicsBody2(), SoJoint(), and SoPrefixNode::UpdateJointsCB().
This field enables or disables the drawing of the visualisation of the joint (default = FALSE).
Definition at line 74 of file SoJoint.h.
Referenced by IPSAJointDrawVisualisationChangedCB(), setUpConnections(), SoJoint(), and ShowJoints::vExecute().
SoJoint::drawVisualisationShapeSensor [protected] |
This sensor is connected to SoJoint::drawVisualisationShape and calls SoJoint::IPSAJointDrawVisualisationChangedCB if the field changes.
Definition at line 92 of file SoJoint.h.
Referenced by setUpConnections(), and SoJoint().
Default value for the CFM parameter of all ODE joints (default = 1E-8f).
Definition at line 76 of file SoJoint.h.
Referenced by SoJointAMotor::SoJointAMotor(), SoJointBall::SoJointBall(), SoJointHinge::SoJointHinge(), SoJointHinge2::SoJointHinge2(), SoJointSlider::SoJointSlider(), and SoJointUniversal::SoJointUniversal().
Default value for the ERP parameter of all ODE joints (default = 0.2f).
Definition at line 77 of file SoJoint.h.
Referenced by SoJointAMotor::SoJointAMotor(), SoJointBall::SoJointBall(), SoJointHinge::SoJointHinge(), SoJointHinge2::SoJointHinge2(), SoJointSlider::SoJointSlider(), and SoJointUniversal::SoJointUniversal().
SoJoint::isInitialised [protected] |
This member tracks the initalisation status of the joint and prevents multiple creations of the same joint through SoJoint::createODEJoint().
Definition at line 95 of file SoJoint.h.
Referenced by copy(), and InitOdeJointsCB().
ODE structure which is used to retrieve the forces and torques acting upon the joint.
Definition at line 79 of file SoJoint.h.
Referenced by copy(), getForce(), getTorque(), InitOdeJointsCB(), SoJoint(), and ~SoJoint().
SoJoint::soJointGroupId [protected] |
This ODE structure represents a group of joints and is used by subclasses of SoJoint to create new ODE joints.
Definition at line 93 of file SoJoint.h.
Referenced by copy(), SoJointUniversal::createOdeJoint(), SoJointSlider::createOdeJoint(), SoJointHinge2::createOdeJoint(), SoJointHinge::createOdeJoint(), SoJointFixed::createOdeJoint(), SoJointBall::createOdeJoint(), SoJointAMotor::createOdeJoint(), destroyJoint(), and SoJoint().
SoJoint::soJointId [protected] |
This ODE structure represents the ODE internal ID of the current joint. It is set by subclasses of SoJoint after creating the specialised joint with the dJointCreate*() methods.
Definition at line 94 of file SoJoint.h.
Referenced by copy(), SoJointUniversal::createOdeJoint(), SoJointSlider::createOdeJoint(), SoJointHinge2::createOdeJoint(), SoJointHinge::createOdeJoint(), SoJointFixed::createOdeJoint(), SoJointBall::createOdeJoint(), SoJointAMotor::createOdeJoint(), createOdeJoint(), SoJointHinge2::getAngle(), SoJointHinge::getAngle(), SoJointHinge2::getAngleRate(), SoJointHinge::getAngleRate(), getForce(), getJointID(), SoJointSlider::getPosition(), SoJointSlider::getPositionRate(), getTorque(), InitOdeJointsCB(), SoJointSlider::setForce(), SoJointUniversal::setParams(), SoJointSlider::setParams(), SoJointHinge2::setParams(), SoJointHinge::setParams(), SoJointBall::setParams(), SoJointAMotor::setParams(), SoJointUniversal::setTorque(), SoJointHinge2::setTorque(), SoJointHinge::setTorque(), SoJointAMotor::setTorque(), SoJointUniversal::updateOdeJointProperties(), SoJointSlider::updateOdeJointProperties(), SoJointHinge2::updateOdeJointProperties(), SoJointHinge::updateOdeJointProperties(), SoJointFixed::updateOdeJointProperties(), SoJointBall::updateOdeJointProperties(), and SoJointAMotor::updateOdeJointProperties().
SoJoint::updateOdeParametersSensor [protected] |
This sensor is connected to the ODE paramters of SoJoint and calls SoJoint::IPSAChangeParameterCB if the SoJoint::updateOdeParametersTrigger field changes.
Definition at line 91 of file SoJoint.h.
Referenced by setUpConnections(), and SoJoint().
SoJoint::updateOdeParametersTrigger [protected] |
This field is connected to SoJoint::updateOdeParametersSensor so that the ODE parameters get updated automatically. Therefore any ODE related field must change this field in order to trigger the automatic update (use updateOdeParametersTrigger.appendConnection(masterField) ).
Definition at line 90 of file SoJoint.h.
Referenced by setUpConnections(), SoJointAMotor::SoJointAMotor(), SoJointBall::SoJointBall(), SoJointHinge::SoJointHinge(), SoJointHinge2::SoJointHinge2(), SoJointSlider::SoJointSlider(), and SoJointUniversal::SoJointUniversal().
The scaling of the joint visualisation (default = 1.0f).
Definition at line 73 of file SoJoint.h.
Referenced by SoJointHinge::createVisualisation(), SoJointBall::createVisualisation(), and SoJoint().
Generated on Sat Mar 10 20:00:20 2012 for IPSA by 1.5.8 |