robot toolbox rigidBodyTree function

18 views (last 30 days)
Matthew Koithan
Matthew Koithan on 2 Jun 2020
Answered: Cam Salzberger on 2 Jun 2020
I am trying to get started with the robot toolbox. I am getting this error when using the rigidBodyTree function.
Undefined function or variable 'rigidBodyTree'.
Error in DIYbotcode (line 4)
robot = rigidBodyTree('Dataformat','column','MaxNumbodies',3);
So far I have tried unistalling the robot toolbox add on, turning on and off my computer, and updating Matlab. Here is the code that I am running. I am using This as my template https://www.mathworks.com/help/robotics/ug/2d-inverse-kinematics-example.html.
%DIY robot rigidbody%
%start with blank tree model%
robot = rigidBodyTree('Dataformat','column','MaxNumbodies',3);
%specigy arm lengths%
L1 = 4.75;
L2 = 6.66;
%L3 = 1.5;
%add link1 and joint1%
body = rigidBody('link1');
joint = rigidBodyJoint('joint1','revolute');
setFixedTransformation(joint,trvec2tform([0 0 0]));
joint.JointAxis = [0 0 1];
body.joint = joint
addBody(robot. body, 'base');
%Add 'link2' body with 'joint2' joint%
body = rigidBody('link2');
joint = rigidBodyJoint('joint2','revolute');
setFixedTransform(joint, trvec2tform([L1,0,0]));
joint.JointAxis = [0 0 1];
body.Joint = joint;
addBody(robot, body, 'link1');

Answers (1)

Cam Salzberger
Cam Salzberger on 2 Jun 2020
Matthew,
One thing to check is which version of MATLAB you have. rigidBodyTree was introduced in R2016b.
Another is to make sure you are installing MathWorks' Robotics System Toolbox, not Peter Corke's Robotics Toolbox. rigidBodyTree is only in the Robotics System Toolbox.
Finally, you can try running these commands to reset the MATLAB Search Path to the default value:
restoredefaultpath
rehash toolboxcache
If that fixes the issue, you can save this for future sessions with:
savepath
-Cam

Categories

Find more on Robotics System Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!