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

Problem regarding header files in Arduino

asked 2018-06-07 02:02:22 -0500

himS1234 gravatar image

updated 2018-06-07 04:16:31 -0500

When I run Arduino IDE using the command "arduino" and compile it, I get the error that "sabertooth.h" and "kangaroo.h " doesn't exist, when I open it using the command "sudo arduino" I get the error that "ros.h" doesn't exist (and all other header files also). When I run it using the icon, I get the error that my custom message file from ROS doesn't exist, I don’t know where to ask this question, so asking this here. I am using ROS Kinetic on Ubuntu 16.04.

I have made a package called diff_robot and a message file called ultra_readings.msg

This is the initial part of the code

#include <ros.h>
#include <ros/time.h>
#include <std_msgs/Float64.h>
#include <std_msgs/Float64MultiArray.h>
#include <diff_robot/ultra_readings.h>
#include <geometry_msgs/Vector3.h>
#include <Sabertooth.h>
Sabertooth ST(128);
#include <Kangaroo.h>

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#define BNO055_SAMPLERATE_DELAY_MS (100)
Adafruit_BNO055 bno = Adafruit_BNO055(55);

KangarooSerial  K(Serial3);
KangarooChannel K1(K, '1');
KangarooChannel K2(K, '2');

These are the errors:

When I open Arduino IDE with"arduino" command in terminal

Arduino_code.ino:7:24: fatal error: Sabertooth.h: No such file or directory compilation terminated.

When I open Arduino IDE with "sudo arduino" command in terminal

Arduino_code.ino:1:17: fatal error: ros.h: No such file or directory
compilation terminated.

When I open Arduino IDE by clicking on its icon

/home/user/Documents/DL_1234/ROSHS/robot_catkin_ws/src/diff_robot/src/Arduino_code/Arduino_code.ino:5:39: fatal error: diff_robot/ultra_readings.h: No such file or directory
 #include <diff_robot/ultra_readings.h>
                                       ^
compilation terminated.
exit status 1
Error compiling for board Arduino Mega ADK.
edit retag flag offensive close merge delete

Comments

Can you please update your question with a copy and paste of the errors

jayess gravatar image jayess  ( 2018-06-07 03:59:51 -0500 )edit

Edited the question

himS1234 gravatar image himS1234  ( 2018-06-07 04:16:04 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-06-10 23:58:25 -0500

RicHykkie gravatar image

Hi,

It looks like it can't find the headers. Are you sure you have installed the rosserial_arduino and Sabertooth/SyRen libraries properly? You should be able to find them in your sketchbook/libraries folder.

If it is not the case, here is a quick reminder on setting up rosserial_arduino:

Download the rosserial and rosserial_arduino packages for your ROS distro.

sudo apt-get install ros-kinetic-rosserial-arduino
sudo apt-get install ros-kinetic-rosserial

Create a sketchbook folder and its libraries folder in your home. Then, type:

cd sketchbook/libraries
rm -rf ros_lib
rosrun rosserial_arduino make_libraries.py .

This should create the sketchbook/libraries/ros_lib folder. Restart your IDE if it was open, and you should find the Rosserial Arduino Library in your Manage Libraries tab.

And now for the Sabertooth libraries:

Download the libraries from the Dimension Engineering website, and copy the folders in sketchbook/libraries, next to the ros_lib folder. Launch the IDE again. You should now find the Sabertooth libraries in your Examples and Manage Libraries tabs.

After you do this, your project should compile the headers properly. Please, tell me if it is not.

Best regards,

Ric

edit flag offensive delete link more

Comments

1

Also: don't just run things willy-nilly with sudo.

gvdhoorn gravatar image gvdhoorn  ( 2018-06-11 01:20:12 -0500 )edit

I have all the libraries required for Sabertooth and kangaroo. Actually as mentioned in the question, my code runs perfectly without the custom message when I open Arduino IDE using the icon.

himS1234 gravatar image himS1234  ( 2018-06-11 01:34:12 -0500 )edit

Okay, I understand now. Sorry for not grasping the whole problem.

I also got stuck on the same issue trying to create a custom message, but simply ended up using one among those offered by the std_msgs library. If your data is not overly exotic, maybe you could use one of these?

RicHykkie gravatar image RicHykkie  ( 2018-06-12 00:13:23 -0500 )edit

Also, regarding the Sabertooth.h and ros.h errors, the Arduino IDE is made to be launched using the icon.

RicHykkie gravatar image RicHykkie  ( 2018-06-12 00:15:06 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-06-07 02:02:22 -0500

Seen: 2,625 times

Last updated: Jun 10 '18