Products & Services Solutions Academia Support User Community Company

Learn more about SimMechanics Link   

Translating a CAD Robot Arm

Locating the Robot Arm Assembly Files

The following example is based on a more complex CAD assembly, a robot arm. It includes multiple parts, two closed loops, multiple constraints, and a subassembly.

Locate the 11 CAD files for the robot arm in the SimMechanics Link demos folder. They are

File NameCAD File Type
robot.ASSEMBLYFILETYPEAssembly
grip.ASSEMBLYFILETYPESubassembly (flexible)
base.PARTFILETYPE
forearm.PARTFILETYPE
upperarm.PARTFILETYPE
wrist.PARTFILETYPE
Parts (main assembly)
fingertips.PARTFILETYPE (twice)
firstfingerlink.PARTFILETYPE
firstfingerlinkL.PARTFILETYPE
metacarpal.PARTFILETYPE
secondfingerlink.PARTFILETYPE (twice)
Parts (subassembly)

Viewing the Robot Arm Assembly

Open the assembly file for the whole robot.

Robot Arm Assembly in a CAD Platform

In the assembly tree to the left of the window, examine the CAD hierarchy:

The whole assembly has eight DoFs. The grip subassembly alone contains two, allowing each finger to open and close separately. The main assembly has six DoFs:

Exporting the Robot Arm Assembly

Apply any changes you want to the assembly configuration or settings. If you change the assembly or any subassemblies, you need to rebuild the assembly before exporting it to XML.

Using the SimMechanics Link interface to your CAD platform, export the assembly into Physical Modeling XML. The XML file robot.xml appears in your working CAD folder.

Generating and Completing the Robot Arm Model

Generate a SimMechanics model for the robot arm based on the file robot.xml. You can use this preconfigured demo file or export your own version of the XML file from the robot arm CAD assembly. In either case, copy or move the XML file to your MATLAB working folder.

Generating the Initial Model

The preconfigured robot.xml file is in the SimMechanics demos folder.

  1. Generate the model by entering mech_import('robot') at the command line.

    The status bar opens and indicates the progress of model generation. A model window, named robot, opens and is populated with blocks.

  2. Save this initial body-joint model as robot, and note these properties:

    • The top level of the model has 13 blocks and the grip-1 subsystem.

    • The grip-1 subsystem has 18 blocks.

      The original robot arm assembly has eight DoFs, with two in the grip subassembly and six at the top level. These translate into eight DoFs in the SimMechanics model, where:

      • Six DoFs occur at the top level. These include the upper arm relative to the base, the forearm relative to the upper arm, the wrist relative to the forearm, and the grip relative to the wrist.

      • Two DoFs occur in the grip-1 subsystem. These are the rotational DoFs of the two grip fingers.

        There are eight revolute primitives in the subsystem. They occur in two closed loops as two independent four-bar mechanisms. Each four-bar mechanism actually has only one independent DoF because each four-bar loop closes on itself.

Obtaining Simulink and Additional SimMechanics Blocks

To modify and extend the robot arm model, you need blocks from the SimMechanics and Simulink block libraries. Open these libraries by entering mechlib and simulink, respectively, at the command line.

You can also open the Simulink library from the MATLAB window menu or toolbar.

Editing the Bodies

Some of the bodies in the generated robot arm model are redundant. You can remove them without affecting the model's dynamics, as long as you properly reconnect the remaining blocks.

See the reference page for more details about the Body block.

Editing the Joints

The non-Weld Joint blocks, those that carry DoFs, are Revolute and SphericalSpherical Joints configured with the proper primitives to represent the original CAD assembly's DoFs.

Save this intermediate model as robot2.

Adding an Actuator and a Sensor

You can motion-actuate the wrist relative to the forearm.

  1. Double-click the Revolute that connects the forearm-1 and wrist-1 Body blocks. Change the Number of sensor/actuator ports to 2.

  2. Click OK. Two new ports appear on the Joint.

  3. From the SimMechanics Sensors & Actuators library, insert and attach a Joint Actuator and a Joint Sensor to these new ports.

  4. Configure the Joint Actuator to accept motion signals. Be sure the angular units are deg (degrees).

  5. From the Simulink library, insert a Sine Wave, a Mux, two Integrator blocks, and one Scope block. Connect them to the previous blocks as shown in the following figure. Rename the Scope block to Pitch Angle.

    Consult the Simulink documentation for more about these Simulink blocks.

  6. In the Sine Wave block, set the Amplitude to 60*pi*pi and the Frequency to 60. Leave all other defaults.

  7. In the lower Integrator block, set Initial condition to -60*pi. Leave all other defaults.

Configuring Tolerances

The original robot arm CAD assembly requires looser tolerances than the SimMechanics defaults, and its motion can lead to singularities. To avoid simulation errors or slowdown, you need to reconfigure the assembly tolerances and constraint solver:

  1. Open the Machine Environment block.

  2. On the Parameters tab, reset the Linear assembly tolerance to 1e-2 m (meters) and the Angular assembly tolerance to 1e-1 rad (radians).

  3. On the Constraints tab, select the Use robust singularity handling check box. Leave all other defaults. Click OK.

  4. Resave your finished model as robot3.

Simulating and Observing the Robot Arm Motion

Run robot3 and examine its motion.

To use the motion sensor:

  1. Double-click the Pitch Angle block to open a scope.

  2. Click the Start simulation button. The scope plot displays a trace of the pitch angle motion.

To visualize the body motions:

  1. From the Simulation menu, select Configuration Parameters, then the SimMechanics node.

  2. Select Display machines after updating diagram and Show animation during simulation. Click OK.

  3. Select Update Diagram from the Edit menu. The SimMechanics visualization window opens.

  4. In the SimMechanics menu of the visualization window, select Machine Display, then Ellipsoids. The display now shows the robot arm's component bodies as ellipsoids.

  5. Click the Start button. The simulation begins. Observe the robot arm motion in the SimMechanics window.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS