Ask Your Question
0

Problems adding a custom msg (Did you forget to specify generate_message(DEPENDENCIES ...)?)

asked 2020-10-31 18:41:30 -0500

98JMC gravatar image

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

Comments

1

Can we see your custom msg? Double type of variable is not defined you must use float (http://wiki.ros.org/std_msgs)

lfvm0001 gravatar image lfvm0001  ( 2020-11-03 03:55:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-11-03 06:35:49 -0500

98JMC gravatar image

Yeah that was the problem, I had a variable type as double but changing it to float32 fixed it. Thanks for the reply

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-10-31 18:41:30 -0500

Seen: 104 times

Last updated: Oct 31 '20