ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The tutorial (this one probably?) doesn't put an infinite while
in a constructor, nor in a callback. Callbacks should be short, deal with the msg. Not run an eventloop of their own. You're also running an eventloop ..
2 | No.2 Revision |
The tutorial (this one probably?) doesn't put an infinite while
in a constructor, nor in a callback. Callbacks should be short, deal with the msg. Not run an eventloop of their own. own.
You're also running an eventloop ..(while (ros::ok()) { ros::spinOnce() }
) inside another eventloop (ros::spin()
in your callback). You want to study carefully what the tutorial does. Note where ros::spin()
is called.
If you want to use a class, instantiate it in a main and run your eventloop in the main.