SMACC2
Loading...
Searching...
No Matches
common.hpp
Go to the documentation of this file.
1// Copyright 2021 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/*****************************************************************************************************************
16 *
17 * Authors: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20
21#pragma once
22
23#include <tf2/utils.h>
24#include <geometry_msgs/msg/quaternion.hpp>
25#include <geometry_msgs/msg/quaternion_stamped.hpp>
26#include <moveit_msgs/srv/get_position_ik.hpp>
27
28// All stream operators are now inline for header-only implementation
29// CRITICAL: Order matters! Primitive types first, then compound types that use them
30
31// Primitive geometry types (no dependencies)
32inline std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::Vector3 & msg)
33{
34 return out << "[ " << msg.x << " " << msg.y << " " << msg.z << "]";
35}
36
37inline std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::Point & msg)
38{
39 return out << "[ " << msg.x << " " << msg.y << " " << msg.z << "]";
40}
41
42inline std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::Quaternion & msg)
43{
44 return out << " Quaternion[" << msg.x << " , " << msg.y << " , " << msg.z << ", w:" << msg.w;
45}
46
47// Compound types (depend on primitive types above)
48inline std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::Transform & msg)
49{
50 return out << "Translation[" << msg.translation << "], Rotation[" << msg.rotation << "]";
51}
52
53inline std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::Pose & msg)
54{
55 return out << "Position[" << msg.position << "], Orientation[" << msg.orientation << "]";
56}
57
58inline std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::PoseStamped & msg)
59{
60 return out << "[serialization geometry_msgs::msg::PoseStamped] frame_id: " << msg.header.frame_id
61 << ", pose: " << msg.pose;
62}
63
64inline std::ostream & operator<<(
65 std::ostream & out, const moveit_msgs::srv::GetPositionIK::Request & msg)
66{
67 return out << "[moveit_msgs::srv::GetPositionIK::Request] position["
68 << msg.ik_request.pose_stamped << "]";
69}
70
71inline std::ostream & operator<<(std::ostream & out, const sensor_msgs::msg::JointState & /*msg*/)
72{
73 return out << "[sensor_msgs::msg::JointState]";
74}
std::ostream & operator<<(std::ostream &out, const geometry_msgs::msg::Vector3 &msg)
Definition common.hpp:32