org.ode4j.ode
Interface DJoint

All Known Subinterfaces:
DAMotorJoint, DBallJoint, DContactJoint, DFixedJoint, DHinge2Joint, DHingeJoint, DLMotorJoint, DNullJoint, DPistonJoint, DPlane2DJoint, DPRJoint, DPUJoint, DSliderJoint, DUniversalJoint

public interface DJoint

In real life a joint is something like a hinge, that is used to connect two objects. In ODE a joint is very similar: It is a relationship that is enforced between two bodies so that they can only have certain positions and orientations relative to each other. This relationship is called a constraint -- the words joint and constraint are often used interchangeably.

A joint has a set of parameters that can be set. These include:

  • dParamLoStop Low stop angle or position. Setting this to -dInfinity (the default value) turns off the low stop. For rotational joints, this stop must be greater than -pi to be effective.
  • dParamHiStop High stop angle or position. Setting this to dInfinity (the default value) turns off the high stop. For rotational joints, this stop must be less than pi to be effective. If the high stop is less than the low stop then both stops will be ineffective.
  • dParamVel Desired motor velocity (this will be an angular or linear velocity).
  • dParamFMax The maximum force or torque that the motor will use to achieve the desired velocity. This must always be greater than or equal to zero. Setting this to zero (the default value) turns off the motor.
  • dParamFudgeFactor The current joint stop/motor implementation has a small problem: when the joint is at one stop and the motor is set to move it away from the stop, too much force may be applied for one time step, causing a ``jumping'' motion. This fudge factor is used to scale this excess force. It should have a value between zero and one (the default value). If the jumping motion is too visible in a joint, the value can be reduced. Making this value too small can prevent the motor from being able to move the joint away from a stop.
  • dParamBounce The bouncyness of the stops. This is a restitution parameter in the range 0..1. 0 means the stops are not bouncy at all, 1 means maximum bouncyness.
  • dParamCFM The constraint force mixing (CFM) value used when not at a stop.
  • dParamStopERP The error reduction parameter (ERP) used by the stops.
  • dParamStopCFM The constraint force mixing (CFM) value used by the stops. Together with the ERP value this can be used to get spongy or soft stops. Note that this is intended for unpowered joints, it does not really work as expected when a powered joint reaches its limit.
  • dParamSuspensionERP Suspension error reduction parameter (ERP). Currently this is only implemented on the hinge-2 joint.
  • dParamSuspensionCFM Suspension constraint force mixing (CFM) value. Currently this is only implemented on the hinge-2 joint. If a particular parameter is not implemented by a given joint, setting it will have no effect. These parameter names can be optionally followed by a digit (2 or 3) to indicate the second or third set of parameters, e.g. for the second axis in a hinge-2 joint, or the third axis in an AMotor joint.


    Nested Class Summary
    static class DJoint.DJointFeedback
               
    static class DJoint.PARAM
               
    static class DJoint.PARAM_GROUPS
               
    static class DJoint.PARAM_N
               
     
    Field Summary
    static int P_OFS_1
               
    static int P_OFS_2
               
    static int P_OFS_3
               
     
    Method Summary
     void attach(DBody body1, DBody body2)
              Attach the joint to some new bodies.
     void DESTRUCTOR()
               
     void disable()
              Manually disable a joint.
     void enable()
              Manually enable a joint.
     DBody getBody(int index)
              Return the bodies that this joint connects.
     java.lang.Object getData()
              Get the user-data pointer.
     DJoint.DJointFeedback getFeedback()
              Gets the datastructure that is to receive the feedback.
     int getNumBodies()
              Return the number of bodies attached to the joint.
     double getParam(DJoint.PARAM_N type)
              get joint parameter
     boolean isEnabled()
              Check whether a joint is enabled.
     void setData(java.lang.Object data)
              Set the user-data pointer.
     void setFeedback(DJoint.DJointFeedback fb)
              Sets the datastructure that is to receive the feedback.
     void setParam(DJoint.PARAM_N type, double value)
              If not implemented it will do nothing as describe in the doc.
     

    Field Detail

    P_OFS_1

    static final int P_OFS_1
    See Also:
    Constant Field Values

    P_OFS_2

    static final int P_OFS_2
    See Also:
    Constant Field Values

    P_OFS_3

    static final int P_OFS_3
    See Also:
    Constant Field Values
    Method Detail

    DESTRUCTOR

    void DESTRUCTOR()

    getNumBodies

    int getNumBodies()
    Return the number of bodies attached to the joint.


    attach

    void attach(DBody body1,
                DBody body2)
    Attach the joint to some new bodies.

    Remark:
    Some joints, like hinge-2 need to be attached to two bodies to work.

    setData

    void setData(java.lang.Object data)
    Set the user-data pointer.


    getData

    java.lang.Object getData()
    Get the user-data pointer.


    getBody

    DBody getBody(int index)
    Return the bodies that this joint connects.

    Parameters:
    index - return the first (0) or second (1) body.
    Remark:
    If one of these returned body IDs is zero, the joint connects the other body to the static environment. If both body IDs are zero, the joint is in ``limbo'' and has no effect on the simulation.

    setFeedback

    void setFeedback(DJoint.DJointFeedback fb)
    Sets the datastructure that is to receive the feedback.

    The feedback can be used by the user, so that it is known how much force an individual joint exerts.


    getFeedback

    DJoint.DJointFeedback getFeedback()
    Gets the datastructure that is to receive the feedback.


    setParam

    void setParam(DJoint.PARAM_N type,
                  double value)
    If not implemented it will do nothing as describe in the doc.


    getParam

    double getParam(DJoint.PARAM_N type)
    get joint parameter


    enable

    void enable()
    Manually enable a joint.


    disable

    void disable()
    Manually disable a joint.

    Remark:
    A disabled joint will not affect the simulation, but will maintain the anchors and axes so it can be enabled later.

    isEnabled

    boolean isEnabled()
    Check whether a joint is enabled.

    Returns:
    1 if a joint is currently enabled or 0 if it is disabled.