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

How to use custom message arduino [SOLVED]

asked 2016-03-18 12:45:58 -0600

thepirate16 gravatar image

updated 2016-03-19 10:58:01 -0600

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:

~/catkin_ws/src/pkg_prova1

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!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-03-19 10:56:30 -0600

thepirate16 gravatar image

Update:

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/22960...

edit flag offensive delete link more
0

answered 2016-03-18 12:52:54 -0600

saleem gravatar image

updated 2016-03-18 12:56:41 -0600

I think you are making the libraries inside the libraries/ros_lib instead do this,

rosrun rosserial_arduino make_libraries.py ~/sketchbook/libraries/

or try removing the existing ros_lib in libraries and then type the above command.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-03-18 12:45:58 -0600

Seen: 3,772 times

Last updated: Mar 19 '16