You are on page 1of 8

Using MALTAB SimMechanics for Robotic Simulations

Arun Dayal Udai


Department of Mechanical Engineering
Birla Institute of Technology, Mesra

Designing a robot with professionalism is work of an engineer, who takes care of every aspects of a
precision robot design, performance on realistic platform, optimizing the available resources and
putting their best for outcome of robots efficiency. Robot design is not just about demonstrating
ones proof of concept through a crude prototype. An efficient design is possible only through an
iterative process of synthesis, analysis, optimization and testing. A proven cost effective way of
analysis is virtual simulation of mechanical designs on a time tested platform of MATLAB
SimMechanics. SimMechanics is an add-on module of MATLAB Simulink that can be used to
model and simulate mechanical systems. In this article an approach of intuitive learning through
example is utilized to demonstrate robotic simulation. Students of robotics and professionals in
industry can utilize such tools for predetermining various design parameters for selection of
different components of a robot structure.
Motor selection is one of the most critical components which determine the robot performance to a
high degree. It should be of a high power by weight ratio. A high power/torque motor is normally
accompanied by its heavy weight, which increases wandering and over shooting in robotic
manipulators. So, an optimum selection of motor/actuator is required to be made, for a custom
designed robot for any application. The robot discussed here is a basic three Degrees of Freedom
articulated arm manipulator, which is tested for different payload and trajectories. A set of torque
for different joint actuators is obtained without going into complex Lagrangian mechanics. The
method utilizes SimMechanics that can be very handy for early developers and professionals.
Building the model using SimMechanics blocks
Start Simulink by clicking on Simulink icon from the main menu of MATLAB toolbar and scroll to
SimMechanics library which is available in Simscape in MATLAB R2008 or higher. Under this one
can find mechanical blocks for Bodies, Constraints & Drivers, Force Elements, Interface Elements,
Joints, and Sensors & Actuators. Blocks from each of these elements can be dragged and dropped to
the workspace and connected together to form a mechanical system. After setting the parameters
for these, the system can be executed to visualize various run time parameters and end results can
be read.

Figure 1: Window showing SimMechanics elements
Constructing a 3 DOF Articulated Robotic Arm
Geometrical representation of a 3 DOF (3R) manipulator with three links can be shown as in Fig. 1.

Figure 2: Geometrical representation of 3 DOF robotic manipulators
Forward kinematic solution for which can be derived as:
( )
( )
1 2 2 3 2 3
1 2 2 3 2 3
1 2 2 3 2 3
cos cos cos( )
sin cos cos( )
sin sin( )
x l l
y l l
z l l l



= + +
= + +
= + + +

If the end effecter of the robot manipulator has to be traced over a path given by p = f(x, y, z, t),
position taken by end effecter (x
c
, y
c
, z
c
) are known at any given instant of time t. Hence, the
actuators are required to drive the joints to angles corresponding to these points so as to trace in
this given trajectory. Solving for angles, for forward kinematic equations we get
1
1
tan
c
c
y
x

| |
=
|
\
,
2 2 2 2
1 1 2 2 3
3
2 3
cos
2
k k l l
l l


( +
=
(

, where
1 1
cos
c
k x = and
2 1 c
k z l =
1 1 1 2 3
2
3 3 2
sin
sin tan
cos
c
z l l
r l l


| | | |
=
| |
+
\
\
, where ( ) ( )
2 2
3 3 2 3 3
cos sin r l l l = + +
These inverse kinematic equations are used to generate a set of angles which is to be varied with
time to make the robot trace any given path. A sample data generated in the workspace for a spline
trajectory may look like the one shown in Fig. 3. Which contains time increments of 0.01s in its first
column, second column contains angles taken up by joint one for each time intervals in radians. The
third and fourth column contains velocity and acceleration constraints which are neglected for the
current case.

Fig. 3: Angle variation for any joint as prepared in workspace.
With this as a background for the current example of robotic manipulator, one can construct robot
in SimMechanics using mechanical blocks. Drag-drop blocks from different mechanical modules to a
blank workspace created in MATLAB Simulink, and connect them to construct the robot system as
shown in the Fig. 4. Only three inputs for joints angles are required for the simulation to run.

Fig. 4: Structure of 3 DOF Robotic Manipulator using SimMechanics Blocks
Let the length of the links be l
1
= 100mm + 2mm for Base Height, l
2
= 300mm and l
3
= 300mm, the
parameters for each of the blocks can be set as shown in Table 1 as follows:

Block Name Obtained
From
Block Parameters to Set Comments
Machine
Environment
Bodies Gravity Vector [0 0 -9.81] m/s
2

Negative Z
Axis
Ground Bodies
Show Machine Environment Port
Location [0 0 0]

Fixing Joint
Joints
Prismatic
Axis of Action [1 1 0]
Free to
slide
Manipulator
Base Link0
Bodies
Mass: 302g,
Inertia: 1.0e-003 * [0.0630 0 0; 0 0.3046 0; 0 0 0.3674]
Kg/m
2


Only CS1
and CS2
are shown
Yaw Base
Revolute
Joint
Joints -
Revolute
Axis of Action [0 0 1], Reference CS Base
Number of sensor and actuator ports: 2

Yaw servo
Sensors &
Actuators
Joint
Actuator
Angular units: radians
Actuate
with
Motion
Th1_Sim
Simulink
Sources
From
Workspace
Data Source: Th1_Sim
Sample Time: 0.01s
Interpolate Data
Output after final data value: holding the final value
Format as
in Fig: 3
Joint Torque
Sensor
Sensors &
Actuators
Joint
Sensor
Check: Computed Torque (Nm)
Scope3
Simulink
Sinks
Scope
None
Link1 Bodies
Mass: 25g
Inertia:1.0e-003 *[0.0019 0 0;0 0.0019 0; 0 0
0.0001]kg/m
2



Parameters for other blocks are set in similar fashion depending on the robot configuration. It is left
as an assignment for the reader to do that. Body position sensor is configured to sense the absolute
position with respect to world coordinate system. The remaining two links may be set to be in
horizontal position. A Spline curve as shown in Fig. 5(a) is fed to the inverse kinematic formulation to
generate variations of different joint angles as in Fig. 5 (b), (c) and (d) for 50 curve points. The curve
points are spaced more closely towards its ends so as to have a reduced velocity at the ends. Any
two successive points are traversed in equal time interval of 0.01 seconds.

a. Spline Path Trajectory

b. Theta1 for 50 points on Trajectory

c. Theta2 for 50 points on Trajectory

d. Theta3 for 50 points on Trajectory
Fig. 5
Configuration parameters for the SimMechanics simulation are set to show animation during
simulation and display machines during updating diagram. Solver stop time is set to 0.5 seconds.
Now the model is all set to run with data for joint angle variations with time existing in the
workspace. One can now run the simulation to visualize the model and its run time parameters as in
Fig. 6. The scopes can be double-clicked to see the joint torque variations as in Fig. 7. This joint
torques for each joint may be utilized for actuator selection for each joint. The last link should be
constructed to take care of the payload attached to it.
The model visualization can be improved by grouping a set of blocks to construct a single block
assigning an image to it by editing its mask. The Model Properties can use callbacks to load a data
file on opening a model file.

Fig. 6: Stick Simulation of 3 DOF Robotic Manipulator

Fig. 7: Torque Variation of different joints in Nm for 0.5 Seconds Trajectory
With this I conclude the article, and I wish all the best for any innovative design one may have.
References:
SimMechanics User Guide 1984-2008 The MathWorks, Inc.

You might also like