Creating SoRoSim: A MATLAB Toolbox for Soft Robotics Modeling and Simulation
By Anup Teejo Mathew, Ikhlas Ben Hmida, and Federico Renda, Khalifa University
In the past, most robots were confined to the factory floor, often at a safe distance from workers and fragile objects. Today, a growing number of robotic applications involve operating in challenging environments, where components must interact closely with delicate matter. Medical robots, for example, encounter human tissue, underwater robots handle marine life, and agricultural robots touch produce and other damageable products.
In these and similar scenarios, soft robots (or hybrid ones that combine rigid parts and compliant materials) are significantly more adept than their strictly rigid counterparts. However, designing this technology necessitates overcoming unique hurdles; for example, modeling soft and hybrid robots with infinite degrees of freedom (DoF) can prove difficult.
Most toolboxes designed for modeling soft robots are based on lumped mass or finite element methods (FEM). These theoretically simple but computationally intensive approaches are adequate for general purpose simulation, but they are too slow for practical use in analysis and control design.
Our team at Khalifa University has developed SoRoSim, a MATLAB® toolbox for soft robotics that uses a Geometric Variable Strain (GVS) model to enable the static and dynamic analysis of soft, rigid, and hybrid robotic systems. The GVS approach models the field of strain—essentially the distortion or curvature of soft links represented by Cosserat rods, which are slender, one-dimensional rods that can bend, twist, stretch, and shear. The toolbox extends existing modeling techniques for rigid robots to soft and hybrid robots using algorithms that are much less computationally expensive than FEM and other approaches. As a result, SoRoSim can produce high-fidelity results many times faster than toolboxes based on other soft robot modeling techniques. In addition, being a generalization of traditional rigid robotics theory, it facilitates a natural integration of the control and optimization techniques delivered by the wider robotics community. The core algorithms of the toolbox are implemented as MATLAB classes and packaged with a user interface that roboticists can use to easily define, analyze, and visualize robotic systems (Figure 1).
Designing and Implementing the Toolbox
In our quest to provide users with an easy-to-use platform, we looked at many available toolboxes, including Peter Corke’s Robotics Toolbox, which uses an object-oriented programming (OOP) approach. This approach provides a well-structured map of the program and allows easy access and adjustment to object-specific data. Inspired by this, we followed a similar approach in creating the SoRoSim Toolbox.
The SoRoSim toolbox implements three MATLAB class elements to represent links, linkages, and twist. The link class enables the user to define soft or rigid links with a variety of joint types, including fixed, revolute, prismatic, universal, and free joints, among others. Users can define soft links with circular, rectangular, or ellipsoidal cross-sections, and they can specify material properties to account for uneven mass distribution and the stiffness of a given link. Rigid links are simply specified by their relative center of mass position and principal moments of inertia. The linkage class lets the user assemble multiple link instances into single-chain, branched-chain, and closed-chain robotic structures. With the linkage class, users can also define external forces, such as gravity, as well as actuation inputs. Lastly, the twist class permits users to specify the DoFs for joints as well as deformation modes and strain for individual divisions within a soft link.
Taking an OOP approach enabled us to easily enhance and add capabilities to these classes over time without having to refactor other aspects of the toolbox. For example, when we first started development, we implemented a constant strain approach. As our research progressed, we added variable strain capabilities, more advanced computational methods, and support for modeling dynamics all within the existing MATLAB class framework.
Validation and Benchmarking
We validated our toolbox by performing a series of tests widely used in computational mechanics and comparing the results with data produced by established modeling tools. These tests include a cantilever beam with a follower force applied at the tip, an L-shaped linkage subjected to gravitational forces, and a freely flying flexible rod, which is also known as the flying spaghetti problem (Figure 2).
After using earlier research, data, and verified results to validate SoRoSim, we took the opportunity to benchmark the computational performance of the toolbox. For example, we compared SoRoSim’s simulation time for the freely flying flexible rod, which uses 15 DoFs to simulate 3D dynamic motion, against an earlier approach published last year. That approach required on average 9 minutes to compute 1 second of simulated motion. SoRoSim was more than 3,000 times faster, completing 7 seconds of simulation in less than 1 second of computational time.
Faster-than-real-time simulation makes it practical to use SoRoSim to address real-world control design and optimization problems. Additionally, one of the main advantages of developing SoRoSim in MATLAB—aside from the popularity of MATLAB among the robotics research community—is the ability to solve complex challenges by combining SoRoSim with other MATLAB toolboxes. As just one example, we recently used SoRoSim together with Global Optimization Toolbox and Parallel Computing Toolbox™ to find the optimal cable path and cable tension for a soft robot, minimizing the error in the manipulator end and middle point coordinates with desired positions at static equilibrium. Specifically, we used
patternsearch to optimize an objective function based on the static equilibrium of the robot’s single cable-actuated soft manipulator.
Using the Toolbox
SoRoSim includes a user interface that simplifies the process of defining links, assembling linkages, running simulations, and visualizing the results. The capabilities of this interface can be best illustrated via an example workflow.
The workflow for modeling a hybrid soft-rigid gripper, for example, begins with the user defining individual soft and rigid links and their properties, including length, cross-sectional shape, and density (Figure 3).
Next, the user creates a soft-rigid finger composed of the soft and rigid individual links, defining the position and orientation of each link and specifying that the soft links will bend about the local z-axis (Figure 4).
The user then defines external forces (including gravity) and any actuations (Figure 5).
Once the linkage is fully defined, the user runs simulations of the complete model for static equilibrium and dynamic analyses (Figure 6).
A similar workflow is used to create a soft manipulator with a single soft link (Figure 7).
After defining cable actuators for this linkage, the model is simulated for static equilibrium and dynamic analyses (Figure 8).
Recent and Future Enhancements
We recently implemented several enhancements to further improve the performance of SoRoSim. These include enabling the user to select the integrator—for example,
ode45—that the toolbox uses to solve stiff differential equations. We are currently exploring the use of different sets of strain basis, in addition to the currently available polynomial basis, for an additional performance boost.
Future development efforts on the toolbox will be guided, in part, by feedback we receive from roboticists and researchers, who are already downloading SoRoSim from MATLAB File Exchange and GitHub.