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

There might be a smarter way...

The easiest way to overcome this is to run two serial_node.py nodes listening on two different ports. You have to rename one of them, to avoid namespace collisions.

At the command line:

[in terminal 1] rosrun rosserial_python serial_node.py tcp 11411 __name:=server_one
[in terminal 2] rosrun rosserial_python serial_node.py tcp 11412 __name:=server_two

You can verify the renaming worked correctly with: rosnode list

You can also do this in a launch file:

<node pkg="rosserial_python" type="serial_node.py" name="server_one" output="screen" args="tcp 11411">
    <param name="port" value="tcp" />
</node>

<node pkg="rosserial_python" type="serial_node.py" name="server_two" output="screen" args="tcp 11412">
    <param name="port" value="tcp" />
</node>

In either case, you need to make sure your rosserial applications are conneting to the correct port.

node_handle::initNode() will accept either an IP address or an IP address and a port number. In this case, then we would initialise one rosserial application with HOST_IP:11411 and the other with HOST_IP:11412. For example:

nh_.initNode("192.168.0.1:11411");

There might be a smarter way...

The easiest way I have found to overcome this is to run two serial_node.py nodes listening on two different ports. You have to rename one of them, to avoid namespace collisions.

At the command line:

[in terminal 1] rosrun rosserial_python serial_node.py tcp 11411 __name:=server_one
[in terminal 2] rosrun rosserial_python serial_node.py tcp 11412 __name:=server_two

You can verify the renaming worked correctly with: rosnode list

You can also do this in a launch file:

<node pkg="rosserial_python" type="serial_node.py" name="server_one" output="screen" args="tcp 11411">
    <param name="port" value="tcp" />
</node>

<node pkg="rosserial_python" type="serial_node.py" name="server_two" output="screen" args="tcp 11412">
    <param name="port" value="tcp" />
</node>

In either case, you need to make sure your rosserial applications are conneting to the correct port.

node_handle::initNode() will accept either an IP address or an IP address and a port number. In this case, then we would initialise one rosserial application with HOST_IP:11411 and the other with HOST_IP:11412. For example:

nh_.initNode("192.168.0.1:11411");