ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

rosserial with 2 arduino

asked 2020-01-09 10:50:23 -0500

drtritm gravatar image

Hi every one. I have a problem when interfacing raspberry pi with two arduino through rosserial_python, when I connect to the second arduino after the first one succeeded,the first terminal will say : **shutdown request: new node registered with same name** i search and find the solution like include parameter _name after the rosrun command, but it's not worked for me.please help me. thank you and sorry for my english

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2020-01-09 16:13:02 -0500

Marvin gravatar image

updated 2020-01-19 04:16:07 -0500

You cannot have 2 or more nodes with the same name. So you need to change the name of one of your rosserial nodes, eg:

rosrun rosserial_python serial_node.py __name:="node2" ... etc

Note the double underscore preceding name.

Or, as suggested, using a launch file:

<launch>
<!-- Launch 2 Arduino boards -->

    <node
        pkg="rosserial_python"
        type="serial_node.py"
        name="ArduinoOne"
        args="/dev/ttyACM0"
    ></node>

    <node
        pkg="rosserial_python"
        type="serial_node.py"
        name="ArduinoTwo"
        args="/dev/ttyACM1"
    ></node>
</launch>

The above requires the Arduino boards to be /dev/ttyACM0 and /dev/ttyACM1. This can be avoided by using udev rules to give each board a unique symbolic name, eg:

<launch>
<!-- Launch the Arduino Board with Adafruit 9-DOF IMU -->

<node
    pkg="rosserial_python"
    type="serial_node.py"
    name="arduino_imu_9dof"
    args="/dev/elegooOne"
    respawn="true"
></node>

</launch>

So above we've given the Arduino board the symbolic name elegooOne. Larger Arduino boards, eg Uno, Mega, have a unique serial number that's good for udev rules.

edit flag offensive delete link more

Comments

Yes, i did it like i mentioned in the question, and it's not worked

drtritm gravatar image drtritm  ( 2020-01-12 09:23:25 -0500 )edit
1

When using rosrun try using the name argument with a double underscore to rename. Obviously, you can check, one at a time, that the nodes are being renamed as expected via rosnode list.

Marvin gravatar image Marvin  ( 2020-01-14 05:38:25 -0500 )edit
1

I would suggest to use a launch file instead. It's easier to edit, easier to start and was intended to be used to start multiple ROS nodes.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-14 10:08:47 -0500 )edit

thanks very much

drtritm gravatar image drtritm  ( 2020-01-17 02:59:22 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-01-09 10:50:23 -0500

Seen: 1,232 times

Last updated: Jan 19 '20