Prismatic joint moving in the wrong axis

Hello, I'm building a cylindrical manipulator robot which needs to be able to move vertically and horizontally through the use of prismatic joints. The vertical joint works just fine but when I run an inverse kinematics model, the horizontal joint moves vertically, even though its translation axis is oriented in the horizontal way.
The horizontal prismatic joint is jnt3.
robot = rigidBodyTree;
dhparams = [0,0,0,0; 0,0,0,0; 0,-pi/2,0,0; 0,-pi/2,.4,0; 0,pi/2,0,0; 0,0,.05,0];
body1 = rigidBody('body1');
jnt1 = rigidBodyJoint('jnt1','revolute');
jnt1.PositionLimits = [0 pi];
setFixedTransform(jnt1, dhparams(1,:),"dh");
body1.Joint = jnt1;
addBody(robot,body1,'base');
body2 = rigidBody('body2');
jnt2 = rigidBodyJoint('jnt2','prismatic');
jnt2.PositionLimits = [0,.40];
setFixedTransform(jnt2, dhparams(2,:),"dh");
body2.Joint = jnt2;
addBody(robot,body2,'body1')
body3 = rigidBody('body3');
jnt3 = rigidBodyJoint('jnt3','prismatic');
setFixedTransform(jnt3,dhparams(3,:),"dh");
jn3.PositionLimits = [0,.40];
body3.Joint = jnt3;
addBody(robot,body3,'body2')
%Spherical Wrist
body4 = rigidBody('body4');
jnt4 = rigidBodyJoint('jnt4','revolute');
setFixedTransform(jnt4,dhparams(4,:),"dh");
body4.Joint = jnt4;
addBody(robot,body4,'body3');
body5 = rigidBody('body5');
jnt5 = rigidBodyJoint('jnt5','revolute');
setFixedTransform(jnt5,dhparams(5,:),"dh");
body5.Joint = jnt5;
addBody(robot,body5,'body4');
endeffector = rigidBody('endeffector');
jnt6 = rigidBodyJoint('jnt6','revolute');
setFixedTransform(jnt6,dhparams(6,:),"dh");
endeffector.Joint = jnt6;
addBody(robot,endeffector,'body5');
pose = [1,0,0,.5;0,1,0,.5;0,0,1,.5;0,0,0,.5];
weights = [1 1 1 1 1 1];
initialguess = robot.homeConfiguration;
ik = robotics.InverseKinematics('RigidBodyTree', robot);
[configSol,solInfo] = ik('endeffector',pose,weights,initialguess)
show(robot,configSol)
axis([0,1.5,0,1.5,0,1.5])
axis on
figure
show(robot,homeConfiguration(robot))
axis([0,1.5,0,1.5,0,1.5])
axis on

Answers (0)

Products

Release

R2019b

Community Treasure Hunt

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

Start Hunting!