# Inverse dynamics for robotic arm using Matlab Simmechanics

I am learning Simmechanics Matlab to do inverse dynamics for 4 DOF robotic arm. I read many examples to input motion to revolute joints like through PID, slider gain, sine waves, signal Builder etc. But these are not fulfilling my purpose as I have to rotate angles within limits and automatically. For example when I used sine wave signal, it continuously rotate until simulation time is not over. So, basically what I have is angles to rotate (through inverse kinematics) and now I want to find out torque required to reach that pose. How I can do this? How to create signal which fit in this scenario.

Thanks.

For each revolute joint in the robot you can add a joint sensor. The sensors can be configured to output all joint forces and torques. That way you can compute reaction and motor forces and torques for a specified motion or pose of the robot.

Please make sure that you carefully select the reference frames for the measurements.

• Thanks 50k4 for reply, I know how to give motion to joints but what I do not know is like this. Let theta1 should move from 0 to 10 deg, theta2 should move from 0 to 15 deg, likewise theta3 and theta4 should move some angle to reach a known pose. How to give motion input to robot revolute joint like this. I solved inverse kinemtics for my robot so I know these angles. Thanks. Mar 12, 2017 at 17:27

You can use Simscape Multibody (the new name for what was SimMechanics) as a two-step process.

Joints in the package generally allow for one of two inputs to be used - force/torque or position. If you choose to provide joint torque, then the resulting output motion is calculated by the dynamics of the system. If you choose to provide joint position, then Simscape calculates the force/torque required to achieve that motion, then applies that to the system dynamics.

The process I would use for designing would go something like this:

1. Create a motion profile that you deem is representative of the tasks the robot is supposed to perform.
2. Calculate the inverse kinematics to get the required joint angles to achieve the motion profile.
3. Use the joint sensors 50k4 mentioned to trend/plot the joint forces and torques required to achieve your motion profile.
4. Choose the peak force/torque for each axis of motion, add some performance margin, and choose actuators that at least provide that performance.
5. Generate a model for the actuators you selected. This model includes whatever actuator dynamics there are along with whatever input conditioning you're expecting to use. For example, how are you expecting to have the actuators in real life track joint angle? PID control of angle error? That's what you model.