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

why can't catkin find my custom messages?

asked 2020-12-16 10:49:33 -0500

LukeAI gravatar image

updated 2020-12-17 05:12:58 -0500

I'm using catkin_make in my custom message

In package imm_ukf_pda_track, I have:

├── CHANGELOG.rst
├── CMakeLists.txt
├── include
│   ├── imm_ukf_pda.h
│   └── ukf.h
├── launch
│   ├── backward.yaml
│   ├── forward.yaml
│   ├── imm_ukf_pda_track.launch
│   ├── imm_ukf_pda_window_size.launch
│   ├── turnning.yaml
│   └── window_size.yaml
├── msg
│   ├── InBoundingBox.msg
│   └── WindowSize.msg
├── nodes
│   └── imm_ukf_pda
│       ├── imm_ukf_pda.cpp
│       ├── imm_ukf_pda_main.cpp
│       └── ukf.cpp
├── package.xml
├── README.md
└── src
    └── window.py

InBoundingBox.msg

std_msgs/Header header
std_msgs/Bool[] in_boundingbox

WindowSize.msg

float64 left_size
float64 right_size

Error message:

[ 81%] Building CXX object [PATH]/imm_ukf_pda_track/CMakeFiles/imm_ukf_pda.dir/nodes/imm_ukf_pda/imm_ukf_pda_main.cpp.o
In file included from [PATH]/imm_ukf_pda_track/nodes/imm_ukf_pda/imm_ukf_pda_main.cpp:17:0:
[PATH]/imm_ukf_pda_track/include/imm_ukf_pda.h:44:10: fatal error: imm_ukf_pda_track/InBoundingBox.h: No such file or directory
 #include <imm_ukf_pda_track/InBoundingBox.h>

package.xml

<?xml version="1.0"?>
<package format="2">
  <name>imm_ukf_pda_track</name>
  <version>1.11.0</version>
  <description>imm_ukf_pda_track</description>

  <maintainer email="noop@noop.co.uk">noop</maintainer>
  <license>Apache 2</license>

  <buildtool_depend>catkin</buildtool_depend>
  <buildtool_depend>autoware_build_flags</buildtool_depend>

    <build_depend>roscpp</build_depend>
    <build_depend>pcl_ros</build_depend>
    <build_depend>autoware_msgs</build_depend>
    <build_depend>tf</build_depend>
    <build_depend>vector_map</build_depend>

    <exec_depend>roscpp</exec_depend>
    <exec_depend>pcl_ros</exec_depend>
    <exec_depend>autoware_msgs</exec_depend>
    <exec_depend>tf</exec_depend>
    <exec_depend>vector_map</exec_depend>

    <!-- custom message generation -->
    <build_depend>message_generation</build_depend>
    <exec_depend>message_runtime</exec_depend>

  <export></export>
</package>

CMakeLists.txt

    cmake_minimum_required(VERSION 2.8.3)
    project(imm_ukf_pda_track)


    find_package(autoware_build_flags REQUIRED)

    find_package(autoware_msgs REQUIRED)
    find_package(catkin REQUIRED COMPONENTS
      roscpp
      pcl_ros
      geometry_msgs
      tf
      autoware_msgs
      message_generation
      )


set(CMAKE_CXX_FLAGS "-O2 -Wall ${CMAKE_CXX_FLAGS}")

add_message_files(
        DIRECTORY msg
        FILES
        InBoundingBox.msg
        WindowSize.msg)


generate_messages(DEPENDENCIES std_msgs)

catkin_package(
  CATKIN_DEPENDS
  message_runtime
  roscpp
  pcl_ros
  autoware_msgs
  tf
  )

include_directories(
  ${autoware_msgs_INCLUDE_DIRS}
  ${catkin_INCLUDE_DIRS}
  include)

#imm_ukf_pda
add_executable(imm_ukf_pda
        nodes/imm_ukf_pda/imm_ukf_pda_main.cpp
        nodes/imm_ukf_pda/imm_ukf_pda.cpp
        nodes/imm_ukf_pda/ukf.cpp
        )
target_link_libraries(imm_ukf_pda
        ${catkin_LIBRARIES}
        )
add_dependencies(imm_ukf_pda
        ${catkin_EXPORTED_TARGETS}
        )


install(TARGETS
        imm_ukf_pda
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
        )

install(DIRECTORY launch/
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
        PATTERN ".svn" EXCLUDE)

rosmsg can even see them:

me@me:~/myproject$ rosmsg show imm_ukf_pda_track/InBoundingBox 

  uint32 seq
  time stamp
  string frame_id
std_msgs/Bool[] in_boundingbox
  bool data

me@me:~/myproject$ rosmsg show imm_ukf_pda_track/WindowSize
float64 left_size
float64 right_size
edit retag flag offensive close merge delete

Comments

Please include your message files and their path.

kscottz gravatar image kscottz  ( 2020-12-16 17:28:57 -0500 )edit

have added.

LukeAI gravatar image LukeAI  ( 2020-12-16 17:39:34 -0500 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2020-12-18 03:11:38 -0500

LukeAI gravatar image

Ok I've fixed it by changing this:

add_dependencies(imm_ukf_pda
        ${catkin_EXPORTED_TARGETS}
        )

to this:

add_dependencies(imm_ukf_pda
        ${${PROJECT_NAME}_EXPORTED_TARGETS}
        ${catkin_EXPORTED_TARGETS}
        )

oddly enough, this package usually built, but not always. something to do with non-deterministic build order with catkin?

edit flag offensive delete link more
0

answered 2020-12-16 20:16:23 -0500

srujan gravatar image

You also need to specify the directory where these message files are located. something like this

add_message_files(
    DIRECTORY msg
    FILES
    InBoundingBox.msg
    WindowSize.msg)
edit flag offensive delete link more

Comments

have tried as you suggest, it did not make a difference. have updated question with your addition

LukeAI gravatar image LukeAI  ( 2020-12-17 03:42:36 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-12-16 10:49:33 -0500

Seen: 513 times

Last updated: Dec 18 '20