Error when trying to use my own .msg

I've tried to use my own .msg to send between nodes but I'm having some trouble. I got an answer on It before http://answers.ros.org/question/95406/how-can-i-use-my-own-msg/ but I don not get It to work properly.

The package .xml looks like this:

    <?xml version="1.0"?>
<package>
<name>distanceCalc</name>
<version>0.0.0</version>
<description>The distanceCalc package</description>
<maintainer <a href="mailto:email="patrik@todo.todo">patrik</maintainer">email="patrik@todo.todo">patrik</maintainer</a>>

<build_depend>message_generation</build_depend>
<run_depend>message_runtime</run_depend>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>cv_bridge</build_depend>
<build_depend>pcl</build_depend>
<build_depend>pcl_ros</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>stereo_msgs</build_depend>
<build_depend>message_generation</build_depend>
<run_depend>message_generation</run_depend>
<build_depend>msg/distanceMessage</build_depend>
<run_depend>msg/distanceMessage</run_depend>
<run_depend>cv_bridge</run_depend>
<run_depend>pcl</run_depend>
<run_depend>pcl_ros</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>stereo_msgs</run_depend>
<export>
</export>
</package>


The CmakeList.txt looks like this:

cmake_minimum_required(VERSION 2.8.3)
project(distanceCalc)

find_package(catkin REQUIRED COMPONENTS
cv_bridge
pcl
pcl_ros
roscpp
sensor_msgs
std_msgs
stereo_msgs
message_generation
)

generate_messages(DEPENDENCIES std_msgs)
include_directories(
${catkin_INCLUDE_DIRS}${OpenCV_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS} ) add_executable(distanceCalc src/distanceCalculation.cpp) target_link_libraries(distanceCalc${catkin_LIBRARIES} ${OpenCV_LIBRARIES}${PCL_INCLUDE_DIRS})


In my case I have projects within my src folder in the catkin_ws, one of them is named distanceCalc and have a folder named msg where the message distanceMessage.msg is placed.

Is there some mistake that I'm making, because when I try to inclide the message with the line

#include <msg/distanceMessage>


in my cpp file which exists in the src folder in the project distanceCalc I get an error (when trying to perform the catkin_make command) saying

"fatal error: msg/distanceMessage: No such file or directory"?


If this is not enough information to answer the questions please inform me and I will update.

Regards, Patrik

edit retag close merge delete

Sort by » oldest newest most voted

You have to include the header file of the message. You should include a build command for this in you CMakelist: http://wiki.ros.org/catkin/CMakeLists.txt#Messages.2C_Services.2C_and_Action_Targets. Then a header file is generated which you should include.

more