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

Confused adding header files in ROS2

asked 2018-11-19 04:30:48 -0600

stevemartin gravatar image

From the migration tutorial : LINK

It is obvious that I need to specify a subfolder msg and replace .h to .hpp.

However, I can see some different situation with ROS2 tf2 package: LINK It seems that I need to add the <tf2/LinearMath/Quaternion.h> as in ROS1 like this:

#include "tf2/LinearMath/Quaternion.h"

Can someone suggest me the correct way of including this header file in ROS2?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-11-19 08:20:14 -0600

lucasw gravatar image

updated 2018-11-19 08:21:56 -0600

There's a geometry_msgs/msg/quaternion.hpp that is the replacement of geometry_msgs/Quaternion.h in ros1. tf2/LinearMath/Quaternion.h is not a message, it doesn't have a changed path or capitalization or extension (yet?) from ros1 to ros2 so the same include will work. This still applies:

ROS uses two quaternion datatypes: msg and 'tf.' To convert between them in C++, use the methods of tf/transform_datatypes.

edit flag offensive delete link more

Question Tools



Asked: 2018-11-19 04:30:48 -0600

Seen: 1,309 times

Last updated: Nov 19 '18