Tutorial 3: Joints
Joints connect two Solids, constraining their relative motion. There are several types of Joints, each constraining motion in different ways. The available Joints are: Hinge Joints (one rotational degree of freedom), Universal Joints (two rotational degrees of freedom), Ball Joints (three rotational degrees of freedom), Wheel Joints (two rotational degrees of freedom; typically one axis coincides with a wheel’s axis, and the other is used for steering), Slider Joints (one translational degree of freedom), and Fixed Joints (zero rotational degrees of freedom).
Joints are created much like Solids:
Before using the Joint, it must be initialized with a JointData object. Before it can be initialized, you must create two Solids and position them:
Note that a Joint can connect two Solids, or it can pin a single Solid to the static environment by simply setting the Joint’s other Solid to NULL. Joints can have limits for each of their degrees of freedom. Let’s create another Joint with some limits:
By default, Joints are unbreakable: they can withstand unlimited amounts of stress. Joints can also be setup as breakable Joints. The following code sets up an existing Joint in “threshold” break mode (when the combined force and torque on the Joint exceeds some threshold, it breaks):
Another Joint break mode in OPAL is “accumulated” mode: stress is accumulated until it exceeds a threshold, at which point the Joint breaks. When a Joint breaks, it is immediately disabled, and the Joint’s JointBreakEventHandler is notified (if one has been set).
When you are done with a Joint, tell the Simulator to destroy it:
If anything depends on this Joint, like a Motor, it will automatically be disabled.
OPAL is Copyright © 2004-2005 Alan Fischer, Andres Reinot, and Tyler Streeter