Ask Your Question
1

Rosserial Creation of Subscriber Failed

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

Booker gravatar image

After running:

rosrun rosserial_python serial_node.py /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:

catkin_make

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:

Movement.msg:

int16 servoVal
int16 motorVal

movementControl.ino:

#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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-05-15 02:31:15 -0600

Amalie gravatar image

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!

edit flag offensive delete link more

Comments

1

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 imagegvdhoorn ( 2019-05-15 02:56:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 225 times

Last updated: May 15