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

rosserial_arduino error

asked 2012-02-28 15:35:30 -0600

Kevin gravatar image

updated 2012-03-01 15:38:14 -0600

I am using OSX 10.7.3 with Arduino IDE 1.0

When I followed the directions to install rosserial from source, I did: hg clone rosserial. Everything compiled and I copied the ros_lib folder to my Arduino/Library folder. However when I try to compile any of the included example program (e.g., Hello World), it fails with the following error:

  In file included from /Users/kevin/Documents/Arduino/libraries/ros_lib/ros.h:39,
             from HelloWorld.cpp:6:
  /Users/kevin/Documents/Arduino/libraries/ros_lib/ArduinoHardware.h:38:22: error: WProgram.h: No such file or directory
  In file included from /Users/kevin/Documents/Arduino/libraries/ros_lib/ros.h:39,
             from HelloWorld.cpp:6:
  /Users/kevin/Documents/Arduino/libraries/ros_lib/ArduinoHardware.h: In member function 'long unsigned int ArduinoHardware::time()':
  /Users/kevin/Documents/Arduino/libraries/ros_lib/ArduinoHardware.h:73: error: 'millis' was not declared in this scope

A quick look at the release notes for Arduino says:

The WProgram.h file, which provides declarations for the Arduino API, has been renamed to Arduino.h. To create a library that will work in both Arduino 0022 and Arduino 1.0, you can use an #ifdef that checks for the ARDUINO constant, which was 22 and is now 100. For example:

 #if defined(ARDUINO) && ARDUINO >= 100
 #include "Arduino.h"
 #include "WProgram.h"

Am I grabbing out dated code from the wrong CVS??? This change to Arduino was made a while ago, so I don't understand how I am the first to find it. Thanks!


I loaded the "hello world" sketch onto my Arduino, but now it crashes with :

[kevin@TARDIS ~]$ rosrun rosserial_python /dev/cu.usbserial-A4001lNd
Traceback (most recent call last):
File "/Users/kevin/ros_sandbox/rosserial/rosserial_python/nodes/", line 40, in <module>
from rosserial_python import SerialClient
File "/Users/kevin/ros_sandbox/rosserial/rosserial_python/src/rosserial_python/", line 1, in <module>
from SerialClient import *
File "/Users/kevin/ros_sandbox/rosserial/rosserial_python/src/rosserial_python/", line 42, in <module>
from serial import *
ImportError: No module named serial

Am I missing a dependency?


I figured out I needed to do:

pip install pyserial

But now it fails with:

[kevin@TARDIS rosserial]$ rosrun rosserial_python  /dev/cu.usbserial-A4001lNd
[INFO] [WallTime: 1330658506.244201] ROS Serial Python Node
[INFO] [WallTime: 1330658506.251605] Connected on /dev/cu.usbserial-A4001lNd at 57600 baud
[INFO] [WallTime: 1330658508.750410] Note: publish buffer size is 280 bytes
[INFO] [WallTime: 1330658508.750905] Setup publisher on chatter [std_msgs/String]
[INFO] [WallTime: 1330658512.739698] Packet Failed :  Failed to read msg data
[INFO] [WallTime: 1330658517.747113] Packet Failed :  Failed to read msg data
[INFO] [WallTime: 1330658519.745485] Packet Failed :  Failed to read msg data
[INFO] [WallTime: 1330658526.749475] Packet Failed :  Failed to read msg data
[INFO] [WallTime: 1330658529.758370] Packet Failed :  Failed to read msg data
Traceback (most recent call last):
  File "/Users/kevin/ros_sandbox/rosserial/rosserial_python/nodes/", line 58, in <module>
  File "/Users/kevin/ros_sandbox/rosserial ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-02-28 18:37:16 -0600

ahendrix gravatar image

We've been aware that this needs to change in rosserial for a while; see and apply the patch there.

edit flag offensive delete link more


You might also note that our last rosserial release was more than a month before Arduino 1.0 came out. Arduino has dozens of developers, rosserial does not. Code sprints occur occasionally, but there is no full time maintainer of rosserial.

fergs gravatar image fergs  ( 2012-03-05 17:42:15 -0600 )edit

@fergs If rosserial is only lightly maintained, could it be moved to a repository host that supports forking and pull requests like github or bitbucket?

jbohren gravatar image jbohren  ( 2012-09-06 15:24:17 -0600 )edit

To get the HelloWorld and String examples to compile under 1.0.2 convert 'char' to 'unsigned char'

DrBot gravatar image DrBot  ( 2012-12-06 07:23:48 -0600 )edit

Question Tools



Asked: 2012-02-28 15:35:30 -0600

Seen: 2,955 times

Last updated: Mar 01 '12