Rosanswers logo

Hi guys,

I've been doing some novice work in arduino and ros and i would like to use a custom message already created as the official tutorial says. The custom package is in:


and under its msg folder, we have the message file: Num.msg

This message works perfectly in a normal ROS node (not arduino) created by a C++ code. I can modify without issues all its fields and get the message published efficiently. Everything in the CMakeLists.txt and in the package.xml has been edited as the ROS tutorial suggests.

The problem is: how can my arduino use that custom message??

In order to make the arduino have it as a library, i've used:

rosrun rosserial_arduino make_libraries.py ~/sketchbook/libraries/ros_lib

Seems to have worked well despite that some packages like rtabmap, etc haven't been made. Anyway this isn't important.

Then, I open the Arduino IDE, open the HelloWorld example (just for testing the new message), and reference the message as a normal library in the very first line of the code:

#include <pkg_prova1/Num.h>

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

ros::NodeHandle  nh;
......(all the stuff that follows)

Unfortunately, it gives me the next compiling error:

HelloWorld.pde:6:28: fatal error: pkg_prova1/Num.h: No such file or directory
compilation terminated.

I guess either the new library that i have created is not well referenced so the IDE can find it or the make_libraries command is not what i should use.

Any ideas to do it? I would appreciate a detailed answer as my ROS knowledge is still some fuzzy.

Correct me if i have a wrong understanding of anything.

Thanks in advance!

Originally posted by thepirate16 on ROS Answers with karma: 101 on 2016-03-18

Post score: 0


1 Answer 1


Rosanswers logo


I got it working removing ROS completely from my computer and re-installing it.

Seems like there was a mess of files and folders in my catkin and in opt, possibly from several trials and errors in a first contact with ROS,

Now it has compiled but i have a different problem, the rosserial connection doesn't work. I guess that is because of the arduino code written, as the rosserial works when using the HelloWorld example.

Thanks saleem for your answer.

I open another question with the actual state (where I solved the problem!) http://answers.ros.org/question/229600/rosserial-connection-not-working-with-custom-messages-solved/

Originally posted by thepirate16 with karma: 101 on 2016-03-19

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

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