Robotics StackExchange | Archived questions

rosidl default generators CMake error

Hi,

I want to build custom messages and services in ROS2 by using rosidl_generator

 find_package(rosidl_default_generators REQUIRED)

However I get following CMake error

 CMake Error at /opt/clion-2019.2.4/bin/cmake/linux/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
 Could NOT find FastRTPS (missing: FastRTPS_INCLUDE_DIR FastRTPS_LIBRARIES)

I tried to install ROS2 by Debian Packages and by Source. I also checked if rosidldefaultgenerators is installed:

 apt list--installed | grep rosidl-default-generators

 ros-dashing-rosidl-default-generators/now 0.7.0-1bionic.20191016.185016 amd64 [installed,upgradable to: 0.7.0-1bionic.20191210.230356]

What could be the problem ?

Thanks

package:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>canopen</name>
  <version>0.0.0</version>
  <description>TODO: Package description</description>
  <maintainer email="jens@todo.todo">jens</maintainer>
  <license>TODO: License declaration</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <depend>rclcpp</depend>
  <depend>std_srvs</depend>
  <depend>std_msgs</depend>
  <depend>canopen_msgs</depend>

  <build_depend>builtin_interfaces</build_depend>
  <build_depend>rosidl_default_generators</build_depend>
  <exec_depend>builtin_interfaces</exec_depend>
  <exec_depend>rosidl_default_runtime</exec_depend>

  <member_of_group>rosidl_interface_packages</member_of_group>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

CMakeList:

cmake_minimum_required(VERSION 3.5)
project(canopen)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()


# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(std_srvs REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)

rosidl_generate_interfaces(new_msg
"include/can_msgs/msg/Frame.msg"
DEPENDENCIES builtin_interfaces)


include_directories(include)
ament_export_include_directories(include)

add_executable(pub src/main_pub.cpp)
ament_target_dependencies(pub rclcpp std_msgs std_srvs)


install(TARGETS
        pub
        DESTINATION lib/${PROJECT_NAME}
        )

ament_package()

Asked by jlepers on 2020-02-14 06:09:56 UTC

Comments

A few things to clarify:

  • Can you please provide the full CMake output and not only the error message line
  • You say your installed ROS from debian packages AND from source. Which one are you using for this build ? and how did you install it exactly (a link to a tutorials or a list of commands would be useful)?
  • It looks like your packages are outdated, is there a reason for you not to upgrade all your ROS packages?
  • You seem to be using CLion, do you have the same behavior if you try to build from the command line?
  • Are you able to build official packages with custom messages, for example https://github.com/ros2/example_interfaces/blob/dashing/, (make sure to use the dashing branch for the repositories you clone) or does that fail as well ?

Asked by marguedas on 2020-02-14 06:28:30 UTC

It was a CLion issue, sourcing the the installed ROS dashing map (installed by source) before opening CLion worked for me.

Asked by jlepers on 2020-03-02 05:29:05 UTC

Great, can you please post it as an answer and accept your own answer ? This way people will know the problem is solved

Asked by marguedas on 2020-03-02 05:55:04 UTC

Answers

It was a CLion issue, sourcing the the installed ROS dashing map (installed by source) before opening CLion worked for me.

Asked by jlepers on 2020-03-02 05:56:19 UTC

Comments