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

Rosserial Creation of Subscriber Failed

asked 2019-03-20 15:00:07 -0500

Booker gravatar image

After running:

rosrun rosserial_python /dev/ttyACM0

I receive these info and error messages (node connects, but can't find subscriber):

[INFO] [1553102815.473901]: ROS Serial Python Node
[INFO] [1553102815.508651]: Connecting to /dev/ttyACM0 at 57600 baud
[ERROR] [1553102817.635874]: Creation of subscriber failed: need more than 1 value to unpack

I am running ROS Kinetic on a 4G/64G LattePanda with Ubuntu 16.04 LTS, 64 bit, kernel 4.12.1-20180417

This is my first time using ROS.

My goal is to use rosserial and the LattePanda's onboard arduino (Arduino Leonardo) to create a subscriber to a custom message format. I have another publisher that is running in a terminal session on the LattePanda. I use the following procedure as setup:

After using:


I see no errors or issues. I then try and build the arduino headers that will be necessary to flash. First, I delete the ros_lib folder in the ~/Arduino/library/ directory. Then:

~/Arduino/libraries$ rosrun rosserial_client make_libraries .

This seems to run properly, giving output in the terminal and recreating the ros_lib folder in the ~/Arduino/libraries/ directory.

After running roscore and my publisher node, the messages are being published properly because I can view them using:

rostopic echo /moveControl

I will say that one of my issues is that after creating the header files for the arduino, when I try and use

#include <beginnner_tutorials/Movement.h>

in the arduino code, I am presented with the following error when I attempt to compile:

movementControl:4:41: error: beginner_tutorials/Movement.h: No such file or directory
compilation terminated.
exit status 1
beginner_tutorials/Movement.h: No such file or directory

This is extra irksome, because I can clearly see that the file and directory do exist. I assumed that this was a problem that could be resolved by exiting and reopening the arduino editor (maybe to refresh libraries?), but that did not solve the issue. The only fix I found was to manually include the absolute filepath as shown in my code below. After doing this, it does compile, but I can't help but feel it must be related to rosserial not being able to see my subscriber on the arduino.

I will say that I have had rosserial working before when I was using a std_msgs uint16_t. This must be an issue with my custom message type.

I am a newbie when it comes to ROS and C++, so I would appreciate any and all help!

All of my files are below:


int16 servoVal
int16 motorVal


#define USE_USBCON

#include <ros.h>
#include </home/rosuser/Arduino/libraries/ros_lib/beginner_tutorials/Movement.h>

ros::NodeHandle n;

#include <PololuMaestro.h>
#include <SoftwareSerial.h>
SoftwareSerial maestroSerial(7, 8);
MiniMaestro maestro(maestroSerial);

// Defining upper and lower bounds for servo target values
int16_t servoLowTarget = 4000;
int16_t servoMid = 6000;
int16_t servoHighTarget = 8000;

int16_t servoGroup1 = 6000;
int16_t servoGroup2 = 6000;

// Defining Pins for Motor Drivers
const int IN1=10;
const int IN2=11;
const int ENA=9;

const int ...
edit retag flag offensive close merge delete



I have almost the exact same problem. Getting the same error message "Creation of subscriber failed...".

I am trying both a combination of running ROS melodic on Debian stretch 9.8 and ROS kinetic on Ubuntu 16.04.

As is also the case in the question asked I have had success using rosserial_arduino before with both combinations using predefined ROS messages, but when trying to implement a custom message (containing two float64) I was not successful. I have checked that the custom message is valid when I use it without rosserial and I am able to build the Arduino sketch without errors with the custom message.

Therefore I am convinced, that the problem is due to the very combination of rosserial, Arduino and custom message.

Did anyone find a solution to the problem ? Thank you very much!

Amalie gravatar image Amalie  ( 2019-05-15 02:31:15 -0500 )edit

Hi. Answers like this -- which are not actually answers, but follow-up questions -- have very poor visibility. It would be better to post it as a separate question and then refer back to this one.

gvdhoorn gravatar image gvdhoorn  ( 2019-05-15 02:56:58 -0500 )edit

Same issue. Works perfectly for standard messages. Only throws "Creation of Sub failed. Need more than 1 values to unpack" for custom messages. Have you found a fix? Would have to change a lot of dependent code to revert to standard messages.

ringo47 gravatar image ringo47  ( 2020-09-26 15:35:56 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-11-04 08:28:43 -0500

I had the same issue. This worked out for me.

We need a simplified header file for custom messages in Arduino sketches. The usual header files in devel have boost dependencies. We can generate a simplified header file by running the following:

rosrun rosserial_arduino path_to_libraries your_message_package

The resources I used: ROS wiki and Ch 7. in Mastering ROS for Robotics Programming

edit flag offensive delete link more

Question Tools



Asked: 2019-03-20 15:00:07 -0500

Seen: 1,559 times

Last updated: Nov 04 '22