Is it possible to toggle the visibility of 'some' frames when using rigidBodyTree?
10 views (last 30 days)
Show older comments
Kartikeya Walia
on 20 Jul 2021
Edited: Kartikeya Walia
on 2 Aug 2021
Since a rigidBodyTree has several kinds of joints, when using show(robot) it shows the frames for fixed joints as well.
Is it possible to hide some frames programmatically?
I am aware that 'Frames','off' arrtibute can be used to hide all frames.
To be specific I just want to hide the fixed frames but still want the revolute ones to be visible.
Thanks in advance
0 Comments
Accepted Answer
Hannes Daepp
on 30 Jul 2021
Hi Kartikeya,
The frames are patch objects, so as long as you can get the handles to these objects, you can enable and disable their visibility (what the "Frames" name-value argument is doing in bulk).
For example, suppose we show one of the built-in RigidBodyTree objects. For convenience, assume the visuals are already not shown, though this doesn't matter:
robot = loadrobot("abbIrb120");
show(robot,"Visuals","off");
>> allPatches = findall(gcf, "Type", "Patch")
allPatches =
16×1 Patch array:
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
You'll note that in the above example, all the patches are associated with a tag. This tag is unique to each rigidBodyTree.show command and specifies that these patch objects are affiliated with the rigid body tree object. If your figure contains more patches than those affiliated with the tree, you can limit selections by specifying that tag as part of the findall command:
allPatches = findall(gcf, "Type", "Patch", "Tag", "DO_NOT_EDIT_UwdU6")
Now all you need to do is figure out which of these patches is associated with the frame you'd like to disable, and turn it off. You can iterate over the list of patches and check if setting visibility off removes the patch from the corresponding figure. For example, the following call clearly removes the frame associated with link_4 located at the 90 degree angle:
allPatches(11).Visible='off'
If your rigid body tree object is the only item in the figure and the visuals are already off, an easy way to get this list is to reduce the scope of patches to those with visibility off.
visiblePatches =
9×1 Patch array:
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
Patch (DO_NOT_EDIT_UwdU6)
The list above corresponds to the list of frame patches.
More Answers (0)
See Also
Categories
Find more on Manipulator Modeling 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!