HoloLib
High-performance holonomic (X-Drive) control library for VEX V5
Loading...
Searching...
No Matches
pose.h
Go to the documentation of this file.
1#pragma once
2
3#include <cmath>
4
5/**
6 * @brief Contains internal robot velocities.
7 */
9 float vx, vy, w; /**< Velocities in X, Y, and Rotational domains */
10};
11
12/**
13 * @brief Contains global coordinates and velocity.
14 */
15struct Pose {
16 float x = 0; /**< Global X coordinate */
17 float y = 0; /**< Global Y coordinate */
18 float theta = 0; /**< Global heading angle */
19 VelocityComponents velocity{0, 0, 0}; /**< Current velocity components */
20};
21
22/**
23 * @brief Holonomic target voltages for a 4-motor X-drive or mecanum base.
24 */
26 float fl, fr, bl,
27 br; /**< Front-left, Front-right, Back-left, Back-right voltages */
28};
29
30/**
31 * @brief Helper utility to calculate the shortest path between two angles.
32 *
33 * @param target The desired angle in degrees.
34 * @param current The current angle in degrees.
35 * @return float The minimal error difference [-180, 180].
36 */
37inline float getAngleError(float target, float current) {
38 return std::remainder(target - current, 360.0f);
39}
float getAngleError(float target, float current)
Helper utility to calculate the shortest path between two angles.
Definition pose.h:37
Contains global coordinates and velocity.
Definition pose.h:15
float theta
Global heading angle.
Definition pose.h:18
float x
Global X coordinate.
Definition pose.h:16
float y
Global Y coordinate.
Definition pose.h:17
VelocityComponents velocity
Current velocity components.
Definition pose.h:19
Contains internal robot velocities.
Definition pose.h:8
float w
Velocities in X, Y, and Rotational domains.
Definition pose.h:9
Holonomic target voltages for a 4-motor X-drive or mecanum base.
Definition pose.h:25
float bl
Definition pose.h:26
float fr
Definition pose.h:26
float br
Front-left, Front-right, Back-left, Back-right voltages.
Definition pose.h:27
float fl
Definition pose.h:26