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

Problem adding rosserial node to turtlebot bringup

asked 2012-07-13 18:27:49 -0600

Hello All,

This is my first question to the list so please advise any etiquette that I may have overlooked regards to posts. Sorry about the length, but I figure more detail is better!

I am trying to add some hardware to my Turtlebot using an Arduino. I have created and tested my rosserial nodes and Arduino code, and everything is working. I have also added these nodes to a separate launch file, and when I call roslaunch on it, it runs without any issues from my user account.

The problem occurs when I try to get the rosserial node to start with all the other Turtlebot nodes by including my launch file in minimal.launch.


Platform

Ubuntu 11.10 Oneiric ROS Electric ros-electric-rosserial, 0.3.0-s1336605681~oneiric Arduino UNO (Rev 2 board) For reference, I had installed Ubuntu first, then ROS electric, then the turtlebot stacks.


Problem / Error

This is from the error log in /home/turtlebot/.ros/log/....../ As you can see, there is a signal_shutdown coming from somewhere that kills the node, however I am not touching anything and all other nodes live on.

[rospy.client][INFO] 2012-07-13 19:53:18,918: init_node, name[/rosserial_lipo], pid[17829]
[xmlrpc][INFO] 2012-07-13 19:53:18,919: XML-RPC server binding to 0.0.0.0
[rospy.init][INFO] 2012-07-13 19:53:18,920: ROS Slave URI: [http://192.168.4.1:59687/]
[xmlrpc][INFO] 2012-07-13 19:53:18,920: Started XML-RPC server [http://192.168.4.1:59687/]
[rospy.impl.masterslave][INFO] 2012-07-13 19:53:18,921: _ready: http://192.168.4.1:59687/
[xmlrpc][INFO] 2012-07-13 19:53:18,922: xml rpc node: starting XML-RPC server
[rospy.registration][INFO] 2012-07-13 19:53:18,925: Registering with master node http://localhost:11311
[rospy.init][INFO] 2012-07-13 19:53:19,021: registered with master
[rospy.rosout][INFO] 2012-07-13 19:53:19,109: initializing /rosout core topic
[rospy.rosout][INFO] 2012-07-13 19:53:19,121: connected to core topic /rosout
[rospy.simtime][INFO] 2012-07-13 19:53:19,125: /use_sim_time is not set, will not subscribe to simulated time [/clock] topic
[rosout][INFO] 2012-07-13 19:53:19,126: ROS Serial Python Node
[rosout][INFO] 2012-07-13 19:53:19,133: Connected on /dev/ttyACM0 at 57600 baud
[rospy.core][INFO] 2012-07-13 19:53:19,136: signal_shutdown [atexit]
[rospy.impl.masterslave][INFO] 2012-07-13 19:53:19,141: atexit


minimal.launch (in /opt/ros/electric/stacks/turtlebot/turtlebot_bringup)

In turtlebot_bringup package, I've edited minimal.launch to have the following. The "laptop battery" stuff has been pulled out since I am using a mini-PC instead of a netbook (I'm using Arduino as a LiPo voltage monitor).

  <!-- Turtlebot Laptop Battery Diagnostics -->
  <include file="$(find turtlebot_lipo)/lipo.launch" />


lipo.launch

This is the complete file. The launch file, as well as turtlebot_lipo_diag.py, live under /home/doug/ros_workspace/turtlebot_lipo/.

<launch>

  <!-- Turtlebot Laptop Battery Diagnostics -->
  <node pkg="rosserial_python" type="serial_node.py" name="rosserial_lipo" output="screen">
    <param name="~port" value="/dev/ttyACM0" />
    <param name="~baud" value="57600" />
  </node>
  <node ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-07-15 15:34:26 -0600

updated 2012-07-15 16:37:06 -0600

Well, as much as I dislike answering my own questions on such a site, since having other people's input gives a fresh perspective, I was able to eventually figure things out.

The main issue was that the user "turtlebot" did not have appropriate permissions to open /dev/ttyACM0. One part of the solution involved creating a file for my USB connection, as outlined in a previous post here: How can I get a unique device path for my Arduino/FTDI device

file name:
/etc/udev/rules.d/81-ftdi.rules

file contents:
SUBSYSTEMS=="usb", KERNEL=="ttyACM[0-9]*", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0001", ATTRS{serial}=="649383233313511011A0", SYMLINK+="uno_rev2", MODE="666", GROUP="turtlebot"

The critical parts that made it work for me are at the end, especially the part MODE="666", GROUP="turtlebot". This mounts the device as being owned by the turtlebot group, so the startup script has no problem connecting to it. Explanation of the remaining parts can be found in the link, except the "ARRTS{serial}" part that I picked up here.

Regards to how I figured out that it was a permission issue, when everything other resource said I should be fine, required diving into the rosserial_python code. I have some code enhancements and will file a bug report / feature request on the update. I has assumed that when ROS outputs this...

[rosout][INFO] 2012-07-13 19:53:19,133: Connected on /dev/ttyACM0 at 57600 baud 

...that it was actually connected. It turns out this statement is printed even before an attempt to open the port is made.

Another thing I had to do was make a small change to the launch file. Since the Arduino is apparently not ready when the launch comes up, I added respawn="true" to the rosserial_python node so it will keep trying until it is ready. I must find a way to set respawn frequency though since it currently is about 1Hz.

edit flag offensive delete link more

Comments

I created a ticket for enhancement here, along with a recommended patch : https://kforge.ros.org/rosserial/trac/ticket/73

dougbot01 gravatar image dougbot01  ( 2012-07-15 16:27:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-07-13 18:27:49 -0600

Seen: 1,774 times

Last updated: Jul 15 '12