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 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()
A few things to clarify:
It was a CLion issue, sourcing the the installed ROS dashing map (installed by source) before opening CLion worked for me.
Great, can you please post it as an answer and accept your own answer ? This way people will know the problem is solved