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

I came across this problem too. In my case, it was because I did not use spinOnce() function to let ROS have a chance to take control so that rosserial_arduino can make contact with arduino.

At first, I supposed I just wrote a publisher so that I did not need to use spinOnce() function at all, but it was wrong. Now I know why the official tutorial for writing a publisherl says this:

> Calling ros::spinOnce() here is not necessary for this simple program, because we are not receiving any callbacks. However, if you were to add a subscription into this application, and did not have ros::spinOnce() here, your callbacks would never get called. So, add it for good measure.

I came across this problem too. In my case, it was because I did not use spinOnce() function to let ROS have a chance to take control so that rosserial_arduino can make contact with arduino.

At first, I supposed I just wrote a publisher so that I did not need to use spinOnce() function at all, but it was wrong. Now I know why the official tutorial for writing a publisherl says this:

> Calling ros::spinOnce() here is not necessary for this simple program, because we are not receiving any callbacks. However, if you were to add a subscription into this application, and did not have ros::spinOnce() here, your callbacks would never get called. So, add it for good measure.