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

InteractiveMarker with multiple interaction modes?

asked 2013-02-23 08:36:49 -0500

updated 2014-01-28 17:15:22 -0500

ngrennan gravatar image

This seems like something that ought to be possible, but I'm not seeing how to do it. I am making interactive markers for display in rviz, and I would like to have both the BUTTON and MENU interaction modes for each marker. As far as I can tell, though, it is only possible to assign one interaction mode to one marker. Surely there must be a way to assign multiple modes to a single marker? Does anyone have any suggestions? I am on Ubuntu 12.04 with ROS Groovy.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-02-23 09:22:49 -0500

dgossow gravatar image

Button controls can have a right-click menu assigned to them, like all other types of controls except for NONE.

edit flag offensive delete link more

Comments

Thanks for the reply. Can you point me to some documentation for how to do that?

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2013-02-23 09:26:35 -0500 )edit

Ah, thank you, that makes more sense. I had been looking at this page: http://www.ros.org/wiki/rviz/Tutorials/Interactive%20Markers%3A%20Basic%20Controls

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2013-02-23 09:35:54 -0500 )edit
1

answered 2016-07-25 06:42:38 -0500

user23fj239 gravatar image

updated 2016-07-25 06:44:57 -0500

Acutally the link the QA mentions has the right-click menu in line 266.

Overall your marker menu can be applied like:

//pointer to a dynamically allocated object server
  boost::shared_ptr < interactive_markers::InteractiveMarkerServer > server;
  server.reset(new
               interactive_markers::InteractiveMarkerServer
               ("interactive_markers", "", false));
  ros::Duration(0.1).sleep();   // wait till fully init.

  // apply right-click menu
  interactive_markers::MenuHandler menuHandler;
  menuHandler.insert("Start Steering", &processMarkerFeedback);// callback function
  menuHandler.insert("Stop Steering", &processMarkerFeedback);
  menuHandler.apply(*server, myMarker.name);// marker of any type

the callback function looks like line 123,

// The current marker postion is published as transform
// more feedback extraction on .../interactive_marker_tutorials/src/basic_controls.cpp
void processMarkerFeedback(const
                           vm::InteractiveMarkerFeedbackConstPtr & feedbackPtr)
{
  int eventType = feedbackPtr->event_type;
  std::string markerName = feedbackPtr->marker_name;
  if (eventType == 2 && feedbackPtr->mouse_point_valid) {        // MENU_SELECT
    ROS_INFO_STREAM("interactive_marker_node::processMarkerFeedback:" << markerName << " id:" << feedbackPtr->menu_entry_id);
  } else {}//... other eventTypes
}
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-23 08:36:49 -0500

Seen: 711 times

Last updated: Jul 25 '16