0
$\begingroup$

Rosanswers logo

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 pkg="turtlebot_lipo" type="turtlebot_lipo_diag.py" name="turtlebot_lipo_diag">
  </node>

</launch>

**Things that I've tried / checked so far**
  1. I have added /home/doug/ros_workspace to ROS_PACKAGE_PATH in /etc/ros/setup.bash. This solved a problem that I had getting the turtlebot_lipo_diag.py node to start, so I know it is finding that. The rosserial_python stack does not live there anyway.

  2. If I do "ls -l /dev/ttyACM0" it shows that it is owned by group "dialout". I have already added users turtlebot and root to the dialout group (through "usermod -a -g dialout user).

I tried the other Arduino permissions tips also at this link.

  1. Still thinking that permissions may have been an issue, I tried editing the startup script in /usr/sbin/turtlebot-start, and made a copy of lipo.launch in /etc/ros/electric/ where the turtlebot.launch is executed from. I had changed the lines to start lipo.launch INSTEAD of turtlebot.launch, using MY user id where all the code seemed to work.
if [ -s /etc/ros/electric/turtlebot.launch ]; then
    setuidgid doug roslaunch /etc/ros/electric/lipo.launch
else
    setuidgid doug roslaunch turtlebot_lipo lipo.launch
fi

When I reboot, or type "service turtlebot stop", "service turtlebot start", I still get the signal_shutdown on the rosserial node, and the turtlebot_lipo_diag.py node executes.


**Thank you**

If you read all that and have any advice that can help solve this problem, I really do appreciate it. I've tried everything that I can think of. If you need any more info please let me know.

Thank you,
Doug


Originally posted by dougbot01 on ROS Answers with karma: 342 on 2012-07-13

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by dougbot01 with karma: 342 on 2012-07-15

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by dougbot01 on 2012-07-15:
I created a ticket for enhancement here, along with a recommended patch : https://kforge.ros.org/rosserial/trac/ticket/73

$\endgroup$

Your Answer

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