ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have always wondered if this is doable myself, so I just spent some time to figure it out. Turned out that InteractiveMarker requires not only the display, but also the 'tool' to enable interaction. The following code is developed based on your snippet.

  rviz::Display *obj_ = visualization_manager_->createDisplay( "rviz/InteractiveMarkers", "Obj Loader", true );
  obj_->subProp("Reference Frame")->setValue("base_link"); // This probably works by itself, I added the next line just in case
  visualization_manager_->setFixedFrame("base_link");
  obj_->subProp("Update Topic")->setValue("/basic_controls/update");
  obj_->initialize(visualization_manager_);
  obj_->setEnabled(true);

  rviz::ToolManager *tool_manager = visualization_manager_->getToolManager();
  tool_manager->initialize();
  rviz::Tool *interact_tool = tool_manager->addTool( "rviz/Interact" );
  tool_manager->setCurrentTool(interact_tool);
  ROS_ASSERT(obj_);

You will need to include rviz/tool_manager.h somewhere.