Class BaseMotorJoint
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.rigidphysics.BaseJointNode
org.web3d.vrml.renderer.common.nodes.rigidphysics.BaseMotorJoint
- All Implemented Interfaces:
VRMLNode,FrameStateListener,VRMLNodeType,VRMLRigidJointNodeType
- Direct Known Subclasses:
NRMotorJoint,OGLMotorJoint
Implementation of the MotorJoint node.
- Version:
- $Revision: 1.10 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringMessage when the axis1Angle value is out of rangeprotected static final StringMessage when the axis1Torque value is out of rangeprotected static final StringMessage when the axis2Angle value is out of rangeprotected static final StringMessage when the axis2Torque value is out of rangeprotected static final StringMessage when the axis3Angle value is out of rangeprotected static final StringMessage when the axis3Torque value is out of rangeprotected static final StringMessage when the stopBounce value is out of rangeprotected static final StringMessage when the stop2Bounce value is out of rangeprotected static final StringMessage when the stop3Bounce value is out of rangeprotected static final intThe field index for autoCalcprotected static final intThe field index for axis1Angleprotected static final intThe field index for axis1Torqueprotected static final intThe field index for axis2Angleprotected static final intThe field index for axis2Torqueprotected static final intThe field index for axis3Angleprotected static final intThe field index for axis3Torqueprotected static final intThe field index for enabledAxesprotected static final intThe field index for motor1Angleprotected static final intThe field index for motor1AngleRateprotected static final intThe field index for motor1Axisprotected static final intThe field index for motor2Angleprotected static final intThe field index for motor2AngleRateprotected static final intThe field index for motor2Axisprotected static final intThe field index for motor3Angleprotected static final intThe field index for motor3AngleRateprotected static final intThe field index for motor3Axisprotected static final intThe field index for stop1Bounceprotected static final intThe field index for stop1ErrorCorrectionprotected static final intThe field index for stop2Bounceprotected static final intThe field index for stop2ErrorCorrectionprotected static final intThe field index for stop3Bounceprotected static final intThe field index for stop3ErrorCorrectionprotected static final intLast index used by this base nodeprotected org.odejava.JointAMotorThe ODE representation of the jointprotected static final StringMessage when the stop1ErrorCorrection value is out of rangeprotected static final StringMessage when the stop2ErrorCorrection value is out of rangeprotected static final StringMessage when the stop3ErrorCorrection value is out of rangeprotected booleanThe value of the autoCalc fieldprotected floatThe value of the axis1Angle fieldprotected floatThe value of the axis1Torque fieldprotected floatThe value of the axis2Angle fieldprotected floatThe value of the axis2Torque fieldprotected floatThe value of the axis3Angle fieldprotected floatThe value of the axis3Torque fieldprotected intThe value of the enabledAxes fieldprotected floatThe value of the motor1Angle fieldprotected floatThe value of the motor1AngleRate fieldprotected float[]The value of the motor1Axis fieldprotected floatThe value of the motor2Angle fieldprotected floatThe value of the motor2AngleRate fieldprotected float[]The value of the motor2Axis fieldprotected floatThe value of the motor3Angle fieldprotected floatThe value of the motor3AngleRate fieldprotected float[]The value of the motor3Axis fieldprotected floatThe value of the stop1Bounce fieldprotected floatThe value of the stop1ErrorCorrection fieldprotected floatThe value of the stop2Bounce fieldprotected floatThe value of the stop2ErrorCorrection fieldprotected floatThe value of the stop3Bounce fieldprotected floatThe value of the stop3ErrorCorrection fieldFields inherited from class org.web3d.vrml.renderer.common.nodes.rigidphysics.BaseJointNode
BODY_NODE_MSG, BODY_PROTO_MSG, FIELD_BODY1, FIELD_BODY2, FIELD_MUST_OUTPUT, LAST_JOINT_INDEX, numMustOutput, numOutputIndices, outputIndices, pBody1, pBody2, vfBody1, vfBody2, vfMustOutputFields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
errorReporter, FIELD_METADATA, fieldLocalData, hasChanged, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, STATIC_SCENE_GRAPH, vfMetadata, vrmlMajorVersion, vrmlMinorVersion -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new default motor joint node object.BaseMotorJoint(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()This node is about to be deleted due to a change in loaded world.getFieldDeclaration(int index) Get the declaration of the field at the given index.intgetFieldIndex(String fieldName) Get the index of the given field name.getFieldValue(int index) Get the value of a field.int[]Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).intGet the number of fields.intGet the primary type of this node.voidsendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.voidsetBody1(VRMLNodeType body) Set node content as replacement for the body1 field.voidsetBody2(VRMLNodeType body) Set node content as replacement for the body1 field.voidsetODEWorld(org.odejava.World wld, org.odejava.JointGroup grp) Set the parent world that this body belongs to.voidNotification that the construction phase of this node has finished.voidsetValue(int index, boolean value) Set the value of the field at the given index as a single float.voidsetValue(int index, float value) Set the value of the field at the given index as a single float.voidsetValue(int index, float[] value, int numValid) Set the value of the field at the given index as a single float.voidsetValue(int index, int value) Set the value of the field at the given index as a single float.voidInstruction to the node to fetch the appropriate field values' output from the physics model and update the outputOnly field with the values.Methods inherited from class org.web3d.vrml.renderer.common.nodes.rigidphysics.BaseJointNode
getBody1, getBody2, getOutputFields, numOutputs, setValue, setValueMethods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, allEventsComplete, checkNodeType, checkSecondaryType, checkSecondaryType, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, getSecondaryType, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, updateRefsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.web3d.vrml.nodes.FrameStateListener
allEventsCompleteMethods inherited from interface org.web3d.vrml.lang.VRMLNode
getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersionMethods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Field Details
-
FIELD_AUTO_CALC
protected static final int FIELD_AUTO_CALCThe field index for autoCalc- See Also:
-
FIELD_MOTOR1_AXIS
protected static final int FIELD_MOTOR1_AXISThe field index for motor1Axis- See Also:
-
FIELD_MOTOR2_AXIS
protected static final int FIELD_MOTOR2_AXISThe field index for motor2Axis- See Also:
-
FIELD_MOTOR3_AXIS
protected static final int FIELD_MOTOR3_AXISThe field index for motor3Axis- See Also:
-
FIELD_AXIS1_ANGLE
protected static final int FIELD_AXIS1_ANGLEThe field index for axis1Angle- See Also:
-
FIELD_AXIS2_ANGLE
protected static final int FIELD_AXIS2_ANGLEThe field index for axis2Angle- See Also:
-
FIELD_AXIS3_ANGLE
protected static final int FIELD_AXIS3_ANGLEThe field index for axis3Angle- See Also:
-
FIELD_STOP1_BOUNCE
protected static final int FIELD_STOP1_BOUNCEThe field index for stop1Bounce- See Also:
-
FIELD_STOP2_BOUNCE
protected static final int FIELD_STOP2_BOUNCEThe field index for stop2Bounce- See Also:
-
FIELD_STOP3_BOUNCE
protected static final int FIELD_STOP3_BOUNCEThe field index for stop3Bounce- See Also:
-
FIELD_AXIS1_TORQUE
protected static final int FIELD_AXIS1_TORQUEThe field index for axis1Torque- See Also:
-
FIELD_AXIS2_TORQUE
protected static final int FIELD_AXIS2_TORQUEThe field index for axis2Torque- See Also:
-
FIELD_AXIS3_TORQUE
protected static final int FIELD_AXIS3_TORQUEThe field index for axis3Torque- See Also:
-
FIELD_MOTOR1_ANGLE
protected static final int FIELD_MOTOR1_ANGLEThe field index for motor1Angle- See Also:
-
FIELD_MOTOR2_ANGLE
protected static final int FIELD_MOTOR2_ANGLEThe field index for motor2Angle- See Also:
-
FIELD_MOTOR3_ANGLE
protected static final int FIELD_MOTOR3_ANGLEThe field index for motor3Angle- See Also:
-
FIELD_MOTOR1_ANGLE_RATE
protected static final int FIELD_MOTOR1_ANGLE_RATEThe field index for motor1AngleRate- See Also:
-
FIELD_MOTOR2_ANGLE_RATE
protected static final int FIELD_MOTOR2_ANGLE_RATEThe field index for motor2AngleRate- See Also:
-
FIELD_MOTOR3_ANGLE_RATE
protected static final int FIELD_MOTOR3_ANGLE_RATEThe field index for motor3AngleRate- See Also:
-
FIELD_STOP1_ERROR_CORRECTION
protected static final int FIELD_STOP1_ERROR_CORRECTIONThe field index for stop1ErrorCorrection- See Also:
-
FIELD_STOP2_ERROR_CORRECTION
protected static final int FIELD_STOP2_ERROR_CORRECTIONThe field index for stop2ErrorCorrection- See Also:
-
FIELD_STOP3_ERROR_CORRECTION
protected static final int FIELD_STOP3_ERROR_CORRECTIONThe field index for stop3ErrorCorrection- See Also:
-
FIELD_ENABLED_AXES
protected static final int FIELD_ENABLED_AXESThe field index for enabledAxes- See Also:
-
LAST_MOTOR_INDEX
protected static final int LAST_MOTOR_INDEXLast index used by this base node- See Also:
-
AXIS1_ANGLE_MSG
Message when the axis1Angle value is out of range- See Also:
-
AXIS2_ANGLE_MSG
Message when the axis2Angle value is out of range- See Also:
-
AXIS3_ANGLE_MSG
Message when the axis3Angle value is out of range- See Also:
-
AXIS1_TORQUE_MSG
Message when the axis1Torque value is out of range- See Also:
-
AXIS2_TORQUE_MSG
Message when the axis2Torque value is out of range- See Also:
-
AXIS3_TORQUE_MSG
Message when the axis3Torque value is out of range- See Also:
-
BOUNCE1_RANGE_MSG
Message when the stopBounce value is out of range- See Also:
-
BOUNCE2_RANGE_MSG
Message when the stop2Bounce value is out of range- See Also:
-
BOUNCE3_RANGE_MSG
Message when the stop3Bounce value is out of range- See Also:
-
STOP_ERROR1_RANGE_MSG
Message when the stop1ErrorCorrection value is out of range- See Also:
-
STOP_ERROR2_RANGE_MSG
Message when the stop2ErrorCorrection value is out of range- See Also:
-
STOP_ERROR3_RANGE_MSG
Message when the stop3ErrorCorrection value is out of range- See Also:
-
vfAutoCalc
protected boolean vfAutoCalcThe value of the autoCalc field -
vfEnabledAxes
protected int vfEnabledAxesThe value of the enabledAxes field -
vfMotor1Axis
protected float[] vfMotor1AxisThe value of the motor1Axis field -
vfMotor2Axis
protected float[] vfMotor2AxisThe value of the motor2Axis field -
vfMotor3Axis
protected float[] vfMotor3AxisThe value of the motor3Axis field -
vfAxis1Angle
protected float vfAxis1AngleThe value of the axis1Angle field -
vfAxis2Angle
protected float vfAxis2AngleThe value of the axis2Angle field -
vfAxis3Angle
protected float vfAxis3AngleThe value of the axis3Angle field -
vfAxis1Torque
protected float vfAxis1TorqueThe value of the axis1Torque field -
vfAxis2Torque
protected float vfAxis2TorqueThe value of the axis2Torque field -
vfAxis3Torque
protected float vfAxis3TorqueThe value of the axis3Torque field -
vfMotor1Angle
protected float vfMotor1AngleThe value of the motor1Angle field -
vfMotor2Angle
protected float vfMotor2AngleThe value of the motor2Angle field -
vfMotor3Angle
protected float vfMotor3AngleThe value of the motor3Angle field -
vfMotor1AngleRate
protected float vfMotor1AngleRateThe value of the motor1AngleRate field -
vfMotor2AngleRate
protected float vfMotor2AngleRateThe value of the motor2AngleRate field -
vfMotor3AngleRate
protected float vfMotor3AngleRateThe value of the motor3AngleRate field -
vfStop1Bounce
protected float vfStop1BounceThe value of the stop1Bounce field -
vfStop2Bounce
protected float vfStop2BounceThe value of the stop2Bounce field -
vfStop3Bounce
protected float vfStop3BounceThe value of the stop3Bounce field -
vfStop1ErrorCorrection
protected float vfStop1ErrorCorrectionThe value of the stop1ErrorCorrection field -
vfStop2ErrorCorrection
protected float vfStop2ErrorCorrectionThe value of the stop2ErrorCorrection field -
vfStop3ErrorCorrection
protected float vfStop3ErrorCorrectionThe value of the stop3ErrorCorrection field -
odeJoint
protected org.odejava.JointAMotor odeJointThe ODE representation of the joint
-
-
Constructor Details
-
BaseMotorJoint
public BaseMotorJoint()Construct a new default motor joint node object. -
BaseMotorJoint
Construct a new instance of this node based on the details from the given node. If the node is not the same type, an exception will be thrown.- Parameters:
node- The node to copy- Throws:
IllegalArgumentException- The node is not the same type
-
-
Method Details
-
delete
public void delete()This node is about to be deleted due to a change in loaded world. Clear up the ODE resources in use. -
updateRequestedOutputs
public void updateRequestedOutputs()Instruction to the node to fetch the appropriate field values' output from the physics model and update the outputOnly field with the values. -
setODEWorld
public void setODEWorld(org.odejava.World wld, org.odejava.JointGroup grp) Set the parent world that this body belongs to. A null value clears the world and indicates the physics model or body is no longer in use by this world (eg deletes it).- Parameters:
wld- The new world instance to use or nullgrp- The group that this joint should belong to
-
setBody1
Set node content as replacement for the body1 field. This checks only for basic node representation. If a concrete node needs a specific set of nodes, it should override this method to check.- Specified by:
setBody1in interfaceVRMLRigidJointNodeType- Overrides:
setBody1in classBaseJointNode- Parameters:
body- The new body representation. null will act like delete- Throws:
InvalidFieldValueException- The node does not match the required type.
-
setBody2
Set node content as replacement for the body1 field. This checks only for basic node representation. If a concrete node needs a specific set of nodes, it should override this method to check.- Specified by:
setBody2in interfaceVRMLRigidJointNodeType- Overrides:
setBody2in classBaseJointNode- Parameters:
body- The new body representation. null will act like delete- Throws:
InvalidFieldValueException- The node does not match the required type.
-
setupFinished
public void setupFinished()Notification that the construction phase of this node has finished. If the node would like to do any internal processing, such as setting up geometry, then go for it now.- Specified by:
setupFinishedin interfaceVRMLNodeType- Overrides:
setupFinishedin classBaseJointNode
-
getFieldIndex
Get the index of the given field name. If the name does not exist for this node then return a value of -1.- Parameters:
fieldName- The name of the field we want the index from- Returns:
- The index of the field name or -1
-
getNodeFieldIndices
public int[] getNodeFieldIndices()Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode). Used for blind scene graph traversal without needing to spend time querying for all fields etc. If a node does not have any fields that contain nodes, this shall return null. The field list covers all field types, regardless of whether they are readable or not at the VRML-level.- Returns:
- The list of field indices that correspond to SF/MFnode fields or null if none
-
getFieldDeclaration
Get the declaration of the field at the given index. This allows for reverse lookup if needed. If the field does not exist, this will give a value of null.- Parameters:
index- The index of the field to get information- Returns:
- A representation of this field's information
-
getNumFields
public int getNumFields()Get the number of fields.- Returns:
- The number of fields.
-
getPrimaryType
public int getPrimaryType()Get the primary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getPrimaryTypein interfaceVRMLNode- Overrides:
getPrimaryTypein classBaseJointNode- Returns:
- The primary type
-
getFieldValue
Get the value of a field. If the field is a primitive type, it will return a class representing the value. For arrays or nodes it will return the instance directly.- Specified by:
getFieldValuein interfaceVRMLNodeType- Overrides:
getFieldValuein classBaseJointNode- Parameters:
index- The index of the field to change.- Returns:
- The class representing the field value
- Throws:
InvalidFieldException- The field index is not known
-
sendRoute
Send a routed value from this node to the given destination node. The route should use the appropriate setValue() method of the destination node. It should not attempt to cast the node up to a higher level. Routing should also follow the standard rules for the loop breaking and other appropriate rules for the specification.- Specified by:
sendRoutein interfaceVRMLNodeType- Overrides:
sendRoutein classBaseJointNode- Parameters:
time- The time that this route occurred (not necessarily epoch time. Should be treated as a relative value only)srcIndex- The index of the field in this node that the value should be sent fromdestNode- The node reference that we will be sending the value todestIndex- The index of the field in the destination node that the value should be sent to.
-
setValue
public void setValue(int index, boolean value) throws InvalidFieldValueException, InvalidFieldException Set the value of the field at the given index as a single float. This would be used to set SFFloat field types.- Specified by:
setValuein interfaceVRMLNodeType- Overrides:
setValuein classAbstractNode- Parameters:
index- The index of destination field to setvalue- The new value to use for the node- Throws:
InvalidFieldException- The field index is not knowInvalidFieldValueException- The value provided is not in range or not appropriate for this field
-
setValue
Set the value of the field at the given index as a single float. This would be used to set SFInt32 field types.- Specified by:
setValuein interfaceVRMLNodeType- Overrides:
setValuein classAbstractNode- Parameters:
index- The index of destination field to setvalue- The new value to use for the node- Throws:
InvalidFieldException- The field index is not knowInvalidFieldValueException- The value provided is not in range or not appropriate for this field
-
setValue
public void setValue(int index, float value) throws InvalidFieldValueException, InvalidFieldException Set the value of the field at the given index as a single float. This would be used to set SFFloat field types.- Specified by:
setValuein interfaceVRMLNodeType- Overrides:
setValuein classAbstractNode- Parameters:
index- The index of destination field to setvalue- The new value to use for the node- Throws:
InvalidFieldException- The field index is not knowInvalidFieldValueException- The value provided is not in range or not appropriate for this field
-
setValue
public void setValue(int index, float[] value, int numValid) throws InvalidFieldValueException, InvalidFieldException Set the value of the field at the given index as a single float. This would be used to set SFFloat field types.- Specified by:
setValuein interfaceVRMLNodeType- Overrides:
setValuein classAbstractNode- Parameters:
index- The index of destination field to setvalue- The new value to use for the nodenumValid- The number of valid values to copy from the array- Throws:
InvalidFieldException- The field index is not knowInvalidFieldValueException- The value provided is not in range or not appropriate for this field
-