Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
dynamic_orientation.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2025-2025 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23#ifndef TAPROOT_DYNAMIC_ORIENTATION_HPP_
24#define TAPROOT_DYNAMIC_ORIENTATION_HPP_
25
27
28#include "angular_velocity.hpp"
29#include "orientation.hpp"
30
32{
34{
35public:
37 const float roll,
38 const float pitch,
39 const float yaw,
40 const float rollVel,
41 const float pitchVel,
42 const float yawVel)
43 : orientation(Orientation::fromEulerAngles(roll, pitch, yaw)),
44 angularVelocity(AngularVelocity::skewMatFromAngVel(rollVel, pitchVel, yawVel))
45 {
46 }
47
48 inline DynamicOrientation(Orientation&& orientation, AngularVelocity&& angularVelocity)
49 : orientation(std::move(orientation.matrix_)),
50 angularVelocity(std::move(angularVelocity.matrix_))
51 {
52 }
53
54 inline DynamicOrientation(Orientation& orientation, AngularVelocity& angularVelocity)
55 : orientation(orientation.matrix_),
56 angularVelocity(angularVelocity.matrix_)
57 {
58 }
59
61 const CMSISMat<3, 3>&& orientation,
62 const CMSISMat<3, 3>&& angularVelocity)
63 : orientation(std::move(orientation)),
64 angularVelocity(std::move(angularVelocity))
65 {
66 }
67
68 /* Costly; use rvalue reference whenever possible */
70 const CMSISMat<3, 3>& orientation,
71 const CMSISMat<3, 3>& angularVelocity)
72 : orientation(orientation),
73 angularVelocity(angularVelocity)
74 {
75 }
76
78 {
79 return DynamicOrientation(
80 this->orientation * other.orientation,
81 this->angularVelocity +
82 this->orientation * other.angularVelocity * this->orientation.transpose());
83 }
84
86 {
87 return DynamicOrientation(
88 this->orientation.transpose(),
89 -(this->orientation.transpose() * this->angularVelocity * this->orientation));
90 }
91
92 inline Orientation getOrientation() const { return Orientation(orientation); }
93
94 inline AngularVelocity getAngularVelocity() const { return AngularVelocity(angularVelocity); }
95
102 inline float roll() const { return atan2(orientation.data[7], orientation.data[8]); }
103
104 inline float pitch() const { return asinf(-orientation.data[6]); }
105
106 inline float yaw() const { return atan2(orientation.data[3], orientation.data[0]); }
107
111 inline float getRollVelocity() const { return angularVelocity.data[0 * 3 + 2]; }
112
116 inline float getPitchVelocity() const { return -angularVelocity.data[1 * 3 + 2]; }
117
121 inline float getYawVelocity() const { return -angularVelocity.data[0 * 3 + 1]; }
122
123 friend class Transform;
124
125private:
126 CMSISMat<3, 3> orientation;
127
128 CMSISMat<3, 3> angularVelocity;
129
130}; // class DynamicOrientation
131} // namespace tap::algorithms::transforms
132
133#endif // TAPROOT_DYNAMIC_ORIENTATION_HPP_
Definition angular_velocity.hpp:32
Definition dynamic_orientation.hpp:34
Orientation getOrientation() const
Definition dynamic_orientation.hpp:92
DynamicOrientation(const float roll, const float pitch, const float yaw, const float rollVel, const float pitchVel, const float yawVel)
Definition dynamic_orientation.hpp:36
DynamicOrientation(const CMSISMat< 3, 3 > &&orientation, const CMSISMat< 3, 3 > &&angularVelocity)
Definition dynamic_orientation.hpp:60
float getPitchVelocity() const
Get the pitch velocity.
Definition dynamic_orientation.hpp:116
float getRollVelocity() const
Get the roll velocity.
Definition dynamic_orientation.hpp:111
DynamicOrientation(const CMSISMat< 3, 3 > &orientation, const CMSISMat< 3, 3 > &angularVelocity)
Definition dynamic_orientation.hpp:69
DynamicOrientation inverse() const
Definition dynamic_orientation.hpp:85
float pitch() const
Definition dynamic_orientation.hpp:104
float yaw() const
Definition dynamic_orientation.hpp:106
float getYawVelocity() const
Get the yaw velocity.
Definition dynamic_orientation.hpp:121
DynamicOrientation(Orientation &&orientation, AngularVelocity &&angularVelocity)
Definition dynamic_orientation.hpp:48
AngularVelocity getAngularVelocity() const
Definition dynamic_orientation.hpp:94
DynamicOrientation(Orientation &orientation, AngularVelocity &angularVelocity)
Definition dynamic_orientation.hpp:54
DynamicOrientation compose(const DynamicOrientation &other) const
Definition dynamic_orientation.hpp:77
float roll() const
Definition dynamic_orientation.hpp:102
Definition orientation.hpp:33
Definition transform.hpp:60
Definition angular_velocity.hpp:30
CMSISMat< 3, 3 > fromEulerAngles(const float roll, const float pitch, const float yaw)
Definition math_user_utils.cpp:57
Definition cmsis_mat.hpp:45
CMSISMat< COLS, ROWS > transpose() const
Definition cmsis_mat.hpp:129
std::array< float, ROWS *COLS > data
Definition cmsis_mat.hpp:46