LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
odomMath.hpp
Go to the documentation of this file.
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6#pragma once
7
11#include <tuple>
12
13namespace okapi {
14class OdomMath {
15 public:
24 static QLength computeDistanceToPoint(const Point &ipoint, const OdomState &istate);
25
34 static QAngle computeAngleToPoint(const Point &ipoint, const OdomState &istate);
35
44 static std::pair<QLength, QAngle> computeDistanceAndAngleToPoint(const Point &ipoint,
45 const OdomState &istate);
46
53 static QAngle constrainAngle360(const QAngle &angle);
54
61 static QAngle constrainAngle180(const QAngle &angle);
62
63 private:
64 OdomMath();
65 ~OdomMath();
66
74 static std::pair<double, double> computeDiffs(const Point &ipoint, const OdomState &istate);
75
83 static double computeDistance(double xDiff, double yDiff);
84
93 static double computeAngle(double xDiff, double yDiff, double theta);
94};
95} // namespace okapi
static QAngle constrainAngle180(const QAngle &angle)
Constraints the angle to [-180,180) degrees.
static QAngle constrainAngle360(const QAngle &angle)
Constraints the angle to [0,360] degrees.
static std::pair< QLength, QAngle > computeDistanceAndAngleToPoint(const Point &ipoint, const OdomState &istate)
Computes the distance and angle from the given Odometry state to the given point.
static QAngle computeAngleToPoint(const Point &ipoint, const OdomState &istate)
Computes the angle from the given Odometry state to the given point.
static QLength computeDistanceToPoint(const Point &ipoint, const OdomState &istate)
Computes the distance from the given Odometry state to the given point.