Summary - This details how I computed the dynamics and created a simulation for a 5-dof parallel robot so that I could test software without needing the physcial robot. This came about due to covid, but has become an integral part of my workflow, allowing me to validate new test protocols and control algorithms without touching the physical robot.
In my lab, one of the main robots that has been used for experiments is the Mahi Exo II (MEII). This robot is a 5-DOF robot that can actuate the user’s elbow flexion/extension, forearm pronation/supination, wrist flexion/extension, and wrist radial/ulnar deviation, as well as one DOF that is adjustable for the user’s arm length.
One of the main features of this robot is that it has a parallel mechanism that drives the last 3 DOFs. This provides the benefit of moving the weight back in the robot, but complicates control, because we cannot simply use a PD controller for every anatomical joint to follow a trajectory.
Using the kinematics and the constraints of the parallel mechanism, we can compute the required torque to effectively provide torque to the anatomical DOFs, even though we are providing them to the non-anatomical parallel DOFs. See this document for more information about kinematic modeling. Essentially, there are 14 total DOFs on the robot, 9 of them passive, and 9 constraints, so that we can derive the motion we want on the 5 DOFs that are important to us.
I had been using the robot for research, but when COVID-19 arrived, I was unable to use the robot in person, so I developed a simulation for the MEII so that I could test software at home. The parallel kinematics means that there is no closed-form solution for the dynamics of the MEII. Using this paper, I was able to transform the dynamics of the 14 individual DOFs to the 5 DOFs that were important for me.
With the solution, I created a simulation using the Unity game engine. I was able to export the solidworks files as .objs, import them into Unity, and set them to move given variables. Separately, I set up a c++ program that would calculate the accelerations of each of the joints, and integrate through time at a 1kHz loop rate. This was loaded as a dll into Unity and the resulting movements were visualized as mentioned. All code that was used to do this is available here, with dynamics calculated in matlab, EOMs converted to a usable format using python, c++ code to run the simulation, and unity environment to communicate with simulation and visualize results.
In my repository that is used to run the MEII, I added a flag that I could input to any program that would reroute all daq commands (reading position/velocity and writing torque) to the simulation instead of the daq. Now, I can run anything that I can run on the real robot, in my own simulation!