ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If I understand you're problem right, the answer is to use a class. The PID infinite loop is a member function of the class and the subscriber callback function is also a member function of the class. Then the desired speed is a member variable of the class which is set inside of the subscriber callback function every time your publisher sends out a desired speed.