Forward kinematics and inverse kinematics
14 views (last 30 days)
Show older comments
if i have this following dh parameter how can i draw the robot using matlab ?
Answers (1)
Aastav Sen
on 28 May 2020
As an example, take a look at the following:
(the DH parameters are different, but procedure for creating and showing the final robot as a rigidbodyTree is the same)
Lets say (for a 3DOF robot with 4 bodies (final body being a fixed tool)...
The arrangement for creating a rigidbodyTree with DH parameters is <a, alpha, d, theta> (unlike your table which is <theta, alpha, a, d> (just rearrange it).
% cols: a, alpha, d, theta
dhparams = [0 pi/2 0 0;
0.65 0 0.156 0;
0.435 -pi/2 0.069 0;
0 0 0 1];
% create rigidbody tree
myrobot = rigidBodyTree('MaxNumBodies', 4, 'Dataformat', 'col');
% add first link
body1 = rigidBody('body1');
jnt1 = rigidBodyJoint('jnt1','revolute');
jnt1.PositionLimits = [-1.01 +0.26]; % this is additional...
jnt1.HomePosition = 0.0;
dhparams(1,:) % this is the row corresponding to link 1 (in DH)
% this is how you use the corresponding DH row
% to define a fixed transform between rigidbodies
setFixedTransform(jnt1,dhparams(1,:),'dh');
body1.Joint = jnt1;
body1.Mass = 0.5;
% NOTE: inertial components also optional for simply
% showing the final robot
body1.CenterOfMass = [0 0 0];
body1.Inertia = [1 1 1 0 0 0];
addBody(myrobot,body1,'base')
% add the rest of the bodies
body2 = rigidBody('body2');
jnt2 = rigidBodyJoint('jnt2','revolute');
jnt2.PositionLimits = [-0.96 +0.96];
jnt2.HomePosition = 0.0;
body3 = rigidBody('body3');
jnt3 = rigidBodyJoint('jnt3','revolute');
jnt3.PositionLimits = [+0.40 +2.84];
jnt3.HomePosition = 0.5;
tool = rigidBody('tool');
jnt_ee = rigidBodyJoint('jnt_ee', 'fixed');
% add the rest of the transforms betwn the bodies
setFixedTransform(jnt2,dhparams(2,:),'dh');
setFixedTransform(jnt3,dhparams(3,:),'dh');
setFixedTransform(jnt_ee,dhparams(4,:),'dh');
body2.Joint = jnt2;
body3.Joint = jnt3;
tool.Joint = jnt_ee;
body2.Mass = 1.0;
body2.CenterOfMass = [0.325 0 0];
body2.Inertia = [1 1 1 0 0 0];
body3.Mass = 1.0;
body3.CenterOfMass = [0.2175 0 0];
body3.Inertia = [1 1 1 0 0 0];
tool.Mass = 0.01;
tool.CenterOfMass = [0 0 0];
tool.Inertia = [1 1 1 0 0 0];
addBody(myrobot,body2,'body1')
addBody(myrobot,body3,'body2')
addBody(myrobot,tool,'body3')
And to finally draw the robot in a 3D figure:
% verify that the myrobot was built correctly
showdetails(myrobot)
% and set the home configuration...
Happy coding.
1 Comment
RoBoTBoY
on 14 Jun 2020
Dear, I have these successive transformations that appear in the attached file jpg. I have found the kinematic chain A07 with matlab but the final 4x4 matrix is too big.
How do I find the inverse kinematics from these transformations where q_1 q_2 q_4 are active, q_3 = q_5 = q_7 = 0 and q_6 = 0.75(rad)?
Also, how do I find the pseudoinverse of the Jacobian where here all joints are active?
Thanks in advance
See Also
Categories
Find more on Robotics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!