org.ode4j.ode
Interface DPistonJoint

All Superinterfaces:
DJoint

public interface DPistonJoint
extends DJoint

****************************************************************************
Piston

****************************************************************************
Component of a Piston joint

                              |- Anchor point
      Body_1                  |                       Body_2
      +---------------+       V                       +------------------+
     /               /|                             /                  /|
    /               / +       |--      ______      /                  / +
   /      x        /./........x.......(_____()..../         x        /.......> axis
  +---------------+ /         |--                +------------------+ /
  |               |/                             |                  |/
  +---------------+                              +------------------+
          |                                                 |
          |                                                 |
          |------------------> <----------------------------|
              anchor1                  anchor2


 
When the prismatic joint as been elongated (i.e. dJointGetPistonPosition) return a value > 0
                                   |- Anchor point
      Body_1                       |                       Body_2
      +---------------+            V                       +------------------+
     /               /|                                  /                  /|
    /               / +            |--      ______      /                  / +
   /      x        /./........_____x.......(_____()..../         x        /.......> axis
  +---------------+ /              |--                +------------------+ /
  |               |/                                  |                  |/
  +---------------+                                   +------------------+
          |                                                      |
          |                                                      |
          |----------------.>      <----------------------------|
              anchor1         |----|         anchor2
                                ^
                                |-- This is what dJointGetPistonPosition will
                                    return
 
****************************************************************************


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ode4j.ode.DJoint
DJoint.DJointFeedback, DJoint.PARAM, DJoint.PARAM_GROUPS, DJoint.PARAM_N
 
Field Summary
 
Fields inherited from interface org.ode4j.ode.DJoint
P_OFS_1, P_OFS_2, P_OFS_3
 
Method Summary
 void addForce(double force)
          Applies the given force in the slider's direction.
 void getAnchor(DVector3 result)
          Get the joint anchor.
 void getAnchor2(DVector3 result)
          Get the joint anchor wrt body 2.
 double getAngle()
          Get the Piston angular position (i.e.
 double getAngleRate()
          Get the piston angular position's time derivative.
 void getAxis(DVector3 result)
          Get the prismatic axis (This is also the rotoide axis.
 double getParam(DJoint.PARAM_N parameter)
          Get joint parameter.
 double getParamHiStop2()
           
 double getParamLoStop2()
           
 double getPosition()
          Get the Piston linear position (i.e.
 double getPositionRate()
          Get the piston linear position's time derivative.
 void setAnchor(double x, double y, double z)
          Set the joint anchor.
 void setAnchor(DVector3C a)
          Set the joint anchor.
 void setAnchorOffset(DVector3C xyz, double dx, double dy, double dz)
          Set the Piston anchor as if the 2 bodies were already at [dx,dy, dz] apart.
 void setAxis(double x, double y, double z)
          Set the joint axis.
 void setAxis(DVector3C a)
          Set the joint axis.
 void setParam(DJoint.PARAM_N parameter, double value)
          Set joint parameter.
 void setParamHiStop2(double d)
           
 void setParamLoStop2(double d)
           
 
Methods inherited from interface org.ode4j.ode.DJoint
attach, DESTRUCTOR, disable, enable, getBody, getData, getFeedback, getNumBodies, isEnabled, setData, setFeedback
 

Method Detail

setAnchor

void setAnchor(double x,
               double y,
               double z)
Set the joint anchor.


setAnchor

void setAnchor(DVector3C a)
Set the joint anchor.


getAnchor

void getAnchor(DVector3 result)
Get the joint anchor.

This returns the point on body 1. If the joint is perfectly satisfied, this will be the same as the point on body 2 in direction perpendicular to the prismatic axis.


getAnchor2

void getAnchor2(DVector3 result)
Get the joint anchor wrt body 2.

This returns the point on body 2. You can think of a Piston joint as trying to keep the result of dJointGetPistonAnchor() and dJointGetPistonAnchor2() the same in the direction perpendicular to the prismatic axis. If the joint is perfectly satisfied, this function will return the same value as dJointGetPistonAnchor() to within roundoff errors. dJointGetPistonAnchor2() can be used, along with dJointGetPistonAnchor(), to see how far the joint has come apart.


setAnchorOffset

void setAnchorOffset(DVector3C xyz,
                     double dx,
                     double dy,
                     double dz)
Set the Piston anchor as if the 2 bodies were already at [dx,dy, dz] apart.

This function initialize the anchor and the relative position of each body as if the position between body1 and body2 was already the projection of [dx, dy, dz] along the Piston axis. (i.e as if the body1 was at its current position - [dx,dy,dy] when the axis is set). Ex:
double offset = 3;
dVector3 axis;
dJointGetPistonAxis(jId, axis);
dJointSetPistonAnchor(jId, 0, 0, 0);
// If you request the position you will have: dJointGetPistonPosition(jId) == 0
dJointSetPistonAnchorOffset(jId, 0, 0, 0, axis[X]*offset, axis[Y]*offset, axis[Z]*offset);
// If you request the position you will have: dJointGetPistonPosition(jId) == offset

Parameters:
xyz - The X, Y and Z position of the anchor point in world frame
dx - A delta to be substracted to the X position as if the anchor was set when body1 was at current_position[X] - dx
dy - A delta to be substracted to the Y position as if the anchor was set when body1 was at current_position[Y] - dy
dz - A delta to be substracted to the Z position as if the anchor was set when body1 was at current_position[Z] - dz

setAxis

void setAxis(double x,
             double y,
             double z)
Set the joint axis.


setAxis

void setAxis(DVector3C a)
Set the joint axis.


getAxis

void getAxis(DVector3 result)
Get the prismatic axis (This is also the rotoide axis.


getPosition

double getPosition()
Get the Piston linear position (i.e. the piston's extension).

When the axis is set, the current position of the attached bodies is examined and that position will be the zero position.


getPositionRate

double getPositionRate()
Get the piston linear position's time derivative.


addForce

void addForce(double force)
Applies the given force in the slider's direction.

That is, it applies a force with specified magnitude, in the direction of prismatic's axis, to body1, and with the same magnitude but opposite direction to body2. This function is just a wrapper for dBodyAddForce().


getParamLoStop2

double getParamLoStop2()

getParamHiStop2

double getParamHiStop2()

setParamLoStop2

void setParamLoStop2(double d)

setParamHiStop2

void setParamHiStop2(double d)

getAngle

double getAngle()
Get the Piston angular position (i.e. the twist between the 2 bodies).

When the axis is set, the current position of the attached bodies is examined and that position will be the zero position.


getAngleRate

double getAngleRate()
Get the piston angular position's time derivative.


setParam

void setParam(DJoint.PARAM_N parameter,
              double value)
Set joint parameter.

Specified by:
setParam in interface DJoint

getParam

double getParam(DJoint.PARAM_N parameter)
Get joint parameter.

Specified by:
getParam in interface DJoint