Robotics StackExchange | Archived questions

how to use callback funtions with out using static key word in Ros with c++

Hi,

how to use callback funtions with out using static key word in Ros with c++

Thanks

Asked by can-43811 on 2017-04-05 20:22:40 UTC

Comments

You have not given many details, but I think making the callback function be inside a class and using member variables of that same class will allow you to store values from messages in a persistent way. If that is not what you're looking for then please edit your question to provide more details.

Asked by Thomas D on 2017-04-05 21:39:55 UTC

post the relevant code you have, you normally dont need any static reference to implement a callback!

Asked by ΦXocę 웃 Пepeúpa ツ on 2017-04-06 00:16:37 UTC

Answers

Hello,

I understand what you mean, try this :

ros::NodeHandle n; 
ros::Subscriber sub;

sub = n.subscribe("yournode", 1, &YourPlugin::Callback, this);  

You wont need static method using it like that ( usable with a class )

Asked by shenki on 2017-04-06 04:56:52 UTC

Comments