ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The first answer to Significance of ros::spinOnce() will probably help you.
2 | No.2 Revision |
The first answer to Significance of ros::spinOnce() will probably help you.you. Also: roscpp/Overview/Callbacks and Spinning from roscpp
.
3 | No.3 Revision |
The first answer to Significance of ros::spinOnce() will probably help you. Also: roscpp/Overview/Callbacks and Spinning from roscpp
.
Edit:
int main(int argc, char** argv)
{
...
ros::spin();
return 0;
}
The ros::spin()
will never return, and is probably why your other callbacks aren't being serviced. As you can read in the Significance of ros::spinOnce() answer, replacing it with something like:
int main(int argc, char** argv)
{
...
while (ros::ok() && smart_ray_ok())
{
// let the smart ray event loop do its thing
process_smart_ray_events()
// let ros do its things
ros::spinOnce();
}
Will give the smart ray SDK a chance to process its incoming data (and call the registered UserCB).
As I have no experience with that particular SDK, I cannot say what process_smart_ray_events()
should really be, that is something you'll have to figure out yourself.
4 | No.4 Revision |
The first answer to Significance of ros::spinOnce() will probably help you. Also: roscpp/Overview/Callbacks and Spinning from roscpp
.
Edit:
int main(int argc, char** argv)
{
...
ros::spin();
return 0;
}
The ros::spin()
will never return, and is probably why your other callbacks aren't being serviced. As you can read in the Significance of ros::spinOnce() answer, replacing it with something like:
int main(int argc, char** argv)
{
...
while (ros::ok() && smart_ray_ok())
{
// let the smart ray event loop do its thing
process_smart_ray_events()
// let ros do its things
ros::spinOnce();
}
Will give the smart ray SDK a chance to process its incoming data (and call the registered UserCB).
As I have no experience with that particular SDK, I cannot say what process_smart_ray_events()
should really be, that is something you'll have to figure out yourself.
As an alternative to the above, you could use an AsyncSpinner
, which would remove the need for the while
loop and the ros::spinOnce()
. See the linked roscpp/Overview/Callbacks and Spinning page for more information on that.
5 | No.5 Revision |
The first answer to Significance of ros::spinOnce() will probably help you. Also: roscpp/Overview/Callbacks and Spinning from roscpp
.
Edit:
int main(int argc, char** argv)
{
...
ros::spin();
return 0;
}
The ros::spin()
will never return, and is probably why your other callbacks aren't being serviced. As you can read in the Significance of ros::spinOnce() answer, replacing it with something like:
int main(int argc, char** argv)
{
...
while (ros::ok() && smart_ray_ok())
{
// let the smart ray event loop do its thing
process_smart_ray_events()
// let ros do its things
ros::spinOnce();
}
Will give the smart ray SDK a chance to process its incoming data (and call the registered UserCB).
As I have no experience with that particular SDK, I cannot say what smart_ray_ok()
and process_smart_ray_events()
should really be, be (or if they even exist), that is something you'll have to figure out yourself.
As an alternative to the above, you could use an AsyncSpinner
, which would remove the need for the while
loop and the ros::spinOnce()
. See the linked roscpp/Overview/Callbacks and Spinning page for more information on that.
6 | No.6 Revision |
The first answer to Significance of ros::spinOnce() will probably help you. Also: roscpp/Overview/Callbacks and Spinning from roscpp
.
Edit:
int main(int argc, char** argv)
{
...
ros::spin();
return 0;
}
The ros::spin()
will never return, and is probably why your other callbacks aren't being serviced. As you can read in the Significance of ros::spinOnce() answer, replacing it with something like:
int main(int argc, char** argv)
{
...
ros::Rate loop_rate(10);
while (ros::ok() && smart_ray_ok())
{
// let the smart ray event loop do its thing
process_smart_ray_events()
// let ros do its things
ros::spinOnce();
// sleep some (only if needed)
loop_rate.sleep();
}
Will give the smart ray SDK a chance to process its incoming data (and call the registered UserCB).
As I have no experience with that particular SDK, I cannot say what smart_ray_ok()
and process_smart_ray_events()
should really be (or if they even exist), that is something you'll have to figure out yourself.
As an alternative to the above, you could use an AsyncSpinner
, which would remove the need for the while
loop and the ros::spinOnce()
. See the linked roscpp/Overview/Callbacks and Spinning page for more information on that.