This example shows how to model a double pendulum—a simple
kinematic chain comprising two moving bodies connected in series via
two revolute joints. A third body represents a mechanical ground and
is rigidly connected to the inertial World frame. The custom
provides the body subsystem blocks used in the example.
Revolute Joint blocks enable you to model the joints connecting adjacent bodies and help set their initial states. Simscape™ Multibody™ software satisfies a joint state target precisely if it is kinematically valid and not in conflict with other state targets. A Priority parameter lets you specify which targets to attempt to satisfy first.
Start a new model.
Drag these blocks into the model. The two Revolute Joint blocks provide the double pendulum two rotational degrees of freedom.
At the MATLAB® command prompt, enter
A custom block library with the same name opens up.
Drag these custom blocks into the model. Each block represents a body in the double pendulum.
|Binary Link A||2|
Connect the blocks as shown in the figure.
In the Revolute Joint block dialog boxes, select State Targets > Specify Position Target. You can now specify the desired starting positions of the two joints.
In Value, enter these joint angles.
|Block Name||Value (degrees)|
To visualize the model, update the block diagram. You can do this from the menu bar by selecting Simulation > Update Diagram. Mechanics Explorer opens with a 3-D view of the double pendulum assembly. Click the isometric view button to obtain the perspective in the figure.
To check the assembly status of the revolute joints, use the Model Report utility. You can open this utility from the Mechanics Explorer menu bar by selecting Tools > Model Report. The figure shows the assembly information for the double pendulum.
Run the simulation, e.g., by selecting Simulation > Run. Mechanics Explorer shows a 3-D animation of the double pendulum assembly. The assembly moves due to gravity, specified in the Mechanism Configuration block.
To see a complete model of the double pendulum assembly, at the MATLAB command prompt enter: