ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I had the same issue... here's how to fix it:
use rosidl_generator_traits::to_yaml(poseMsg)
instead of just poseMsg
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
[...]
geometry_msgs::msg::PoseStamped poseMsg = [...];
RCLCPP_INFO_STREAM(get_logger(), "posevalue:" << rosidl_generator_traits::to_yaml(poseMsg));
[...]
I dug through the generated message header files and found it.
2 | No.2 Revision |
I had the same issue... here's how to fix it:
use rosidl_generator_traits::to_yaml(poseMsg)
instead of just poseMsg
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
[...]
geometry_msgs::msg::PoseStamped poseMsg = [...];
RCLCPP_INFO_STREAM(get_logger(), "posevalue:" << rosidl_generator_traits::to_yaml(poseMsg));
[...]
I dug through the generated message header files and found it.
UPDATE: It seems this method is now deprecated. You should now use geometry_msgs::msg::to_yaml()
instead of rosidl_generator_traits::to_yaml()
warning: ‘std::string rosidl_generator_traits::to_yaml(const Pose&)’ is deprecated: use
geometry_msgs::msg::to_yaml() instead [-Wdeprecated-declarations]
3 | No.3 Revision |
UPDATE: It seems the original method below is now deprecated in Humble. You should now use geometry_msgs::msg::to_yaml()
instead of rosidl_generator_traits::to_yaml()
warning: ‘std::string rosidl_generator_traits::to_yaml(const Pose&)’ is deprecated: use
geometry_msgs::msg::to_yaml() instead [-Wdeprecated-declarations]
So, the answer for Humble is
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
[...]
geometry_msgs::msg::PoseStamped poseMsg = [...];
RCLCPP_INFO_STREAM(get_logger(), "posevalue:" << geometry_msgs::msg::(poseMsg));
[...]
ORIGINAL:
I had the same issue... here's how to fix it:
use rosidl_generator_traits::to_yaml(poseMsg)
instead of just poseMsg
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
[...]
geometry_msgs::msg::PoseStamped poseMsg = [...];
RCLCPP_INFO_STREAM(get_logger(), "posevalue:" << rosidl_generator_traits::to_yaml(poseMsg));
[...]
I dug through the generated message header files and found it.
UPDATE: It seems this method is now deprecated. You should now use geometry_msgs::msg::to_yaml()
instead of rosidl_generator_traits::to_yaml()
warning: ‘std::string rosidl_generator_traits::to_yaml(const Pose&)’ is deprecated: use
geometry_msgs::msg::to_yaml() instead [-Wdeprecated-declarations]
4 | No.4 Revision |
UPDATE: It seems the original method below is now deprecated in Humble. You should now use geometry_msgs::msg::to_yaml()
instead of rosidl_generator_traits::to_yaml()
warning: ‘std::string rosidl_generator_traits::to_yaml(const Pose&)’ is deprecated: use
geometry_msgs::msg::to_yaml() instead [-Wdeprecated-declarations]
So, the answer for Humble is
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
[...]
geometry_msgs::msg::PoseStamped poseMsg = [...];
RCLCPP_INFO_STREAM(get_logger(), "posevalue:" << geometry_msgs::msg::(poseMsg));
[...]
ORIGINAL:
I had the same issue... here's how to fix it:
use rosidl_generator_traits::to_yaml(poseMsg)
instead of just poseMsg
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
[...]
geometry_msgs::msg::PoseStamped poseMsg = [...];
RCLCPP_INFO_STREAM(get_logger(), "posevalue:" << rosidl_generator_traits::to_yaml(poseMsg));
[...]
I dug through the generated message header files and found it.