Wrong answer on robotics forwardDynamics

13 vues (au cours des 30 derniers jours)
barak ostraich
barak ostraich le 24 Juin 2018
i have a 2 rods robot with L1=0.3;L2=0.4 ; cm1=0.2;cm2=0.2; m1=1.8; m2=1.5 with rotational joints. when i load the first joint in forwardDynamics, i get right results. when i'm loading the second joint i get wrong answer. (The analytic answer for torque of [0 1] is accelerations of -9.4737 32.6315)
if true
L1=0.3; L2=0.4;m1=1.8;m2=1.5;cm1=0.2;cm2=0.2;
robot = robotics.RigidBodyTree;
robot.DataFormat = 'row';
body1 = robotics.RigidBody('body1');
jnt1 = robotics.Joint('jnt1','revolute');
setFixedTransform(jnt1,trvec2tform([0, 0, 0]));
jnt1.JointAxis=[0 0 1];
body1.Joint = jnt1;
body1.Inertia=[1 1 0.013+cm1*cm1*m1 0 0 0];
body1.Mass=m1;
body1.CenterOfMass=[ cm1 0 0 ];
addBody(robot,body1,'base');
body2 = robotics.RigidBody('body2');
jnt2 = robotics.Joint('jnt2','revolute');
setFixedTransform(jnt2,trvec2tform([L1, 0, 0]));
jnt2.JointAxis=[0 0 1];
body2.Joint = jnt2;
body2.Inertia=[1 1 0.02+cm2^2*m2 0 0 0];
body2.Mass=m2;
body2.CenterOfMass=[ cm2 0 0];
addBody(robot,body2,'body1');
M=[0 1]
forwardDynamics(robot,[0 0],[0 0] ,M)
%analytic results
% for [1,0] 8.4211 -17.8947; for [0,1] -9.4737 32.6315
%for [1,1] -1.0526 14.7368 ; for [2,2] -2.1053 29.4737
end

Réponses (1)

barak ostraich
barak ostraich le 24 Juin 2018
the torque that the matlab is loading is external torque. it means that you need to add the torque at the next joint to the previus to disable the reaction torque. for example to load internal torques of [3 5] on joints 1 and 2 you will put [8 5]

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by