Ask Your Question
1

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

asked 2017-04-05 20:22:40 -0500

can-43811 gravatar image

Hi,

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

Thanks

edit retag flag offensive close merge delete

Comments

1

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.

Thomas D gravatar imageThomas D ( 2017-04-05 21:39:55 -0500 )edit
1

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

ΦXocę 웃 Пepeúpa ツ gravatar imageΦXocę 웃 Пepeúpa ツ ( 2017-04-06 00:16:37 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2017-04-06 04:56:52 -0500

shenki gravatar image

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 )

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-04-05 20:22:40 -0500

Seen: 54 times

Last updated: Apr 06 '17