ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
For a node, you don't need an extra thread. Within your main()
thread, in place of ros::spin()
, invoke ros::spinOnce()
in a loop. The rest of that loop can read UDP requests, or whatever you want.
while (!ros::shutdown()) {
ros:spinOnce();
// process UDP requests
}
Nodelets do need and extra thread for logic like this. I can explain how to do that too, if you are interested.
2 | No.2 Revision |
For a node, you don't need an extra thread. Within your main()
thread, in place of ros::spin()
, invoke ros::spinOnce()
in a loop. The rest of that loop can read UDP requests, or whatever you want.
while (!ros::shutdown()) (ros::ok()) {
ros:spinOnce();
// process UDP requests
}
Nodelets do need and extra thread for logic like this. I can explain how to do that too, if you are interested.