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

Be sure that you have enough free memory on the Arduino side. I have abandoned trying to use rosserial_arduino on small-memory MCUs (2kb) because it was too unstable. The Arduino IDE will show you how much free memory you have after compiling. I found the system to be unstable with less than about 700 bytes free. rosserial uses quite a bit of static memory for buffers and message type names. You might try reducing the number of publishers and subscribers, or reduce the size of the input and output buffers. You can control all the sizes by using the internal NodeHandle_ type instead of NodeHandle:

 ros::NodeHandle_<ArduinoHardware, 3, 2, 200, 150> nh;

Here, the node handle is set up to have up to 3 subscribers, up to 2 publishers, an input buffer size of 200, and an output buffer size of 150. (The defaults are 25, 25, If you're running out of memory, you mi

Be sure that you have enough free memory on the Arduino side. I have abandoned trying to use rosserial_arduino on small-memory MCUs (2kb) because it was too unstable. The Arduino IDE will show you how much free memory you have after compiling. I found the system to be unstable with less than about 700 bytes free. rosserial uses quite a bit of static memory for buffers and message type names. You might try reducing the number of publishers and subscribers, or reduce the size of the input and output buffers. You can control all the sizes by using the internal NodeHandle_ type instead of NodeHandle:

 ros::NodeHandle_<ArduinoHardware, 3, 2, 200, 150> nh;

Here, the node handle is set up to have up to 3 subscribers, up to 2 publishers, an input buffer size of 200, and an output buffer size of 150. (The defaults are 25, 25, 512, and 512, respectively, which uses up a lot of the RAM on a 2kb Arduino.)

If you're running out of memory, you mimight try ros_arduino_bridge. A different approach, less ROS-like on the Arduino side, but much less memory usage.