Change frame size in show(rigidbodyTree)

14 次查看(过去 30 天)
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

回答(2 个)

Cam Salzberger
Cam Salzberger 2019-12-16
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 2019-12-26
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 个评论
Pete
Pete 2021-3-7
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Manipulator Modeling 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by