Hey, I'm new to ROS and trying to have a led blink at will with my Arduino from my computer using a message, the future goal being to control several ones from my terminal. I am using ROS lunar and the rosserial_arduino package.
I wrote my publisher, subscriber and message, ran the package from a terminal to another as a test and it worked perfectly. Then I put the subscriber code in a new Arduino sketch and adapted it. However, when I try to compile it, I get the following error:
/home/eric/Arduino/blink_one_ros/blink_one_ros.ino:2:30: fatal error: blink_one/Number.h: No such file or directory
#include <blink_one/Number.h>
^
My include being as follows:
#include <ros.h>
#include <blink_one/Number.h>
I already looked into this answer and several others, but I am afraid that it would be an error from my package so I want to be sure before re-installing ROS.
I did run the often advised:
rm -rf ros_lib/
rosrun rosserial_arduino make_libraries.py <my_path>
And indeed, I can find my message header in my ros_lib/blink_one . Yet it still does not seem to be recognized.
If anyone knows a solution or has some hints, I'd appreciate it!
Thanks!
Originally posted by RicHykkie on ROS Answers with karma: 13 on 2018-05-24
Post score: 0
Original comments
Comment by simbha on 2018-05-24:
is the blink_one msg is written by use? because by default there is no such msg
Comment by RicHykkie on 2018-05-24:
I don't quite understand the question, sorry.
I made it so that the publisher node running in my PC publishes a message into a topic that will be read by the subscriber node, which will be loaded in the Arduino. The message data is an integer, that I want to input in my terminal.
Comment by simbha on 2018-05-24:
what is the msg type of your topic? please check using rostopic info /topic name
. I just want to know what is <blink_one/Number.h>
. please let me know the msg type(std_msgs/Int64 or ?) of topic.
Comment by RicHykkie on 2018-05-24:
It should be an int16 but when I type this, I get Type: blink_one/Number
Comment by simbha on 2018-05-24:
Then why are you including <blink_one/Number.h
. It should be #include std_msgs/Int16.h
Comment by RicHykkie on 2018-05-24:
Sorry, I slightly modified my previous answer after checking.
About the use of the include, it's because I call this function void chatterCallback(const blink_one::Number msg) { code... }
.
Comment by simbha on 2018-05-24:
How you have created blink_one/Number.h
. Make sure it is available in Arduino/libraries/ros_lib/blink_one/Number.h
. refre this link
Comment by RicHykkie on 2018-05-24:
I created the header by first creating the .msg
file, then adding the required lines in the CMakeLists as shown in the msg and srv tutorials and finally catkin_make
.
Yes, the header is in the ros_lib/blink_one
folder.
Comment by simbha on 2018-05-24:
are the examples of ros_lib are compiling successfully?
Comment by RicHykkie on 2018-05-24:
Yes they do.