Class callbacks unable to access member variables? [closed]

asked 2012-11-22 16:57:43 -0500

Ammar gravatar image

Hello All, I have a subscriber with a callback to a class function. I initialize the subscriber in the constructor of the class:

odom_sub = nhr.subscribe("/"+robot_name+"/odom", 100, &robot::odom_callback, this);

Now the odom_callback function is called fine, however I cannot access robot_name in the function. robot_name is supposed to be a public variable in the same class. Could someone please tell me how I could access it? Thanks Ammar

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-08-31 20:35:53.456013

Comments

2

Please show some code, otherwise it's not easy to figure out what's going on

Saphrosit gravatar image Saphrosit  ( 2012-11-22 19:47:58 -0500 )edit
1

@Ammar, please read and follow the support guidelines to save your and our time. To help, we need to see at least your code and the error message you get.

Lorenz gravatar image Lorenz  ( 2012-11-22 20:30:26 -0500 )edit