ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Multiple robots' Arduinos connected to same roscore through rosserial server

asked 2020-12-09 19:31:39 -0500

simon_peg gravatar image

Dear all,

I am currently working on a project developing a system containing 8 mobile robots which all must communicate over the same ROS master. The robots all have a Teensy 3.5 which performs motor and on-board LED control as well as listen to some simple detector switch sensors with a controlled loop time of 20ms. The Teensys are connected to their host robot's Raspberry Pi 3B+ via a wired connection through the hardware UART as is necessary for rosserial connections with Teensy boards. As is needed for the project, the robots all subscribe to the same ROS topics as one another (in both the code aboard the Teensy as well as a few nodes run on the Pi), but only one robot will "react" and perform the actions if needed through some relatively simple status control communicated over a ROS topic and through python codes run on the Pis which perform the higher-level tasks.

I have been using rosserial_python to establish my rosserial connection between the Teensy and the Pi, however am experiencing many rosserial disconnects, namely "Lost sync with device, restarting...". Sometimes the robot is able to re-establish the rosserial connection, able to recover and continue to operate as needed, however sometimes one of or multiple of the robots will never automatically re-establish the rosserial connection and require a full upload of their Arduino code again before they can reconnect to the rosserial node which is not a possibility for this project.

From this, I have identified that rosserial_python is most likely the cause of the rosserial instability. Because of this, I have attempted to use rosserial_server instead, as this is said to be more robust. However, I am having issues running the rosserial_server launch file with multiple robots connected to the same roscore. To be clear, when running roslaunch rosserial_server serial.launch on one robot I am able to establish a rosserial connection and the robot operates how it should, however when running the launch file on a second robot, the launch file of the first robot is automatically closed. ie. the launch file closes with all processes on machine have died, roslaunch will exit. shutting down processing monitor...

Avoiding such an error was achievable in rosserial_python by simply changing the name of the node in the "" file, however doing similar in the files that the rosserial_server node uses is not stopping the launch file of the first robot from exiting. I have performed catkin_make after making changes to my serial_node files to ensure the changes are saved.

So, my question is: how can I use rosserial_server to establish rosserial connections between the Arduino and PC of multiple robots connected to the same roscore master?

I am using ROS kinetic version 1.12.14 and each of the Raspberry Pi's use Raspbian. The computer running roscore is a Linux Ubuntu 16.04 desktop PC.

Any help would be greatly appreciated.


edit retag flag offensive close merge delete


how can I use rosserial_server to establish rosserial connections between the Arduino and PC of multiple robots connected to the same roscore master?

somewhat off-topic, but important to clarify I believe: you are not setting up multiple robots to connect to the same roscore master.

The Master is not involved in communication between nodes, or at least, not in the actual communication. It only serves as a "phonebook" (or DNS if you are familiar with how that works).

The only job the Master has it to tell nodes where they can find others. After that, it just sits there.

See also wiki/Master.

gvdhoorn gravatar image gvdhoorn  ( 2020-12-12 07:27:53 -0500 )edit

Thank you, that is a much better explanation of what roscore actually does. I am intertwining performing communication and setting up the communications which, as you say, roscore is only really responsible for setting up communications.

simon_peg gravatar image simon_peg  ( 2020-12-13 18:20:13 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-12-11 08:17:04 -0500

duck-development gravatar image

you have to write your own lauch script.

and you have to start every node in a seperate namespace

examl for rosserial lauchfile is

<node pkg="rosserial_server" type="serial_node" name="rosserial_server">
  port: /dev/arduino
    publishers: [ status ]
    subscribers: [ cmd, lights ]
<node pkg="rosserial_python" type=""
    name="rosserial_message_info" />

and namespace handling you can read hear, with multible robots

see the aceepted answer

edit flag offensive delete link more


Thank you very much for your response! I will look into doing this ASAP.

simon_peg gravatar image simon_peg  ( 2020-12-13 18:01:50 -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


Asked: 2020-12-09 19:31:39 -0500

Seen: 280 times

Last updated: Dec 11 '20