ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

Why cant Arduino find created headers?

asked 2018-07-16 03:52:50 -0500

Blackstar gravatar image

updated 2022-06-25 09:26:56 -0500

Mike Scheutzow gravatar image

I wrote some messages for Ros and created them with catkin Make.

Afterwards I deleted the ros.lib in my Arduino source and build them again with the rosserial command and the headers for the messages were created just fine. all old headers are working fine and are not giving errors, only the new ones are not functioning.

the Arduino IDE gives this error, but in the named directory the file is created .... so I dont get why ROS cant find it.

Arduino: 1.8.5 (Linux), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

/home/rekrut/sketchbook/Treiberplatine/Treiberplatine.ino:22:38: fatal error: beginner_tutorials/Test2.h: No such file or directory
 #include <beginner_tutorials/Test2.h>
                                      ^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
edit retag flag offensive close merge delete

Comments

does your include statement actually have a space and a ="" in it? If you post your code it may be easier for other people to figure out what is wrong.

benh gravatar image benh  ( 2018-09-27 19:44:11 -0500 )edit

The funny =" was an artifact of him not formatting the terminal output. I fixed the formatting.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-06-25 09:27:46 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2022-06-24 22:06:41 -0500

qilin_gundamenjoyer gravatar image

It looks like #include <beginner_tutorials test2.h="" should have the last three characters, ="", ommited. If those three characters are actually a part of your header file name, I would still recommend you to omit it for idiomatic file naming.

If it still doesn't work after that, I think your header file isn't located in the library folders, which is the standard location. If that is the case, change the syntax for the #include code line to #include "beginner_ tutorials test2.h". This will look in the folder that contains your .ino file. The " " syntax for the header file in #include checks your local sketch library first and then moves on to check the system file paths. In general, < > looks for the header files in a standard location, whereas " " looks for the file in a local location. Alternatively, you can specify a file path name for #include with #include “/full/path/name/beiginner_tutorials.h”.

edit flag offensive delete link more

Comments

I think your header file isn't located in the library folders, which is the standard location.

@qilin_gundamenjoyer I think your answer is misleading. For a rosserial client, a special set of .h files must be generated (by the user) to define a custom c class for each message type the rosserial client uses. The arduino compiler must use these special .h files, which are not compatible with the standard ros .h files.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-06-25 09:24:40 -0500 )edit

My bad. So this error could mean that the special set of .h files either aren't generated or not able to be located then right? If that's the case, how would I be able to determine it from that error output No such file or directory since most of the time when I get this error, it usually is due to the header file not being found in the right location.

qilin_gundamenjoyer gravatar image qilin_gundamenjoyer  ( 2022-06-25 17:35:41 -0500 )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: 2018-07-16 03:52:50 -0500

Seen: 73 times

Last updated: Jun 25