get ros2 version in C++
Are there any #define to know which version of ROS2 I'm using in C++ source?
Are there any #define to know which version of ROS2 I'm using in C++ source?
There are no defines in C/C++ out of the box.
That being said if your package depends on ros_environment
the following environment variables are set: ROS_VERSION
(which is either 1
or 2
), ROS_DISTRO
(e.g. dashing
or melodic
), etc.
You can use either to set compiler definitions in your package to be used in conditionals.
If you need more fine grain control you can also use the exact version number of each dependency (e.g. https://github.com/ros2/rmw_cyclonedd...).
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2019-11-01 16:46:52 -0500
Seen: 476 times
Last updated: Nov 02 '19
runtime error after trying to set parameters in ROS2
Scope Resolution problem in the ROS2 migration guide
RVIZ2 : No Transform from [base_link] to [Map]
Build error with xsens_node autoware
Problem with dependencies between multiple packages in colcon build
Using roscpp in existing app on Android/iOS
ROS2 node for Sony Playstation 4 Dual Shock 4 (DS4) gamepad
Navigation 2: dealing with bumper obstacles
symbol lookup error in lib<PKG>__rosidl_typesupport_introspection_cpp.so: