ROS 2 interactive marker menu not showing

asked 2021-10-27 16:50:05 -0600

Brulf gravatar image

Good evening,

Recently I have been working on an rviz plugin. In this plugin I instantiate an interactive marker server and I am able to display markers with 3 DoF. However, I would like to add a menu to all these markers, so I looked into the fairly outdated interactive_marker tutorials. So I tried implementing it in the following steps in a class context:

1. Instantiate the MenuHandler and assigning a callback

  menu_handler_ = interactive_markers::MenuHandler();
  entry_handle_ = menu_handler_.insert("Test item", std::bind(&LabelPanel::iMenuCallback, this, std::placeholders::_1));

2. Create a marker (just a custom function I wrote to return a simple marker) and apply it to to the menu_handler_

visualization_msgs::msg::InteractiveMarker marker = createMarker();

3. Insert the marker to the interactive marker server and apply the changes


However, this does not result in any menu showing when clicking/interacting with the interactive marker. My iMenuCallback definition is simply to log the event type message to the console, but it is never called for the MENU interaction mode. The cursor does change when hovering over the marker.

Finally, I create the marker as follows:

visualization_msgs::msg::InteractiveMarker marker;
marker.header.frame_id = "labeling_pointcloud"; = name;
marker.description = name;

visualization_msgs::msg::Marker box;
box.type = visualization_msgs::msg::Marker::CUBE;
box.color.r = 1.0;

visualization_msgs::msg::InteractiveMarkerControl control;
control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MENU;
control.always_visible = true;

marker.pose.position.x = 1.0

visualization_msgs::msg::InteractiveMarkerControl move_x; = "move_x";
move_x.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
move_x.orientation.x = 1;


return marker;

Am I missing a controls configuration on my marker object or is these something else wrong?

I am on: ROS2 Galactic on Ubuntu 20.04.3 LTS Focal Fossa with the latest versions of all packages

edit retag flag offensive close merge delete