# Designing Digital Twins of Robots Using Simscape Multibody

^{1}

^{2}

^{3}

^{*}

^{†}

## Abstract

**:**

## 1. Introduction

## 2. Kinematic Modeling

#### 2.1. Kinematic Description of the Manipulator

#### 2.2. Creation of the Robot Kinematic Model in Simscape Multibody

`smimport`, which automatically generates the blocks representing bodies, joints, and constraints between bodies. However, depending on how each link has been designed in the CAD environment (i.e., where its origin is located) and how the assembly constraints have been defined, this import can generate unnecessary constraints and transformations between bodies and joints, especially for custom-made robots with a high number of DOFs. As the relationships between bodies are specified in terms of translation and rotations from one local reference to another, we found that the most effective way to generate a Simscape Multibody model of a robot is to define in the CAD software, for each link, a reference frame located at the corresponding DH frame and then import each body separately. Following this approach, the local reference frame of each link corresponds to its DH frame, and the translations and rotations from one local reference to another, which have to be manually defined, correspond to the ones specified in the DH table.

#### 2.3. Interface with the Robotic System Toolbox

`rigidBodyTree`object as input, which is the class used to build robot models. To use these blocks for the robot modeled using Simscape Multibody and depicted in Figure 2, we used the

`importrobot`command, which returns a

`rigidBodyTree`object.

#### 2.4. Kinematic Control of the Manipulator in the Cartesian Space

`rigidBodyTree`object (derived as in Section 2.3), the desired pose, the weights, and the initial guess. A number of solver parameters can be modified by the user, such as the exit conditions, which determine both the accuracy of the solution and the time needed to carry out the simulation. The desired pose is specified in terms of a homogeneous matrix, which is obtained by a rotation matrix and a rotation matrix through the Coordinate Transformation Conversion block. The rotation matrix is in turn obtained from the ZYZ Euler angles through another Coordinate Transformation Conversion block. Similarly, the Direct Kinematics block calculates the direct kinematics from the measured joint values: the output of this block is a homogeneous matrix, which is subsequently transformed into $(x,y,z)$ and $(\alpha ,\beta ,\gamma )$ coordinates through Coordinate Transformation Conversion blocks.

## 3. Dynamic Modeling

#### 3.1. Euler-Lagrange Approach

#### 3.2. Newton-Euler Approach

#### 3.3. Simulation of the Forward Dynamics

#### 3.4. Inverse Dynamics Control of the Manipulator

## 4. Inclusion of Friction, Reduction Gears and Actuators Dynamics

#### 4.1. Friction

#### 4.2. Reduction Gears and Motors

#### 4.3. Actuators Dynamics

## 5. Simulation of a Computed Torque Control Scheme

## 6. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Garg, G.; Kuts, V.; Anbarjafari, G. Digital twin for fanuc robots: Industrial robot programming and simulation using virtual reality. Sustainability
**2021**, 13, 336. [Google Scholar] [CrossRef] - Automation Control Environment (ACE) Version 4 User Manual. Available online: https://assets.omron.eu/downloads/manual/en/v4/i633_ace_4.0_users_manual_en.pdf (accessed on 29 February 2024).
- Borangiu, T.; Răileanu, S.; Anton, F.; Lențoiu, I.; Negoiță, R. Cloud-Based Digital Twin for Robot Health Monitoring and Integration in Cyber-Physical Production Systems. Mech. Mach. Sci.
**2023**, 127, 261–269. [Google Scholar] [CrossRef] - Connolly, C. Technology and applications of ABB RobotStudio. Ind. Robot
**2009**, 36, 540–545. [Google Scholar] [CrossRef] - Kaczmarek, W.; Panasiuk, J.; Borys, S.; Banach, P. Industrial robot control by means of gestures and voice commands in off-line and on-line mode. Sensors
**2020**, 20, 6358. [Google Scholar] [CrossRef] [PubMed] - Collins, J.; Chand, S.; Vanderkop, A.; Howard, D. A review of physics simulators for robotic applications. IEEE Access
**2021**, 9, 51416–51431. [Google Scholar] [CrossRef] - Simscape Multibody. Available online: https://www.mathworks.com/products/simscape-multibody.html (accessed on 29 February 2024).
- Robotic System Toolbox. Available online: https://www.mathworks.com/products/robotics.html (accessed on 29 February 2024).
- Truc, L.N.; Lam, N.T. Quasi-physical modeling of robot IRB 120 using Simscape Multibody for dynamic and control simulation. Turk. J. Electr. Eng. Comput. Sci.
**2020**, 28, 1949–1964. [Google Scholar] [CrossRef] - Truc, L.N.; Quang, N.P.; Quang, N.H. Impact analysis of actuator torque degradation on the IRB 120 robot performance using simscape-based model. Int. J. Electr. Comput. Eng.
**2021**, 11, 4850–4864. [Google Scholar] [CrossRef] - Raviola, A.; Guida, R.; Bertolino, A.C.; De Martin, A.; Mauro, S.; Sorli, M. A Comprehensive Multibody Model of a Collaborative Robot to Support Model-Based Health Management. Robotics
**2023**, 12, 71. [Google Scholar] [CrossRef] - Gouasmi, M.; Ouali, M.; Fernini, B.; Meghatria, M. Kinematic modelling and simulation of a 2-R robot using solidworks and verification by matlab/simulink. Int. J. Adv. Robot. Syst.
**2012**, 9, 245. [Google Scholar] [CrossRef] - Ibrahim, B.; Zargoun, A.M. Modelling and control of SCARA manipulator. Procedia Comput. Sci.
**2014**, 42, 106–113. [Google Scholar] [CrossRef] - Zhang, Z.; Zhang, C.; Deng, Z.; Feng, H. Modelling and Dynamic Simulation of Palletizing Robot System Based on Multibody. In Proceedings of the 2023 IEEE 6th Information Technology, Networking, Electronic and Automation Control Conference (ITNEC), Chongqing, China, 24–26 February 2023; pp. 583–587. [Google Scholar] [CrossRef]
- Lee, K.; Lee, J.; Woo, B.; Lee, J.; Lee, Y.J.; Ra, S. Modeling and Control of a Articulated Robot Arm with Embedded Joint Actuators. In Proceedings of the 2018 International Conference on Information and Communication Technology Robotics (ICT-ROBOT), Busan, Republic of Korea, 6–8 September 2018. [Google Scholar] [CrossRef]
- Bârsan, A.; Racz, S.G.; Breaz, R.; Crenganiș, M. Dynamic analysis of a robot-based incremental sheet forming using Matlab-Simulink Simscape™ environment. Mater. Today Proc.
**2022**, 62, 2538–2542. [Google Scholar] [CrossRef] - Racz, S.G.; Crenganiș, M.; Breaz, R.E.; Bârsan, A.; Gîrjob, C.E.; Biriș, C.M.; Tera, M. Integrating Trajectory Planning with Kinematic Analysis and Joint Torques Estimation for an Industrial Robot Used in Incremental Forming Operations. Machines
**2022**, 10, 531. [Google Scholar] [CrossRef] - Olaya, J.; Pintor, N.; Avilés, O.F.; Chaparro, J. Analysis of 3 RPS robotic platform motion in simscape and MATLAB GUI environment. Int. J. Appl. Eng. Res.
**2017**, 12, 1460–1468. [Google Scholar] - Noskievic, P.; Walica, D. Design and Realisation of the Simulation Model of the Stewart Platform using the MATLAB-Simulink and the Simscape Multibody Library. In Proceedings of the 2020 21th International Carpathian Control Conference (ICCC), High Tatras, Slovakia, 27–29 October 2020. [Google Scholar] [CrossRef]
- Khnissi, K.; Jabeur, C.B.; Seddik, H. 3D Simulator for Navigation of a Mobile Robot Using Simscape-SIMULINK. In Proceedings of the 2019 International Conference on Control, Automation and Diagnosis (ICCAD), Grenoble, France, 2–4 July 2019. [Google Scholar] [CrossRef]
- Siwek, M.; Baranowski, L.; Panasiuk, J.; Kaczmarek, W. Modeling and simulation of movement of dispersed group of mobile robots using Simscape multibody software. AIP Conf. Proc.
**2019**, 2078, 020045. [Google Scholar] [CrossRef] - Eldirdiry, O.; Zaier, R. Modeling biomechanical legs with toe-joint using simscape. In Proceedings of the 2018 11th International Symposium on Mechatronics and its Applications (ISMA), Sharjah, United Arab Emirates, 4–6 March 2018; pp. 1–7. [Google Scholar] [CrossRef]
- Aldair, A.A.; Al-Mayyahi, A.; Jasim, B.H. Control of Eight-Leg Walking Robot Using Fuzzy Technique Based on SimScape Multibody Toolbox. Mater. Sci. Eng.
**2020**, 745, 012015. [Google Scholar] [CrossRef] - Nguyen, N.T.; Nguyen, T.N.T.; Tong, H.N.; Truong, H.V.A.; Tran, D.T. Dynamic Parameter Identification based on the Least Squares method for a 6-DOF Manipulator. In Proceedings of the 2023 International Conference on System Science and Engineering (ICSSE), Ho Chi Minh, Vietnam, 27–28 July 2023; pp. 301–305. [Google Scholar] [CrossRef]
- Du, N.; Yan, L.; Gao, X.; Xiang, P.; Bu, S. Simulation Analysis of Discrete Admittance Control of Manipulator. In Proceedings of the 2022 IEEE 17th Conference on Industrial Electronics and Applications (ICIEA), Chengdu, China, 16–19 December 2022; pp. 926–930. [Google Scholar] [CrossRef]
- Truc, L.N.; Vu, L.A.; Thoan, T.V.; Thanh, B.T.; Nguyen, T.L. Adaptive Sliding Mode Control Anticipating Proportional Degradation of Actuator Torque in Uncertain Serial Industrial Robots. Symmetry
**2022**, 14, 957. [Google Scholar] [CrossRef] - Nguyen, V.C.; Thi, H.L.; Nguyen, T.L. A Lyapunov-based model predictive control strategy with a disturbances compensation mechanism for dual-arm manipulators. Eur. J. Control
**2023**, 75, 100913. [Google Scholar] [CrossRef] - Othman, Z.H.; Mahfouz, D.M.; Shehata, O.M. Analysis and Development of a Hybrid Position/Force Control for a N-DoF Robotic Manipulator. In Proceedings of the 2022 4th Novel Intelligent and Leading Emerging Sciences Conference (NILES), Giza, Egypt, 22–24 October 2022; pp. 90–94. [Google Scholar] [CrossRef]
- Pozzi, M.; Achilli, G.M.; Valigi, M.C.; Malvezzi, M. Modeling and Simulation of Robotic Grasping in Simulink Through Simscape Multibody. Front. Robot. AI
**2022**, 9, 873558. [Google Scholar] [CrossRef] [PubMed] - Grazioso, S.; Di Maio, M.; Di Gironimo, G. Conceptual design, control, and simulation of a 5-DoF robotic manipulator for direct additive manufacturing on the internal surface of radome systems. Int. J. Adv. Manuf. Technol.
**2019**, 101, 2027–2036. [Google Scholar] [CrossRef] - Craig, J.J. Introduction to Robotics: Mechanics and Control, 2nd ed.; Addison-Wesley Longman Publishing Co., Inc.: Upper Saddle River, NJ, USA, 1989. [Google Scholar]
- Siciliano, B.; Sciavicco, L.; Villani, L.; Oriolo, G. Robotics: Modelling, Planning and Control, 3rd ed.; Springer: London, UK, 2009. [Google Scholar]
- Autonox Robotics GmbH. Available online: https://www.autonox.com/en (accessed on 29 February 2024).
- Denavit, J.; Hartenberg, R. A Kinematic Notation for Lower-Pair Mechanisms Based on Matrices. J. Appl. Mech. Trans. ASME
**1955**, 22, 215–221. [Google Scholar] [CrossRef] - de Jalón, J.; Bayo, E. Kinematic and Dynamic Simulation of Multibody Systems: The Real-Time Challenge; Mechanical Engineering Series; Springer: Berlin/Heidelberg, Germany, 1994. [Google Scholar]
- Corke, P.I. A robotics toolbox for MATLAB. IEEE Robot. Autom. Mag.
**1996**, 3, 24–32. [Google Scholar] [CrossRef] - Bittencourt, A.C.; Gunnarsson, S. Static friction in a robot joint-modeling and identification of load and temperature effects. J. Dyn. Syst. Meas. Control. Trans. ASME
**2012**, 134, 051013. [Google Scholar] [CrossRef] - Zhang, L.; Wang, J.; Chen, J.; Chen, K.; Lin, B.; Xu, F. Dynamic modeling for a 6-DOF robot manipulator based on a centrosymmetric static friction model and whale genetic optimization algorithm. Adv. Eng. Softw.
**2019**, 135, 102684. [Google Scholar] [CrossRef] - Bittencourt, A.C.; Wernholt, E.; Sander-Tavallaey, S.; Brogårdh, T. An extended friction model to capture load and temperature effects in robot joints. In Proceedings of the 2010 IEEE/RSJ International Conference on Intelligent Robots and Systems, Taipei, Taiwan, 18–22 October 2010; pp. 6161–6167. [Google Scholar] [CrossRef]
- Haessig, D.; Friedland, B. On the modeling and simulation of friction. J. Dyn. Syst. Meas. Control. Trans. ASME
**1991**, 113, 354–362. [Google Scholar] [CrossRef] - Falkenhahn, V.; Hildebrandt, A.; Neumann, R.; Sawodny, O. Model-based feedforward position control of constant curvature continuum robots using feedback linearization. In Proceedings of the 2015 IEEE International Conference on Robotics and Automation (ICRA), Seattle, WA, USA, 26–30 May 2015; pp. 762–767. [Google Scholar] [CrossRef]
- Kali, Y.; Saad, M.; Benjelloun, K. Optimal super-twisting algorithm with time delay estimation for robot manipulators based on feedback linearization. Robot. Auton. Syst.
**2018**, 108, 87–99. [Google Scholar] [CrossRef]

**Figure 3.**(

**left**) Subsystem of each link that composes the 6 DOF anthropomorphic robot and (

**right**) 3D visualization of the manipulator generated by Simscape Multibody.

**Figure 6.**Measuredjoint positions and velocities during the kinematic control of the manipulator though user-defined Matlab functions.

**Figure 7.**Measuredjoint positions and velocities during the kinematic control of the manipulator though Robotic System Toolbox blocks.

**Figure 8.**Simulink scheme of the forward dynamics of the manipulator using the Simscape Multibody model, the Newton-Euler model, the Euler-Lagrange model and the Robotics System Toolbox block.

**Figure 9.**Discrepancy between the output of the Simulink Multibody model, the Newton-Euler or Euler-Lagrange model and the Robotics System Toolbox block.

**Figure 10.**Inverse dynamics control of the manipulator using user-defined Matlab functions or the inverse dynamics block provided by Robotic System Toolbox.

**Figure 11.**Trajectory tracking error for each joint when the manipulator is controlled through inverse dynamics in Simscape Multibody.

**Figure 13.**Torque-controlled Simscape multibody revolute joint with rotational friction, reduction gear and rotor inertia.

**Figure 14.**Simscapemultibody revolute joint with rotational friction, reduction gear and PMSM motor.

**Figure 15.**(

**left**) Simulation of a computed torque scheme using the robot’s mathematical model (including reduction gears, viscous and Coulomb friction) and (

**right**) resulting tracking error for each joint.

**Figure 16.**(

**left**) Simulation of a computed torque scheme using the Simscape model (including reduction gears, a complete model of friction and actuators dynamics) and (

**right**) resulting tracking error for each joint.

i | ${}^{\mathit{i}-1}\mathit{T}_{\mathit{i}}$ | ${\mathit{\alpha}}_{\mathit{i}-1}$ | ${\mathit{a}}_{\mathit{i}-1}$ | ${\mathit{\theta}}_{\mathit{i}}$ | ${\mathit{d}}_{\mathit{i}}$ |
---|---|---|---|---|---|

${(}^{\circ})$ | (mm) | ${(}^{\circ})$ | (mm) | ||

1 | ${}^{0}\mathit{T}_{1}$ | 0 | 0 | ${\theta}_{1}$ | 500 |

2 | ${}^{1}\mathit{T}_{2}$ | $-90$ | 150 | ${\theta}_{2}$ | 0 |

3 | ${}^{2}\mathit{T}_{3}$ | 0 | 400 | ${\theta}_{3}$ | 0 |

4 | ${}^{3}\mathit{T}_{4}$ | $-90$ | 100 | ${\theta}_{4}$ | 540 |

5 | ${}^{4}\mathit{T}_{5}$ | 90 | 0 | ${\theta}_{5}$ | 0 |

6 | ${}^{5}\mathit{T}_{6}$ | $-90$ | 0 | ${\theta}_{6}$ | 100 |

User-Defined Closed Form | Robotics System Toolbox | |
---|---|---|

Average elapsed time | $1.74\mathrm{s}$ | $30.19\mathrm{s}$ |

Newton-Euler | Euler-Lagrange | Robotics System Toolbox | |
---|---|---|---|

Average elapsed time | $14.59\mathrm{s}$ | $8.95\mathrm{s}$ | $649.54\mathrm{s}$ |

Newton-Euler | Euler-Lagrange | Robotics System Toolbox | |
---|---|---|---|

Average elapsed time | $4.31\mathrm{s}$ | $4.71\mathrm{s}$ | $177.81\mathrm{s}$ |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Boschetti, G.; Sinico, T.
Designing Digital Twins of Robots Using Simscape Multibody. *Robotics* **2024**, *13*, 62.
https://doi.org/10.3390/robotics13040062

**AMA Style**

Boschetti G, Sinico T.
Designing Digital Twins of Robots Using Simscape Multibody. *Robotics*. 2024; 13(4):62.
https://doi.org/10.3390/robotics13040062

**Chicago/Turabian Style**

Boschetti, Giovanni, and Teresa Sinico.
2024. "Designing Digital Twins of Robots Using Simscape Multibody" *Robotics* 13, no. 4: 62.
https://doi.org/10.3390/robotics13040062