Implementing a universal joint using the Rigid Body Tree Toolbox

3 views (last 30 days)
Hello,
I am implementing a robotic model using the Rigid Body Tree Toolbox. For the model, I need to implement a universal joint, which is not aviable in the toolbox. Is there a workaround for that. In the dokumentation they write: "To represent a single physical body with multiple joints or different axes of motion, use multiple RigidBody objects."
Any ideas?

Answers (1)

Jakob Kämpfer
Jakob Kämpfer on 3 Mar 2020
Hey Sheedii,
i wanted to do the same and actually the sentence of documentation you refered helped me to implement it. I wanted to create a body which has 6 degrees of freedom. 3 translation and 3 rotation. So principally you add a tree structure of six connected bodies and set all tranformation to identitiy matrices so that you refer alway to the first coordinate frame.
I hope this helps you!
% create new rigid body tree with row data format structure
extruder_asm = rigidBodyTree;
extruder_asm.DataFormat = 'row';
% create 3 bodies for translation X, Y and Z
extruder_x = rigidBody('extruder_x');
extruder_y = rigidBody('extruder_y');
extruder_z = rigidBody('extruder_z');
% create 3 bodies for rotation A, B, C
extruder_a = rigidBody('extruder_a');
extruder_b = rigidBody('extruder_b');
extruder_c = rigidBody('extruder_c');
% create 3 prismatic joints for translation X, Y and Z
trans_x = rigidBodyJoint('trans_x','prismatic');
trans_y = rigidBodyJoint('trans_y','prismatic');
trans_z = rigidBodyJoint('trans_z','prismatic');
% create 3 revolute joints for rotation A, B, C
rot_a = rigidBodyJoint('rot_a','revolute');
rot_b = rigidBodyJoint('rot_b','revolute');
rot_c = rigidBodyJoint('rot_c','revolute');
% define translation direction X, Y, Z
trans_x.JointAxis = [1 0 0];
trans_y.JointAxis = [0 1 0];
trans_z.JointAxis = [0 0 1];
% define rotation direction A, B, C
rot_a.JointAxis = [1 0 0];
rot_b.JointAxis = [0 1 0];
rot_c.JointAxis = [0 0 1];
% connect joints to refering bodies
extruder_x.Joint = trans_x;
extruder_y.Joint = trans_y;
extruder_z.Joint = trans_z;
extruder_a.Joint = rot_a;
extruder_b.Joint = rot_b;
extruder_c.Joint = rot_c;
% add visual stl to the last rigid body in the rigid body tree structure
addVisual(extruder_c,"Mesh",'extruder_simple.STL')
% connect bodies to rigid
addBody(extruder_asm,extruder_x,'base')
addBody(extruder_asm,extruder_y,'extruder_x')
addBody(extruder_asm,extruder_z,'extruder_y')
addBody(extruder_asm,extruder_a,'extruder_z')
addBody(extruder_asm,extruder_b,'extruder_a')
addBody(extruder_asm,extruder_c,'extruder_b')
%% visualize extruder in defined position and orientation
show(extruder_asm,[0 0 0 0.2 0.4 0],'visuals','on','frames','off')
view(0,0)
camproj('orthographic')
  2 Comments
Jaeho Cha
Jaeho Cha on 20 Mar 2020
hallo Herr Kämpfer
ich vermute durch Ihres Name, dass Sie Deutsche oder Östreiche sind.
wenn nicht , frage ich Ihnen wieder auf Englisch natürlich, wenn Sie eine Zeit für meine Frage haben.
ích habe 2 verschinende RigidBodytree mit 2 Verschiende URDF Daten . aber ich will die durch Matlab verbienden nicht durch die Abänderung der URDF Files.
Wenn Sie darüber etwas hilfreiche Befehle kennen oder Idee haben, könnten Sie auf meine Frage antworten.
vielen dank !
ElGhali Asri
ElGhali Asri on 5 Mar 2022
Hi Jaheo,
I translated your text to understand.
If you import rigid body tree models from URDF file into Matlab you can manipulate them and attach one to another by using rigid body functions.
"subtree" allows you to create a new rigid body tree from another one given the root body. And "addSubtree" allows to attach a whole subtree into a different rigid body tree model. You can also check out "replaceBody" and "replaceJoint" to help you manipulate your two robots after you import them on Matlab.
Below a link to the subtree function documentation.
I hope this helps.
Best,
El Ghali.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!