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

[ROS2] Do these package.xml and CMakeLists.txt tags have alternatives in ament and colcon builds for ROS2?

asked 2020-07-17 09:57:51 -0500

Jaroan gravatar image

updated 2020-07-20 03:00:36 -0500

Hello,

I am trying to port a package.xml and CMakeLists files from ros1 to ros2. I have this tag in the original XML file

<build_export_depend>roscpp</build_export_depend>

Is there an alternative for this in ros2 with rclcpp and ament?

Also, the CMakeLists.txt file has

SET_SOURCE_FILES_PROPERTIES(src/file.c PROPERTIES LANGUAGE CXX)

add_dependencies(<target> ${PROJECT_NAME}_gencfg ${catkin_EXPORTED_TARGETS})

I wanted to know if there are any alternatives in ROS2

Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2020-07-20 05:45:21 -0500

mgruhler gravatar image

I have this tag in the original XML file

<build_export_depend>roscpp</build_export_depend>

Is there an alternative for this in ros2 with rclcpp and ament?

This is in the package.xml and a tag of the format 2 version. According to the migration guide ROS2 support package.xmls of the format 2 and higher versions. So you should be good to go.

SET_SOURCE_FILES_PROPERTIES and add_dependencies are actually cmake functions and thus, there is no ROS2 alternative.

However, you can use ament_target_dependencies instead of the add_dependencies call, which is an easier way to handle that.

I suggest you thoroughly work through the migration guide linked above.

edit flag offensive delete link more

Comments

Thank you, I was referring to that site, but I didn't find some specific instructions. I'll go through them again

Jaroan gravatar image Jaroan  ( 2020-07-21 00:15:53 -0500 )edit
0

answered 2022-03-24 22:16:14 -0500

changcong gravatar image

You can use rosidl_target_interfaces(<target> ${PROJECT_NAME} "rosidl_typesupport_cpp") instead of the add_dependencies(<target> ${PROJECT_NAME}_gencfg ${catkin_EXPORTED_TARGETS}). More details in https://docs.ros.org/en/foxy/Tutorial...

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-07-17 09:57:51 -0500

Seen: 687 times

Last updated: Mar 24 '22