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

rosserial_arduino error

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

Kevin gravatar image

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

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 https://kforge.ros.org/rosserial/hg 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"
 #else
 #include "WProgram.h"
 #endif

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!


[UPDATE 1]

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

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

Am I missing a dependency?

[UPDATE 2]

I figured out I needed to do:

pip install pyserial

But now it fails with:

[kevin@TARDIS rosserial]$ rosrun rosserial_python serial_node.py  /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/serial_node.py", line 58, in <module>
    client.run()
  File "/Users/kevin/ros_sandbox/rosserial ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

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

ahendrix gravatar image

We've been aware that this needs to change in rosserial for a while; see https://kforge.ros.org/rosserial/trac/ticket/49 and apply the patch there.

edit flag offensive delete link more

Comments

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 -0500 )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 -0500 )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 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 2,964 times

Last updated: Mar 01 '12