Ask Your Question

publisher code in arduino is not the same as the one in ubuntu

asked 2017-01-06 21:30:18 -0500

shawnysh gravatar image

Here are the links to official tutorial:

publisher example code with rosserial_arduino

publisher example code in ubuntu

The examples are different from each other with regard to publisher. I am curious about why ?

Is publisher in arduino using C libraries of ROS instead of those of C++, in order to save more storage for arduino board?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-07 00:52:06 -0500

ahendrix gravatar image

In short, the rosserial libraries are completely different from the roscpp libraries that run on Linux.

The API is optimized to save space and avoid copying messages, because the Arduino has so little memory. Even small messages can take upwards of 100 bytes, and on a processor such as the AtMega 168 or 328 that only has 1k or 2k of memory, that is a significant percentage of the overall system memory.

The API is also optimized to avoid memory allocations (calls to malloc or new), because memory allocation on embedded platforms such as the Arduino is generally a bad idea (memory leaks are more likely to crash your program, overwrite your stack, or there simply isn't an allocator at all!)

rosserial_arduino is optimized to work over a serial cable, so the protocol is slightly different, and the API setup is designed around using a serial port instead of supplying a node name.

edit flag offensive delete link more


I sorry for replying late, very detailed answer!Thanks a lot. I have heard from someone who claimed that the rosserial API document have not been documented completely, it is right? Where can I find it?

shawnysh gravatar image shawnysh  ( 2017-01-08 19:56:22 -0500 )edit

and the API setup is designed around using a serial port instead of supplying a node name. Did you mean that the rqt_graph for the node in rosserial_arduino is shown as /serial_node ?

shawnysh gravatar image shawnysh  ( 2017-01-08 20:04:20 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-01-06 21:30:18 -0500

Seen: 74 times

Last updated: Jan 07 '17