Where are ros2 message ostream operators for c++ logging?

asked 2020-10-29 13:17:39 -0600

updated 2020-10-30 06:24:31 -0600

Hello. I am trying to use RCLCPP_XX_STREAM function passing directly a message to the stream. The problem is that I am getting compilation errors because the message ostream operators are not found.

Below I show an example:

#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
geometry_msgs::msg::PoseStamped poseMsg = [...];
RCLCPP_INFO_STREAM(get_logger(), "posevalue:" << poseMsg);


error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘geometry_msgs::msg::PoseStamped_<std::allocator<void> >::_pose_type’ {aka ‘geometry_msgs::msg::Pose_<std::allocator<void> >’})

Where are rclcpp message ostream operators for logging?

Are they available in ROS2? if not, is it planned to support them?

edit retag flag offensive close merge delete