Change frame size in show(rigidbodyTree)

18 views (last 30 days)
Brian Bock
Brian Bock on 12 Dec 2019
Commented: Pete on 7 Mar 2021
I'm working with a rigid body tree robot in MATLAB. The robot is fully built out using the steps outline here: https://www.mathworks.com/help/robotics/ug/build-a-robot-step-by-step.html. When I use:
show(robot)
I get a figure window with the robot. I'd like to change the thickness of the lines (if possible), or at minimum increase the size of the joint frames (which are so small that they are only visible if you zoom very close to the robot).
untitled.jpg
tinyframe.jpg

Answers (2)

Cam Salzberger
Cam Salzberger on 16 Dec 2019
Hello Brian,
If you don't have a mesh model to show on the robot, and only have the body lines, I believe you can get access to the line objects. If you get a return value from the show function, it will return the axes object. If you check through the 'Children' property of the axes, you should be able to determine which of them is the lines for the robot itself (not the coordinate frame or other annotations), and you could modify the properties there. I haven't tested this out, but this may get you started in direction.
-Cam

Payas Bahade
Payas Bahade on 26 Dec 2019
Hi Brian,
To change the line width of body frame, you can make use of axes handle returned by ‘show’ function as mentioned by Cam. Also, adding customized markers at body frame can help in making joints more prominent. I have written the below code for the same:
load exampleRobots.mat
config = homeConfiguration(puma1)
f1=show(puma1); %returning axes handle as f1
h=findall(f1); %finding all objects in figure
hlines=h.findobj('Type','Line'); %finding line object
%editing line object properties
n=size(hlines);
for i=1:n
hlines(i).LineWidth=2; %chanding line width
hlines(i).Color=[1 0 1];%changing line color
hlines(i).Marker='o';%changing marker type
hlines(i).MarkerSize=10; %changing marker size
end
You can customize the line properties as required by you. For more details on line properties, please refer this documentation link.
Hope this helps!
  1 Comment
Pete
Pete on 7 Mar 2021
Hi there,
the code you posted works perfectly to change the properties of the body lines!
But I can't figure out how to change the size of the actual frames, as Brian showed us in his illustration.
Do you have an idea how to manage that?
Sincerely

Sign in to comment.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!