frames not appearing using robotics system toolbox

18 次查看(过去 30 天)
Hi all,
I am using the rotics system toolbox and I want to create a robot , when I display my robot, there are no frames unlike the tutorial.
Does anyone know what is happening please and how I can fix it
here is my code:
clear all; clc;
dh=[0 60 0 pi/2;
0 0 -315 0;
0 0 -310 0 ;
0 0 -75 -pi/2];
body1 = rigidBody('body1');
jnt1 = rigidBodyJoint('jnt1','revolute');
jnt1.HomePosition = 0;
tform = dh2homogene(dh(1,:)); % function that gets the homegenous transformation given the denavit hartenberg table/row
setFixedTransform(jnt1,tform);
body1.Joint = jnt1;
robot = rigidBodyTree;
% body1.Mass = .5;
% body1.CenterOfMass = [0.5 0 0];% p/r au centre du link selon (x,y,z)
% body1.Inertia = [0.167 0.001 0.167 0 0 0];
%
addBody(robot,body1,'base')
body2 = rigidBody('body2');
jnt2 = rigidBodyJoint('jnt2','revolute');
jnt2.HomePosition = pi/6; % User defined
tform2 = dh2homogene(dh(2,:)); % User defined
setFixedTransform(jnt2,tform2);
body2.Joint = jnt2;% body2.Mass = .585;
% body2.CenterOfMass = [0 0 0];% p/r au centre du link selon (x,y,z)
% body2.Inertia = 0.0001*[4 4 4 0 0 0];
addBody(robot,body2,'body1'); % Add body2 to body1
body3 = rigidBody('body3');
body4 = rigidBody('body4');
jnt3 = rigidBodyJoint('jnt3','revolute');
jnt4 = rigidBodyJoint('jnt4','revolute');
tform3 = dh2homogene(dh(3,:)); % User defined
tform4 = dh2homogene(dh(4,:)); % User defined
setFixedTransform(jnt3,tform3);
setFixedTransform(jnt4,tform4);
jnt3.HomePosition = 0; % User defined
body3.Joint = jnt3;
body4.Joint = jnt4;
% % adding dynamics props
%
%
% body3.Mass = .55;
% body3.CenterOfMass = [0 0 0];% p/r au centre du link selon (x,y,z)
% body3.Inertia = 0.0001*[4 4 4 0 0 0];
%
% body4.Mass = .032;
% body4.CenterOfMass = [0 0 0];% p/r au centre du link selon (x,y,z)
% body4.Inertia = 0.0001*[4 4 4 0 0 0];
addBody(robot,body3,'body2'); % Add body3 to body2
addBody(robot,body4,'body3'); % Add body4 to body3
bodyEndEffector = rigidBody('endeffector');
tform5 = trvec2tform([0, 0, 0]); % User defined
setFixedTransform(bodyEndEffector.Joint,tform5);
addBody(robot,bodyEndEffector,'body4');
config = homeConfiguration(robot);
% tform = getTransform(robot,config,'endeffector','base');
% save('robot')
show(robot)

采纳的回答

Sebastian Castro
Sebastian Castro 2019-11-12
Maybe the frames have a default size that is much smaller than the robot. If you divide the distance values of the DH parameters by say 1000, do the frames show up?
- Sebastian

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Manipulator Modeling 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by