Ask Your Question
1

interactivemarker processfeedback callback as a class method

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

Miguel Riem de Oliveira gravatar image

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

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
4

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

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 imageZiyangLI ( 2015-02-07 01:23:31 -0600 )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 imagevkee ( 2017-10-10 15:18:04 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 397 times

Last updated: Oct 04 '13