How to use joint velocities

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?
Please give an example.
Also,I am not clear between the scenario where velocities are 0 by default and why one should define them at all.

Answers (2)

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
load exampleRobots.mat lbr %load a robot
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.

5 Comments

Thanks.
Your row one is not the same as row two, as you have specified random for row 1: jointVel=randn(1,7);
However, I have this confusion:
I have specified gravity as [0 0 1]. I don't want -9.8 since it's not Earth.
Then, I have the Jacobian for the end-effector pose, which is:
jointVel = [0.2 0.2 0.2 0.2 0.2 0.2]
torques2 = inverseDynamics(Manipulator,EE_config, jointVel)
The Jacbian and inverse:
geoJacob = geometricJacobian(Manipulator,EE_config,'EE')
inverseJacobian = inv(geoJacob)
inverseJacobian =
0.0023 0.1352 -0.0044 -2.7047 0.0466 0.0000
0.0063 0.0005 -0.0000 -0.0099 0.0391 -2.6484
0.1169 0.0309 -0.0010 -0.6192 2.4559 3.5589
145.5717 359.0602 -11.7233 -109.3280 310.2773 113.0334
-1.0547 0.3172 -0.0107 0.5626 -2.3553 -0.8597
-145.5740 -359.1613 12.7271 112.0314 -310.3249 -113.0338
torques generated from above are: torques2 =
1.9027 -0.0549 -0.0781 0.1587 -0.0529 -0.0264
HOWEVER: If I dot product the first row of the inverse Jacobian with the velocities [0.2 0.2 0.2 0.2 0.2], I do not get torque1 as 1.9 ( torque vector = inverse J times velocity vector). None of the torques are equal to what is out above if I manually multiply J inverse with velocity vector. Why is that? Is there some hidden calculation we don't know of? Thanks for your help.
I suspect that there is some calculation that you and I don't know about. I assume all your joints are revolute, not prismatic, in which case all velocities are angular. The 1x6 velocity vector and the 1x6 torque vector are the velocity and torque magnitudes, about the axis of each joint, as it is currently oriented. The gravity vector is in the global refence frame (GRF). The orientation of the joint axes relative to the GRF needs to be taken in to account. I don;t know if the geometric Jacobian does this. If this were my probelm I would study this set of lectures, including, for purposes of this discussion, lecture 7, which discusses the geometric Jacobian, and lecture 13, which discusses inverse dynamics.
Thank you. The three links you mentioned above for lectures seem to be incorrect and don't work. Can you please provide the correct links?
@N, Weird. I just clicked on the links, in the answer posted above, and they worked fine for me. From the first link, you can find the second and third, by scrolling down. The first one is
.
I think perhaps other countries don't have access to these. The links don't work on any of my devices.

Sign in to comment.

William Rose
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://?

1 Comment

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.

Sign in to comment.

Asked:

N
N
on 2 Mar 2021

Commented:

on 4 Mar 2021

Community Treasure Hunt

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

Start Hunting!