ros-industrial-consortium / CAD-to-ROS

GUI tools for ROS setup files starting with URDFs (Unmaintained)
Apache License 2.0
12 stars 9 forks source link

Allow showing & hiding links in the visualiser #36

Open gavanderhoorn opened 8 years ago

gavanderhoorn commented 8 years ago

Similar to how links may be hidden using the Robot State RViz plugin.

Should only affect display state, nothing more.

gavanderhoorn commented 8 years ago

It might make sense to make this a specialisation of a more generic link transparency display property.

Kukanani commented 8 years ago

My plan for this feature is to add a visibility checkbox in the urdf_builder property browser. When this checkbox changes value it updates the rviz RobotLink's "enabled" flag in the visualizer. This is equivalent to unchecking the box next to the link in the property browser when working in vanilla RViz.

as far as I can tell, Rviz's implementation of RobotState doesn't allow per-link transparency unless it is defined as part of the color in the URDF. Because the color should also theoretically be editable from urdf_builder, I think it's better to keep link transparency (alpha) and editor visibility separate.

Kukanani commented 8 years ago

Currently I'm unable to access the rviz::RobotLink directly. There is not an access function on the RobotStateVisualizationPtr moveit_rviz_plugin::RobotStateDisplay._robot variable, which I would need to get access to the individual links. My current implementation uses the hacky chain of accessors

rviz_widget_->getRobotDisplay()->subProp("Links")->subProp(link->name.c_str())->setValue(visibility)

Which is dependent on the RViz RobotState property structure staying intact. I can't see another way to do this short of adding functionality to moveit as described above. Please let me know if I should explore other options.

gavanderhoorn commented 8 years ago

@Kukanani: interacting with RViz plugins in this way is indeed tricky. The embedded RViz instance doesn't make it easier.

This is not something I've done myself in this way, so I cannot really guide you in this. Introducing this kind of coupling to the RobotStateDisplay is not something I'm too much of a fan of, but if it's the only feasible way of doing this ..

@Levi-Armstrong: did you have any particular reason to use the MoveIt RobotStateDisplay instead of the normal one? Was that to avoid the need for a TF publisher? Perhaps with #59, we could see if revising that decision would make @Kukanani's work easier?

Kukanani commented 8 years ago

I don't think changing the RobotStateDisplay would affect much, it is only used in a single function call. Take a look at the PR and see what you think. The only other consequence (besides linking to the RViz property structure) is having to update all the RViz visual pointers each time the robot model is loaded.