Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
odometry_2d_tracker.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 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_ODOMETRY_2D_TRACKER_HPP_
25#define TAPROOT_ODOMETRY_2D_TRACKER_HPP_
26
27#include "modm/math/geometry/location_2d.hpp"
28
30
32{
33// Forward declarations
34class ChassisWorldYawObserverInterface;
35class ChassisDisplacementObserverInterface;
36
43{
44public:
57 ChassisWorldYawObserverInterface* chassisYawObserver,
58 ChassisDisplacementObserverInterface* chassisDisplacementObserver)
59 : chassisYawObserver(chassisYawObserver),
60 chassisDisplacementObserver(chassisDisplacementObserver)
61 {
62 }
63
68 void update();
69
74 inline modm::Location2D<float> getCurrentLocation2D() const final { return location; }
75
76 inline modm::Vector2f getCurrentVelocity2D() const final { return velocity; }
77
78 inline float getYaw() const final { return chassisYaw; }
79
80 inline uint32_t getLastComputedOdometryTime() const final { return lastComputedOdometryTime; }
81
82 void overrideOdometryPosition(const float positionX, const float positionY);
83
84private:
85 ChassisWorldYawObserverInterface* chassisYawObserver;
86 ChassisDisplacementObserverInterface* chassisDisplacementObserver;
87 // Location in reference frame
88 modm::Location2D<float> location;
89 // Velocity in reference frame
90 modm::Vector2f velocity;
91 // Chassis yaw orientation in reference frame (radians)
92 float chassisYaw;
93 // Previous chassis absolute displacement in chassis frame
94 modm::Vector<float, 3> prevChassisAbsoluteDisplacement;
95 // last time (in microsecodns) that the odometry was computed
96 uint32_t lastComputedOdometryTime = 0;
97 // `true` iff `this` has been updated with valid chassis data at least once.
98 bool displacementPrimed = false;
99};
100
101} // namespace tap::algorithms::odometry
102
103#endif // TAPROOT_ODOMETRY_2D_TRACKER_HPP_
Definition chassis_displacement_observer_interface.hpp:65
Definition chassis_world_yaw_observer_interface.hpp:43
Interface for retrieving the position of a robot chassis in 2 dimensions.
Definition odometry_2d_interface.hpp:44
Definition odometry_2d_tracker.hpp:43
float getYaw() const final
Definition odometry_2d_tracker.hpp:78
Odometry2DTracker(ChassisWorldYawObserverInterface *chassisYawObserver, ChassisDisplacementObserverInterface *chassisDisplacementObserver)
Definition odometry_2d_tracker.hpp:56
void overrideOdometryPosition(const float positionX, const float positionY)
Definition odometry_2d_tracker.cpp:84
uint32_t getLastComputedOdometryTime() const final
Definition odometry_2d_tracker.hpp:80
modm::Location2D< float > getCurrentLocation2D() const final
Definition odometry_2d_tracker.hpp:74
modm::Vector2f getCurrentVelocity2D() const final
Definition odometry_2d_tracker.hpp:76
void update()
Definition odometry_2d_tracker.cpp:38
Definition chassis_displacement_observer_interface.hpp:30