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

rosserial_arduino problem - won't generate ros_lib/ros directory

asked 2013-02-26 03:09:09 -0500

duffany1 gravatar image

updated 2013-02-27 11:15:25 -0500

Hi, I'm relatively new to ROS, and I'm using the catkin build system with ros-groovy. I am following the instructions on

https://github[dot]com/ros-drivers/rosserial (sorry, I can't post links)

in order to get rosserial for the arduino working. I followed all the steps in the readme. Specifically, I ran the following commands:

cd <ws>/src
git clone <https://github[dot]com/ros-drivers/rosserial>
cd <ws>
catkin_make install
source <ws>/install/setup.bash
cd <sketchbook>/libraries
rosrun rosserial_arduino .

and runs successfully (with no error messages). However, it does not generate the ros directory in the <sketchbook>/libraries/ros_lib folder. The consequence of this is that when my Arduino code attempts to load ros.h, the #include statement for ros/node_handle.h fails when I try to compile the "hello world" example in the Arduino IDE. Thus, I am unable to proceed further.

Here is the output of <sketchbook>/libraries/ros_lib$ ls after I run <sketchbook>/libraries/$ rosrun rosserial_arduino .:

actionlib            gazebo           roscpp             stereo_msgs
actionlib_msgs       gazebo_msgs      roscpp_tutorials   tests
actionlib_tutorials  gazebo_plugins   rosgraph_msgs      tf
ArduinoHardware.h    geometry_msgs    ros.h              tf2_msgs
base_local_planner   laser_assembler  rospy_tutorials    theora_image_transport
bond                 move_base_msgs   rosserial_arduino  topic_tools
cmr_drive            navfn            rosserial_msgs     trajectory_msgs
costmap_2d           nav_msgs         sensor_msgs        turtle_actionlib
diagnostic_msgs      nodelet          shape_msgs         turtlesim
driver_base          pcl              smach_msgs         visualization_msgs
dynamic_reconfigure  polled_camera    std_msgs
examples             robot_pose_ekf   std_srvs

Note: cmr_drive contains custom message files.

This is my second attempt to do this. I tried once and then started from scratch, because I figured I must have screwed something up. I even tried copying the ros directory from elsewhere on the hard drive (I think I may have taken it from the apt-get version of rosserial that I installed in addition to the git clone version) but then that caused a bunch of strange errors. Namely, when I ran the code, I got an error saying Failed to create subscriber: unpack requires a string argument of length 4.

I realize that this has not been fully updated for the catkin build system and ROS groovy (since I see references to rosmake in several of the tutorials) but like I said, I'm unable to use the code with the Arduino at this point and it would be awesome if you guys could help.

EDIT: Thanks for taking the time to respond, fergs. I'm using Ubuntu 12.04 as well, x64 version.

The contents of ros_lib/tf are FrameGraph.h and tfMessage.h. I think I see the significance of this; my tf folder is totally different than the one that is supposed to get copied from the rosserial_client directory. It appears that there is some sort of naming conflict. The question is: why is this conflict arising? I don't know where that tf directory is coming from.

When I run, the following occurs:


Exporting polled_camera


Exporting cmr_drive

DriveCommands, Exporting tf



Exporting robot_pose_ekf



Interestingly, there is no spacing between cmr_drive (my custom command) and the Exporting tf. Perhaps that is notable?

edit retag flag offensive close merge delete


If you remove cmd_drive package from your path, does make libraries succeed?

fergs gravatar image fergs  ( 2013-02-27 08:54:12 -0500 )edit

Nope; it still doesn't generate the ros directory.

duffany1 gravatar image duffany1  ( 2013-02-27 10:54:23 -0500 )edit

Ok, so I've realized that I was looking in the wrong place, make_libraries is working OK since you have ros.h -- can you check that <ws>/install/share/rosserial_arduino/src/ros_lib has no ros or tf folders? If so, then the problem is in during catkin_make

fergs gravatar image fergs  ( 2013-02-27 19:11:14 -0500 )edit

Ok, so I've realized that I was looking in the wrong place, make_libraries is working OK since you have ros.h -- can you check that <ws>/install/share/rosserial_arduino/src/ros_lib has no ros or tf folders?

fergs gravatar image fergs  ( 2013-02-27 19:11:20 -0500 )edit

fergs, I got it to work; there was probably a mistake on my part. The problem was that I wasn't running the source command after running catkin_make install. I figured I didn't need to since I had that command already in my bashrc file... Sorry about any alarm I caused :/

duffany1 gravatar image duffany1  ( 2013-02-28 03:04:40 -0500 )edit

In the future, I would suggest only posting the exact commands you ran -- you said in your original post you had sourced install/setup.bash so I didn't point it out. Just glad to hear we don't have some very, very mysterious bug to sort out!

fergs gravatar image fergs  ( 2013-02-28 22:13:40 -0500 )edit

Updated my answer to explain why failing to source install/setup.bash causes this.

fergs gravatar image fergs  ( 2013-02-28 22:16:36 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-02-26 19:28:50 -0500

fergs gravatar image

updated 2013-02-28 22:14:52 -0500

Be sure to run "source <ws>/install/setup.bash" otherwise you'll get ros_lib directory as it is in the rosserial_arduino source -- which is missing the files that are installed from rosserial_client.

edit flag offensive delete link more

Question Tools



Asked: 2013-02-26 03:09:09 -0500

Seen: 5,657 times

Last updated: Feb 28 '13