Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Class callbacks unable to access member variables?

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