SMACC2
Loading...
Searching...
No Matches
common.cpp
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#include <cl_nav2z/common.hpp>
22
23#include <tf2/utils.h>
24#include <rclcpp/rclcpp.hpp>
25#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
26
27std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::Quaternion & msg)
28{
29 out << " Orientation [" << msg.x << " , " << msg.y << " , " << msg.z << ", " << msg.w
30 << "] , yaw: " << tf2::getYaw(msg);
31 return out;
32}
33
34std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::Point & msg)
35{
36 out << "[" << msg.x << " , " << msg.y << " , " << msg.z << "]";
37 return out;
38}
39
40std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::Pose & msg)
41{
42 out << " p " << msg.position;
43 out << " q [" << msg.orientation.x << " , " << msg.orientation.y << " , " << msg.orientation.z
44 << ", " << msg.orientation.w << "]";
45 return out;
46}
47
48std::ostream & operator<<(std::ostream & out, const geometry_msgs::msg::PoseStamped & msg)
49{
50 out << msg.pose;
51 return out;
52}
53
54std::ostream & operator<<(std::ostream & out, const nav2_msgs::action::NavigateToPose::Goal & msg)
55{
56 out << msg.pose;
57 return out;
58}
59
60std::ostream & operator<<(std::ostream & out, const builtin_interfaces::msg::Time & msg)
61{
62 out << "seconds: " << rclcpp::Time(msg).seconds();
63 return out;
64}
std::ostream & operator<<(std::ostream &out, const geometry_msgs::msg::Quaternion &msg)
Definition common.cpp:27