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

rosserial - port/baud parameters

asked 2013-04-14 13:09:50 -0500

paulbovbel gravatar image

updated 2014-08-09 12:19:29 -0500

Hello,

After having my arduino rosserial node break spontaneously after an update to rosserial, I narrowed down the reason to a change in serial_node.py.

My launch file parameters for baud rate and port would no longer get passed to serial_node.py correctly, making it default to ttyUSB0 and 57600 bps.

  <node pkg="rosserial_python" type="serial_node.py" name="serial_node" output="screen">
        <param name="~port" value="/dev/ttyACM0" />
        <param name="~baud" value="115200" />
  </node>

serial_node.py:

port_name = rospy.get_param('~port','/dev/ttyUSB0')
baud = int(rospy.get_param('~baud','57600'))
...
rospy.init_node("serial_node")

From my end, this is caused by serial_node.py trying to load these parameters before it initializes the node. Changing the node to initialize before loading parameters, the proper port/baud rate get passed to the node from the launch file.

No one else seems to have noticed this problem, is there a more obvious reason why my launch file parameters are no longer working?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-04-15 17:26:16 -0500

PaulBouchier gravatar image

Mea Culpa. I'm sorry for any inconvenience caused. I struggled to find out what that get_param(~port.... syntax meant, and the most tantalizing clue was at http://www.ros.org/wiki/rospy_tutorials/Tutorials/Parameters which talks about parameters in a private namespace. This page http://www.ros.org/wiki/Names also talks about private names being useful for passing parameters from a server, but nowhere did I find a connection to launch files, or a requirement that init_node has to be called before private namespaces work - the global namespace works fine before init_node and I tried but failed to get private namespaces to work, and thought it was just broken. Seems there's an opportunity for a wiki page improvement here. Anyways - enough excuses - trying to find a solution.

Paul

edit flag offensive delete link more

Comments

Fixed & checked into repo as issue #46. I tested launch file manipulation of private parameters & it worked like it should. Thank you for showing me how that's supposed to be done.

PaulBouchier gravatar image PaulBouchier  ( 2013-04-18 03:59:04 -0500 )edit
1

answered 2013-04-14 16:42:09 -0500

fergs gravatar image

Yup, looks like this was broken when the rosserial_embeddedlinux stuff got merged in. I'm guessing it hasn't been noticed because people have just been using default params. I opened a ticket here: https://github.com/ros-drivers/rosserial/issues/43

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-04-14 13:09:50 -0500

Seen: 3,394 times

Last updated: Aug 09 '14