0% found this document useful (0 votes)
9 views10 pages

TN1-DesignRobotUsingSolidworksMATLAB-22.02.2018-English

The document outlines a laboratory exercise for mechanical engineering students to design, simulate, and control a two degree-of-freedom (2DOF) robot using SolidWorks and MATLAB with Simscape Multibody Link. It details the necessary software installations, steps for exporting and importing CAD files, and essential procedures for building and configuring a multibody model. The exercise aims to enhance students' abilities in mechanical design, simulation, and programming of robotic systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views10 pages

TN1-DesignRobotUsingSolidworksMATLAB-22.02.2018-English

The document outlines a laboratory exercise for mechanical engineering students to design, simulate, and control a two degree-of-freedom (2DOF) robot using SolidWorks and MATLAB with Simscape Multibody Link. It details the necessary software installations, steps for exporting and importing CAD files, and essential procedures for building and configuring a multibody model. The exercise aims to enhance students' abilities in mechanical design, simulation, and programming of robotic systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

FL061

Mechanical Engineering Faculty


Department of Mechatronics Design and Simulate Robot Motion using
Simscape Multibody Link

1. Introduction
Simscape Multibody Link is a plug-in that you install on your CAD application to export your
CAD assembly models. The plug-in generates the files that you need to import the model into the
Simscape Multibody environment in MATLAB. From this file, users can program, simulate the
motion of the model (designed by CAD) by attaching sensors, actuators, signal system, etc. into
the model.
You can install the plug-in on 3 CAD applications: SolidWorks, Autodesk Inventor, and PTC
Creo. In this Laboratory lesson, we design a robot in SolidWorks and after that, we import this
model into MATLAB for programming.

Students need to install following softwares before coming to class:


- SolidWorks
- MATLAB
- Install Simscape Multibody Link by following command lines:
+ install_addon(‘smlink.r2017a.win64.zip’)
+ regmatlabserver
+ smlink_linksw

Goals:
 Have ability to design a mechanical model (robot) using Solidworks.
 Have ability to export a designed file in CAD and import this file into MATLAB using
Simscape Multibody Link.
 Have ability to simulate robot motion using Simscape Multibody environment of
MATLAB.

2. Experimental Devices: Laptop and necessary softwares


2.1 Introduction of 2DOF robot
The robot model designed in this exercise is a two degree-of-freedom (2DOF) robot, shown in
Figure 1. This robot includes 4 parts: base link (Part 0), first link (Part 1), second link (Part 2), and
end-effector link (Part 3). The base link is connected to the first link by a revolute joint and the
first link is connected to the second link also by another revolute joint. The end-effector link is
connected to the second link by a revolute joint but this joint make the end-effector part rotate
around its axis. Thus we can consider the robot just has two degrees of freedom.

Faculty of Mechanical Engineering @HCMUT 1


FL061

Figure 1: A 2DOF robot designed in SolidWorks


Detailed dimensions of each link of the 2DOF robot are shown in those figures from Figure 2
to Figure 5.

Figure 2: Dimension of the base link

Figure 3: Dimension of the first link


Faculty of Mechanical Engineering @HCMUT 2
FL061

Figure 4: Dimension of the second link

Figure 5: Dimension of the end-effector link

2.2 Export and Import files


2.2.1 Export files in SolidWorks
After designing and assembling robot, students should open assembly file of robot.
Next, you choose: Tool>Addin>Simscape Multibody Link (or Simmechanics Link).
After that, you choose: Tool>Simscape Multibody Link>Export>First Generation and export
to ‘robot2DOF.XML’ file.

2.2.2 Import files to MATLAB


To import files to MATLAB, you use the following command line:
smimport(‘robot2DOF’)
However, because we choose First Generation (in SolidWorks), we should use another command
line as follows:
mech_import
Next, you choose the file XML (export from SolidWorks).

2.3 Simscape Multibody Toolbox


Simscape Multibody provides a multibody simulation environment for 3D mechanical systems,
such as robots, vehicle suspensions, construction equipment, and aircraft landing gear. You can
model multibody systems using blocks representing bodies, joints, constraints, force elements, and
sensors. Simscape Multibody formulates and solves the equations of motion for the complete
mechanical system. You can import complete CAD assemblies, including all masses, inertias,

Faculty of Mechanical Engineering @HCMUT 3


FL061
joints, constraints, and 3D geometry, into your model. An automatically generated 3D animation
lets you visualize the system dynamics.
Simscape Multibody helps you develop control systems and test system-level performance. You
can parameterize your models using MATLAB® variables and expressions, and design control
systems for your multibody system in Simulink®. You can integrate hydraulic, electrical,
pneumatic, and other physical systems into your model using components from the Simscape
family of products. To deploy your models to other simulation environments, including hardware-
in-the-loop (HIL) systems, Simscape Multibody supports C-code generation.
In this lesson, we learn about how to use the basic module of Simscape>Multibody, it is First
Generation (1G). This module is similar to the corresponding Simmechanics Link toolbox of
previous version of MATLAB. This lesson is built based on MATLAb 2017a version, thus there
are maybe several differences with other version of MATLAB.

2.3.1 List of Component Groups in First Generation


Module Simscape>Multibody>First Generation (1G) includes following groups (Fig. 6):
Bodies (Fig. 7), Constraints & Drivers (Fig. 8), Force Elements (Fig. 9), Interface Elements
(Fig. 10), Joints (Fig. 11), Utilities (Fig. 12), Sensors and Actuators (Fig. 13).

Figure 6: Components in Simscape>Multibody>First Generation (1G) module

Figure 7: Components in group of Bodies

Figure 8: Components in groups of Constraints & Drivers

Faculty of Mechanical Engineering @HCMUT 4


FL061

Figure 9: Components in group of Force Elements

Figure 10: Components in groups of Interface Elements

Figure 11: Components in group of Joints

Figure 12: Components in group of Utilities

Faculty of Mechanical Engineering @HCMUT 5


FL061

Figure 13: Components in group of Sensors & Actuators

2.3.2 Essential Steps to Build a Model


You use the same basic procedure for building a Simscape™ Multibody™ model regardless of its
complexity. The steps are similar to those for building a regular Simulink® model. More complex
models add steps without changing these basics.
1. Select Ground, Body, and Joint blocks. From the Bodies and Joints libraries, drag and drop
the Body and Joint blocks needed to represent your machine, including a Machine
Environment block and at least one Ground block, into a Simulink model window.
The Machine Environment block represents your machine's mechanical settings.
Ground blocks represent immobile ground points at rest in absolute (inertial) space.
Body blocks represent rigid bodies.
Joint blocks represent relative motions between the Body blocks to which they are connected.
2. Position and connect blocks. Place Joint and Body blocks in proper relative position in the
model window and connect them in the proper order. The essential result of this step is creation
of a valid tree block diagram made of
Machine Env — Ground — Joint — Body — Joint — Body — ... — Body
with an open or closed topology and where at least one of the bodies is a Ground block.
Connect exactly one environment block to a Ground.
A Body can have more than two Joints attached, marking a branching of the sequence. But
Joints must be attached to two and only two Bodies.
3. Configure Body blocks. Click the Body blocks to open their dialog boxes; specify their mass
properties (masses and moments of inertia), then position and orient the Bodies and Grounds
relative to the World coordinate system (CS) or to other CSs. You set up Body CSs here.

Faculty of Mechanical Engineering @HCMUT 6


FL061
4. Configure Joint blocks. Click each of the Joint blocks to open its dialog box and set translation
and rotation axes and spherical pivot points.
5. Select, connect, and configure Constraint and Driver blocks. From the Constraints & Drivers
library, drag, drop, and connect Constraint and Driver blocks in between pairs of Body blocks.
Open and configure each Constraint/Driver's dialog box to restrict or drive the relative motion
between the two respective bodies of each constrained/driven pair.
6. Select, connect, and configure Actuator and Sensor blocks. From the Sensors & Actuators
library, drag and drop the Actuator and Sensor blocks that you need to impart and sense
motion. Reconfigure Body, Joint, and Constraint/Driver blocks to accept Sensor and Actuator
connections. Connect Sensor and Actuator blocks. Specify control signals (applied
forces/torques or motions) through Actuators and measure motions through Sensors.
Actuator and Sensor blocks connect Simscape Multibody blocks to normal Simulink blocks.
You cannot connect Simscape Multibody blocks to regular Simulink blocks otherwise.
Actuator blocks take inport signals from normal Simulink blocks (for example, from the
Simulink Sources library) to actuate motion. Sensor block output ports generate Simulink
signals that you can feed to normal Simulink blocks (for example, from the Simulink Sinks
library).
In the most straightforward case, you apply forces/torques and initial conditions, then start the
simulation in the Forward Dynamics mode to obtain the resulting motions. In the Kinematics
and Inverse Dynamics modes, you apply motions to all independent degrees of freedom. With
these modes, you can find the forces/torques needed to produce these imposed motions.
7. Encapsulate subsystems. Systems made from Simscape Multibody blocks can function as
subsystems of larger models, like subsystems in normal Simulink models. You can connect an
entire Simscape Multibody model as a subsystem to a larger model by using the Connection
Port block in the Utilities library.

2.3.3 Essential Steps to Configure and Run a Model


After you've built your model as a connected block diagram, you need to decide how you want to
run your model, configure Simscape Multibody and Simulink settings, and set up visualization.
- You can choose from among four Simscape Multibody analysis modes for simulating a
machine. The mode you will probably use most often is Forward Dynamics.
But a more complete analysis of a machine makes use of the Kinematics, Inverse Dynamics, and
Trimming modes as well. You can create multiple versions of the model, each with the same
underlying machine, but connected to Sensors and Actuators and configured differently for
different modes.
- You can also use the powerful Simscape Multibody visualization and animation features.
You can visualize your model as you build it or after you are finished but before you start the
simulation, as a tool for debugging the model's geometry. You can also animate the model as you
simulate.
- Choose the analysis mode, as well as other important mechanical settings, in your
Machine Environment dialog. Start visualization and adjust Simulink settings in the Simulink

Faculty of Mechanical Engineering @HCMUT 7


FL061
Configuration Parameters dialog. See Model and Simulate a Closed-Loop Machine for an
example.

3. Experimental Content
3.1 Time: 4.25 hours for each group of students.
3.2 Content
Students do following steps:
- Step 1: Design and assemble a 2DOF robot in SolidWorks (the robot is shown in Figure 1). Next
you should save as an assembly file.

- Step 2: Export a designed 2DOF robot to XML format file and import this file to MATLAB
using Simscape Multibody Link.

- Step 3: Change the color of each link of robot: the base link is grey, the first link is blue, the
second link is red, the end-effector link is green.
Guide: Doule click the desired link (need to change color) and choose Visualization.

Figure 14: How to change the color of links

- Step 4: Attach a “Body Sensor” to the end-effector link to measure the position of the end-
effector and show this position on Scope, Graph.
Guide: In the end-effector link, add a CS3 coordinate system. The origin of this frame is in the top
of the end-effector. Next, we need to attach a “Body Sensor” in ths frame.

Faculty of Mechanical Engineering @HCMUT 8


FL061

Figure 15: Attach Body Sensor to End-effector link

- Step 5: Attach sensors “Joint Sensor” to joint 1 and joint 2 to measure the angles as these joints
and show on Scope.

Figure 16: How to use a Joint Sensor

- Step 6: Attach actuators “Joint Actuator” to joint 1 and joint 2. Choose control mode of Force or
Motion.

Figure 17: How to use a Joint Actuator

- Step 7: Program to control joint 1 and joint 2 to rotate desired angles according to time.
(Example: Joint 1 rotates 60 degrees, Joint 2 rotate 90 degrees).

Faculty of Mechanical Engineering @HCMUT 9


FL061
4. Experimental Results (Note: Students should submit this paper to the Teacher after class)
Step 1:

Not work □ Not work perfectly □ Work perfectly □


Another Idea:

Step 2:

Not work □ Not work perfectly □ Work perfectly □


Another Idea:

Step 3:

Not work □ Not work perfectly □ Work perfectly □


Another Idea:

Step 4:

Not work □ Not work perfectly □ Work perfectly □


Another Idea:

Step 5:

Not work □ Not work perfectly □ Work perfectly □


Another Idea:

Step 6:

Not work □ Not work perfectly □ Work perfectly □


Another Idea:

Step 7:

Not work □ Not work perfectly □ Work perfectly □


Another Idea:

References
[1] Website MATLAB
Name of Student:……….………….……..………Student ID:……...….………….Group:………
Name of Student:……….………….……..………Student ID:……...….………….Group:………
Name of Student:……….………….……..………Student ID:……...….………….Group:………

Faculty of Mechanical Engineering @HCMUT 10

You might also like