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

ros arduino "hello world"

asked 2011-11-15 08:20:15 -0500

shakingatoms gravatar image

updated 2012-02-27 13:28:49 -0500

kwc gravatar image

I am trying to run the hello world tutorial and when I type "tma-0@tma-0-laptop:~$ rosrun rosserial_python /dev/ttyACM0" I keep getting the following error messages:

[INFO] [WallTime: 1321395246.850533] ROS Serial Python Node [INFO] [WallTime: 1321395246.857889] Connected on /dev/ttyACM0 at 57600 baud [ERROR] [WallTime: 1321395249.783413] Creation of publisher failed: unpack requires a string argument of length 4 [ERROR] [WallTime: 1321395250.786880] Tried to publish before configured, topic id 125

I have run roswtf and checked to make sure that all of the dependencies for rosserial_arduino have been installed.

My arduino code is the same as the example

 * rosserial Publisher Example
 * Prints "hello world!"

#include <ros.h>
#include <std_msgs/String.h>

ros::NodeHandle  nh;

std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);

char hello[13] = "hello world!";

void setup()

void loop()
{ = hello;
  chatter.publish( &str_msg );
    enter code here

Also, I am running Ubuntu 10.04 and I am using an Arduino Mega 2560. I have tried going through the FAQ but am really stuck, any help would be greatly appreciated.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2011-11-15 08:39:37 -0500

fergs gravatar image

This looks like you upgraded the computer to rosserial 0.3.0, but did not update your Arduino libraries and/or re-upload the code to the Arduino. We recently added the md5 checksum to each topic negotiation so that users are alerted about changes in messages (which causes difficult to debug errors).

edit flag offensive delete link more

answered 2011-11-29 00:49:01 -0500

YHE gravatar image

Running this works for me

roscd rosserial
hg update -C 138
rosrun rosserial_python /dev/ttyACM0
edit flag offensive delete link more


That would get you an 0.2.0 release of rosserial. If this is the problem, you probably want to update your libraries to 0.3.0 and reload the Arduino sketch as 0.3.0 has a number of upgrades.
fergs gravatar image fergs  ( 2011-11-29 04:09:14 -0500 )edit

answered 2016-05-31 11:15:55 -0500

Karthikeya Parunandi gravatar image

Hi! I too encountered the same problem. After a number of clueless frustrated hours, I deleted build file in catkin workspace and re-builded it by running catkin_make , then, catkin_make install and then source by source ~/catkin_ws/devel/setup.bash in the workspace. I don´t know what went wrong, but finally it worked.


edit flag offensive delete link more

Question Tools


Asked: 2011-11-15 08:20:15 -0500

Seen: 2,895 times

Last updated: May 31 '16