Viam C++ SDK current
Loading...
Searching...
No Matches
orientation_types.hpp
1#pragma once
2
3#include <tuple>
4
5#include <viam/sdk/common/proto_convert.hpp>
6
7namespace viam {
8namespace app {
9namespace v1 {
10
11class Translation;
12}
13} // namespace app
14} // namespace viam
15
16namespace viam {
17namespace sdk {
18
19enum OrientationType {
20 AxisAngles,
21 OrientationVector,
22 OrientationVectorDegrees,
23 EulerAngles,
24 Quaternion,
25};
26
28 double x = 0.0, y = 0.0, z = 0.0, theta = 0.0;
29
30 friend bool operator==(const axis_angles& lhs, const axis_angles& rhs) {
31 return std::tie(lhs.x, lhs.y, lhs.z, lhs.theta) == std::tie(rhs.x, rhs.y, rhs.z, rhs.theta);
32 }
33};
34
36 double yaw = 0.0, roll = 0.0, pitch = 0.0;
37
38 friend bool operator==(const euler_angles& lhs, const euler_angles& rhs) {
39 return std::tie(lhs.yaw, lhs.roll, lhs.pitch) == std::tie(rhs.yaw, rhs.roll, rhs.pitch);
40 }
41};
42
44 double x = 0.0, y = 0.0, z = 0.0, theta = 0.0;
45
46 friend bool operator==(const orientation_vector& lhs, const orientation_vector& rhs) {
47 return std::tie(lhs.x, lhs.y, lhs.z, lhs.theta) == std::tie(rhs.x, rhs.y, rhs.z, rhs.theta);
48 }
49};
50
52 double x = 0.0, y = 0.0, z = 0.0, theta = 0.0;
53
54 friend bool operator==(const orientation_vector_degrees& lhs,
55 const orientation_vector_degrees& rhs) {
56 return std::tie(lhs.x, lhs.y, lhs.z, lhs.theta) == std::tie(rhs.x, rhs.y, rhs.z, rhs.theta);
57 }
58};
59
60struct quaternion {
61 double x = 0.0, y = 0.0, z = 0.0, w = 0.0;
62
63 friend bool operator==(const quaternion& lhs, const quaternion& rhs) {
64 return std::tie(lhs.x, lhs.y, lhs.z, lhs.w) == std::tie(rhs.x, rhs.y, rhs.z, rhs.w);
65 }
66};
67
69 double x = 0.0, y = 0.0, z = 0.0;
70
71 friend bool operator==(const translation& lhs, const translation& rhs) {
72 return std::tie(lhs.x, lhs.y, lhs.z) == std::tie(rhs.x, rhs.y, rhs.z);
73 }
74};
75
76namespace proto_convert_details {
77
78template <>
80 void operator()(const translation&, app::v1::Translation*) const;
81};
82
83template <>
84struct from_proto_impl<app::v1::Translation> {
85 translation operator()(const app::v1::Translation*) const;
86};
87
88} // namespace proto_convert_details
89} // namespace sdk
90} // namespace viam
Definition orientation_types.hpp:27
Definition orientation_types.hpp:35
Definition orientation_types.hpp:51
Definition orientation_types.hpp:43
Definition orientation_types.hpp:60
Definition orientation_types.hpp:68