0
$\begingroup$

Rosanswers logo

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


Originally posted by drtritm on ROS Answers with karma: 187 on 2020-01-09

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Marvin with karma: 91 on 2020-01-09

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by drtritm on 2020-01-12:
Yes, i did it like i mentioned in the question, and it's not worked

Comment by Marvin on 2020-01-14:
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.

Comment by gvdhoorn on 2020-01-14:
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.

Comment by drtritm on 2020-01-17:
thanks very much

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.