Class callbacks unable to access member variables? [closed]
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
Please show some code, otherwise it's not easy to figure out what's going on
@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.