New msg for arduino
HI everybody, I'm studying ROS, and I have a problem. I want to add my message to Arduino sketch, I successfully compiled the Arduino sketch in catkin workspace, but when I tried to add my meessage header file I obtain error: "NO such file or catalog" (massage successfully compiled in "devel/include/..."). Can anyone help me add a message ?
Error:
[ 91%] Building CXX object CMakeFiles/hello.dir/chatter.cpp.obj
/home/amrello/catkin_ws/src/arduino/firmware/chatter.cpp:4:27: fatal error: arduino/data1.h: No such file or catalog
#include <arduino/data1.h>
compilation terminated.
chatter.cpp (simplest publisher):
#include <ros.h>
#include <std_msgs/String.h>
#include <arduino/data1.h>
#include <Arduino.h>
ros::NodeHandle nh;
std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);
char hello[13] = "hello world!";
void setup()
{
nh.initNode();
nh.advertise(chatter);
}
void loop()
{
str_msg.data = hello;
chatter.publish( &str_msg );
nh.spinOnce();
delay(1000);
}
CMakeLists.txt (in src ):
cmake_minimum_required(VERSION 2.8.3)
include_directories(${ROS_LIB_DIR})
# Remove this if using an Arduino without native USB (eg, other than Leonardo)
#add_definitions(-DUSB_CON)
generate_arduino_firmware(hello
SRCS chatter.cpp ${ROS_LIB_DIR}/time.cpp ${ROS_LIB_DIR}/time.cpp
BOARD mega2560
PORT /dev/ttyACM0
)
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(arduino)
find_package(catkin REQUIRED COMPONENTS
rosserial_arduino
rosserial_client
roscpp
std_msgs
message_generation
)
add_message_files(
FILES
data1.msg
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
CATKIN_DEPENDS message_runtime
)
include_directories(include
${catkin_INCLUDE_DIRS}
)
rosserial_generate_ros_lib(
PACKAGE rosserial_arduino
SCRIPT make_libraries.py
)
rosserial_configure_client(
DIRECTORY firmware
TOOLCHAIN_FILE ${ROSSERIAL_ARDUINO_TOOLCHAIN}
)
rosserial_add_client_target(firmware hello ALL)
rosserial_add_client_target(firmware hello-upload)
It would be helpful if you copy and pasted the code and the terminal output here.
Can you please post your CMakeLists.txt too?
Why do you have two different CMakeLists.txt?
From this tutorial http://wiki.ros.org/rosserial_arduino...