Problems adding a custom msg (Did you forget to specify generate_message(DEPENDENCIES ...)?)
(ROS Melodic - Ubuntu 18.04 bionic)
I have created a custom msg (Sight.msg) which uses bool, double, and time variables. I edited the CMakeList and package.xml file (I thought) appropriately, but when I run catkin_make it throws up the following error:
CMake Error at /home/catkin_ws/build/enki_ros_pck/cmake/enki_ros_pck-genmsg.cmake:3 (message):
Could not find messages which
'/home/catkin_ws/src/enki_ros_pck/msg/Sight.msg' depends
on. Did you forget to specify generate_messages(DEPENDENCIES ...)?
Cannot locate message [double] in package [enki_ros_pck] with paths
[['/home/catkin_ws/src/enki_ros_pck/msg']]
Call Stack (most recent call first):
/opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
enki_ros_pck/CMakeLists.txt:18 (generate_messages)
Below are my CMakeLists and package files:
CMake
cmake_minimum_required(VERSION 3.0)
project(enki_ros_pck)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
roslib
message_generation
)
add_message_files(
FILES
Sight.msg
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
CATKIN_DEPENDS roscpp std_msgs message_runtime
)
include_directories(
${catkin_INCLUDE_DIRS}
)
set(enki_LIBRARY /usr/local/lib/libenki.a)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5 COMPONENTS OpenGL REQUIRED)
set(SOURCES run.cpp Racer.cpp bandpass.cpp)
include_directories(/usr/local/include/enki)
add_executable(robot ${SOURCES})
target_link_libraries(robot ${catkin_LIBRARIES} ${enki_LIBRARY} Qt5::OpenGL Qt5::Widgets GL)
add_dependencies(robot ${catkin_EXPORTED_TARGETS})
#catkin_install_python(PROGRAMS py_plot/topic_plot.py
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
#)
package
<?xml version="1.0"?>
<package format="2">
<name>enki_ros_pck</name>
<version>1.0.0</version>
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>message_generation</build_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<build_export_depend>message_generation</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>message_runtime</exec_depend>
</export>
</package>
Can we see your custom msg? Double type of variable is not defined you must use float (http://wiki.ros.org/std_msgs)