0
$\begingroup$

Rosanswers logo

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.


Originally posted by Jeffrey Kane Johnson on ROS Answers with karma: 452 on 2013-02-23

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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


Originally posted by dgossow with karma: 1444 on 2013-02-23

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Jeffrey Kane Johnson on 2013-02-23:
Thanks for the reply. Can you point me to some documentation for how to do that?

Comment by dgossow on 2013-02-23:
There is a menu example in http://www.ros.org/wiki/rviz/Tutorials/Interactive%20Markers%3A%20Getting%20Started

Comment by Jeffrey Kane Johnson on 2013-02-23:
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

$\endgroup$
0
$\begingroup$

Rosanswers logo

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
}

Originally posted by user23fj239 with karma: 748 on 2016-07-25

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.