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

rosidl default generators CMake error

asked 2020-02-14 05:09:56 -0500

jlepers gravatar image

updated 2020-02-14 05:13:29 -0500

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

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_inter..., (make sure to use the dashing branch for the repositories you clone) or does that fail as well ?
marguedas gravatar image marguedas  ( 2020-02-14 05:28:30 -0500 )edit

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

jlepers gravatar image jlepers  ( 2020-03-02 04:29:05 -0500 )edit

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

marguedas gravatar image marguedas  ( 2020-03-02 04:55:04 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-03-02 04:56:19 -0500

jlepers gravatar image

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

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-02-14 05:09:56 -0500

Seen: 2,593 times

Last updated: Mar 02 '20