0
$\begingroup$

Rosanswers logo

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/rosserial_python/src/rosserial_python/SerialClient.py", line 280, in run
    checksum = sum(map(ord,header) ) + sum(map(ord, msg)) + ord(chk)
TypeError: ord() expected a character, but string of length 0 found

So what is this?


Originally posted by Kevin on ROS Answers with karma: 2962 on 2012-02-28

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by ahendrix with karma: 47576 on 2012-02-28

This answer was ACCEPTED on the original site

Post score: 6


Original comments

Comment by fergs on 2012-03-05:
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.

Comment by jbohren on 2012-09-06:
@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?

Comment by DrBot on 2012-12-06:
To get the HelloWorld and String examples to compile under 1.0.2 convert 'char' to 'unsigned char'

$\endgroup$

Your Answer

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