MATLAB Answers

Is there a bug in show function of Robotics System Toolbox of 2021a version?

1 view (last 30 days)
siyong xu
siyong xu on 31 May 2021
Answered: Yiping Liu on 1 Jun 2021
It seems there is a bug in `show` function.
This is a simple robot model built using DH parameters.
dhparams = [0 pi/2 0 0;
0.4318 0 0 0
0.0203 -pi/2 0.15005 0;
0 pi/2 0.4318 0;
0 -pi/2 0 0;
0 0 0 0];
robot = rigidBodyTree;
body1 = rigidBody('body1');
jnt1 = rigidBodyJoint('jnt1','revolute');
setFixedTransform(jnt1,dhparams(1,:),'dh');
body1.Joint = jnt1;
addBody(robot,body1,'base')
body2 = rigidBody('body2');
jnt2 = rigidBodyJoint('jnt2','revolute');
body3 = rigidBody('body3');
jnt3 = rigidBodyJoint('jnt3','revolute');
body4 = rigidBody('body4');
jnt4 = rigidBodyJoint('jnt4','revolute');
body5 = rigidBody('body5');
jnt5 = rigidBodyJoint('jnt5','revolute');
body6 = rigidBody('body6');
jnt6 = rigidBodyJoint('jnt6','revolute');
setFixedTransform(jnt2,dhparams(2,:),'dh');
setFixedTransform(jnt3,dhparams(3,:),'dh');
setFixedTransform(jnt4,dhparams(4,:),'dh');
setFixedTransform(jnt5,dhparams(5,:),'dh');
setFixedTransform(jnt6,dhparams(6,:),'dh');
body2.Joint = jnt2;
body3.Joint = jnt3;
body4.Joint = jnt4;
body5.Joint = jnt5;
body6.Joint = jnt6;
addBody(robot,body2,'body1')
addBody(robot,body3,'body2')
addBody(robot,body4,'body3')
addBody(robot,body5,'body4')
addBody(robot,body6,'body5')
showdetails(robot)
show(robot);
axis([-0.5,0.5,-0.5,0.5,-0.5,0.5])
axis off
But there are something wrong with the figure ploted by show funciton: when I click the axis of some body, the arrow that shows the revolute direction is not coinside with the axis, just like this
When I click the body 3, is shows the z axis of body 2, and when I click the body2, it shows the z axis of body1.
So, is there a bug of show function? Because the show funciton in MATLAB 2020a is normal.

Accepted Answer

Yiping Liu
Yiping Liu on 1 Jun 2021
So the plot from 20a (LEFT) is incorrect, and this bug has been fixed in 21a (the plot on the RIGHT shows the correct joint axis).
For a robot specified using DH parameters, when you click on body3, its rotation axis happens to be aligned with the z axis of body2's body frame.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by