Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
dynamic_position.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
24#ifndef TAPROOT_DYNAMIC_POSITION_HPP_
25#define TAPROOT_DYNAMIC_POSITION_HPP_
26
28
29#include "position.hpp"
30#include "vector.hpp"
31
33{
35{
36public:
38 const float x,
39 const float y,
40 const float z,
41 const float vx,
42 const float vy,
43 const float vz,
44 const float ax,
45 const float ay,
46 const float az)
47 : position({x, y, z}),
48 velocity({vx, vy, vz}),
49 acceleration({ax, ay, az})
50 {
51 }
52
53 /* Costly; use rvalue reference whenever possible */
55 const CMSISMat<3, 1>& position,
56 const CMSISMat<3, 1>& velocity,
57 const CMSISMat<3, 1>& acceleration)
58 : position(position),
59 velocity(velocity),
60 acceleration(acceleration)
61 {
62 }
63
65 CMSISMat<3, 1>&& position,
66 CMSISMat<3, 1>&& velocity,
67 CMSISMat<3, 1>&& acceleration)
68 : position(std::move(position)),
69 velocity(std::move(velocity)),
70 acceleration(std::move(acceleration))
71 {
72 }
73
75 {
76 return DynamicPosition(
77 this->position + other.position,
78 this->velocity + other.velocity,
79 this->acceleration + other.acceleration);
80 }
81
83 {
84 return DynamicPosition(
85 this->position - other.position,
86 this->velocity - other.velocity,
87 this->acceleration - other.acceleration);
88 }
89
91 {
92 return DynamicPosition(-this->position, -this->velocity, -this->acceleration);
93 }
94
95 inline Position getPosition() const { return Position(position); }
96
97 inline Vector getVelocity() const { return Vector(velocity); }
98
99 inline Vector getAcceleration() const { return Vector(acceleration); }
100
101 inline float x() const { return position.data[0]; }
102
103 inline float y() const { return position.data[1]; }
104
105 inline float z() const { return position.data[2]; }
106
107 inline float vx() const { return velocity.data[0]; }
108
109 inline float vy() const { return velocity.data[1]; }
110
111 inline float vz() const { return velocity.data[2]; }
112
113 inline float ax() const { return acceleration.data[0]; }
114
115 inline float ay() const { return acceleration.data[1]; }
116
117 inline float az() const { return acceleration.data[2]; }
118
119 friend class Transform;
120
121private:
122 CMSISMat<3, 1> position;
123
124 CMSISMat<3, 1> velocity;
125
126 CMSISMat<3, 1> acceleration;
127
128}; // class DynamicPosition
129} // namespace tap::algorithms::transforms
130
131#endif // TAPROOT_DYNAMIC_POSITION_HPP_
Definition dynamic_position.hpp:35
Vector getAcceleration() const
Definition dynamic_position.hpp:99
Position getPosition() const
Definition dynamic_position.hpp:95
float x() const
Definition dynamic_position.hpp:101
float az() const
Definition dynamic_position.hpp:117
float vx() const
Definition dynamic_position.hpp:107
DynamicPosition operator+(const DynamicPosition &other) const
Definition dynamic_position.hpp:74
Vector getVelocity() const
Definition dynamic_position.hpp:97
float vz() const
Definition dynamic_position.hpp:111
DynamicPosition operator-() const
Definition dynamic_position.hpp:90
float z() const
Definition dynamic_position.hpp:105
float ay() const
Definition dynamic_position.hpp:115
DynamicPosition(const CMSISMat< 3, 1 > &position, const CMSISMat< 3, 1 > &velocity, const CMSISMat< 3, 1 > &acceleration)
Definition dynamic_position.hpp:54
float vy() const
Definition dynamic_position.hpp:109
float ax() const
Definition dynamic_position.hpp:113
float y() const
Definition dynamic_position.hpp:103
DynamicPosition(const float x, const float y, const float z, const float vx, const float vy, const float vz, const float ax, const float ay, const float az)
Definition dynamic_position.hpp:37
DynamicPosition operator-(const DynamicPosition &other) const
Definition dynamic_position.hpp:82
DynamicPosition(CMSISMat< 3, 1 > &&position, CMSISMat< 3, 1 > &&velocity, CMSISMat< 3, 1 > &&acceleration)
Definition dynamic_position.hpp:64
Definition position.hpp:35
Definition transform.hpp:60
Definition vector.hpp:35
Definition angular_velocity.hpp:30
Definition cmsis_mat.hpp:45
std::array< float, ROWS *COLS > data
Definition cmsis_mat.hpp:46