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

interactivemarker processfeedback callback as a class method

asked 2013-10-04 01:35:12 -0500

Miguel Riem de Oliveira gravatar image

updated 2014-01-28 17:18:08 -0500

ngrennan gravatar image

Hello

I wanted to make a class that contains an interactivemarker server

Something like this http://wiki.ros.org/rviz/Tutorials/Interactive%20Markers%3A%20Basic%20Controls

Problem is, I want to do this in a class. Thus I need to set the processFeedback callback as a class method.

I cannot compile the instruction

interactive_markers::InteractiveMarkerServer server->setCallback(int_marker.name, &ClassName::processFeedback);

or

interactive_markers::InteractiveMarkerServer server->setCallback(int_marker.name, &ClassName::processFeedback, this);

A similar issue for ros subscribers and service servers has been solved here http://wiki.ros.org/rviz/Tutorials/Interactive%20Markers%3A%20Basic%20Controls

Does anybody know of something similar for interactivemarker servers?

Thanks

Miguel

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2013-10-04 02:04:26 -0500

Miguel Riem de Oliveira gravatar image

I found the answers starting from here

http://answers.ros.org/question/11327/argument-for-subscriberstatuscallback-in-advertise/

... and reading a bit more about boost::bind

the solutions is to do:

interactive_markers::InteractiveMarkerServer server->setCallback(int_marker.name, boost::bind(&ClassName::processFeedback, this, _1));

regards

Miguel

edit flag offensive delete link more

Comments

Thank you so much for this answer!

ZiyangLI gravatar image ZiyangLI  ( 2015-02-07 01:23:31 -0500 )edit

How did you write your callback function? I followed that tutorial but for some reason it is just segfaults when the function is called.

vkee gravatar image vkee  ( 2017-10-10 15:18:04 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2013-10-04 01:35:12 -0500

Seen: 729 times

Last updated: Oct 04 '13