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

Error when trying to use my own .msg

asked 2013-10-29 02:54:59 -0500

Mr Hillgren gravatar image

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 but I don not get It to work properly.

The package .xml looks like this:

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


The CmakeList.txt looks like this:

cmake_minimum_required(VERSION 2.8.3)

find_package(catkin REQUIRED COMPONENTS
 add_message_files(FILES distanceMessage.msg)

generate_messages(DEPENDENCIES std_msgs)
add_executable(distanceCalc src/distanceCalculation.cpp)
target_link_libraries(distanceCalc ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_INCLUDE_DIRS})
add_dependencies(distanceCalc distanceCalc_gen_msg_cpp)

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-29 03:37:53 -0500

davinci gravatar image

You have to include the header file of the message. You should include a build command for this in you CMakelist: Then a header file is generated which you should include.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-10-29 02:54:59 -0500

Seen: 216 times

Last updated: Oct 29 '13