# How to use joint velocities

12 views (last 30 days)
N on 2 Mar 2021
Commented: William Rose on 4 Mar 2021
Hi.
I do not understand how to use the joint velocities specified in inverseDynamics documentation. jointVel
So does this mean I can specify a row vector of velocities for 'n' joints? Do I specify in meters / second?
Also,I am not clear between the scenario where velocities are 0 by default and why one should define them at all.

William Rose on 2 Mar 2021
The velocities should match the units used elsewhere in your model, for example the units used to specify forces and moments of inertia. So if you are using MKS units for forces and inertia, then the velocities whould be in radians/s for revolute (rotational) joints and m/s for prismatic (sliding) joints.
The length of the velocity vector equals the degrees of freedom in the model, which you can determine as the length of the torque vector, when there are no velocities specified. Here is anexampl of using inverseDynamicsto compute torques without velocities, with velocitis that are zero, with velocities that are all=1, and with velocities that are given by normal(mean=0,stdev=1) random numbers.
%inverseDynamicsRobot.m
%Compute joint torques for a simple robot, with and without joint velocities
%WCR 2021-03-02
rng(1); %fix random number generator seed for reproducible results
lbr.DataFormat = 'row'; %define segments as rows (could have chosen columns)
lbr.Gravity = [0 0 -9.81]; %deifne gravity magnitude, direction
q=randomConfiguration(lbr); %randomize the joint angles
tau =inverseDynamics(lbr,q); %compute the torque vector for the random pose
jointVel=randn(1,7); %choose 7 because length(tau)=7
tau =inverseDynamics(lbr,q,jointVel); %torques with no velocities specified
jointVel0=zeros(1,7);
tauv0=inverseDynamics(lbr,q,jointVel0); %torques with velocity=0 specified
jointVel1=ones(1,7);
tauv1=inverseDynamics(lbr,q,jointVel1); %torques with velocity=1
jointVelR=randn(1,7);
tauvR=inverseDynamics(lbr,q,jointVelR); %torques with random velocities
disp([tau;tauv0;tauv1;tauvR]); %display results
The output is below:
>> inverseDynamicsRobot
0.6894 -17.6441 -5.5455 -0.4874 -0.5817 2.9946 0.5884
0.0000 -17.0954 -2.0821 -0.3977 -0.1771 1.1950 0
10.2351 -23.7290 0.4549 -8.5613 8.5743 -4.6716 4.1912
-5.0188 -25.1773 -12.4692 -7.4887 -4.0599 10.8511 9.1837
As you can see from the results above, the torques with velocity=0 (row 2 of results) is the same as when no velocities are specified (row 1) - which makes sense. The extra torque needed for non-zero velocity (rows 3 and 4) is complicated and depends on the current pose, relative to the external forces, if any (there arenone in this example), and the gravity vector. In a more realistic joint model than the one here, there would also be a frictional (also known as a damping) term in the torque, which would be proportional to (rotational) velocity. But this joint model does allow for damping.
N on 4 Mar 2021
I think perhaps other countries don't have access to these. The links don't work on any of my devices.

William Rose on 4 Mar 2021
I'm sorry to hear that the link does not work. If you type in http://www2.ece.ohio-state.edu/~zhang/RoboticsClass/, it does not work? I do not know an alternative. Does it help if you precede the address with https://?
William Rose on 4 Mar 2021
Another suggestion to access the content is to web search for "wei zhang ece5463". When I do that search on Google, or Bing, or even Yandex, the search returns links to the lectures.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by