HoloLib
High-performance holonomic (X-Drive) control library for VEX V5
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5/**
6 * @brief Core constants to configure the chassis dimensions and hardware.
7 */
9 float trackWidth = 0; /**< Distance between left and right wheels */
10 float drivetrainWidth = 0.0f; /**< Physical width of the drivetrain */
11 float drivetrainLength = 0.0f; /**< Physical length of the drivetrain */
12 float wheelDiameter; /**< Diameter of the drive wheels */
13 float gearRatio; /**< Gear ratio (motor rotations / wheel rotations) */
14 bool kfEnabled = true; /**< Use Kalman filtering on encoders if true */
15};
16
17/**
18 * @brief Represents a simple deadzone-minimum output exponential or linear
19 * drive curve.
20 */
21struct DriveCurve {
22 float curve_multipler = 1.0f; /**< Curvature scale */
23 float deadzone = 0.0f; /**< Deadzone before response begins */
25 0.0f; /**< Minimum voltage output once deadzone is surpassed */
26};
27
28/**
29 * @brief Holds the drive curves for movement and rotation inputs.
30 */
32 DriveCurve movement; /**< Curve mapping for forward/sideways translation */
33 DriveCurve rotation; /**< Curve mapping for rotational input */
34};
35
36/**
37 * @brief Configuration for active heading correction during driver control.
38 */
40 bool correctionOn = true; /**< True to actively maintain heading when rotation
41 joystick is released */
42 float kP = 1.0f; /**< Proportional gain for heading hold */
43 float kI = 0.01f; /**< Integral gain for heading hold */
44 float kD = 0.1f; /**< Derivative gain for heading hold */
45};
46
47/**
48 * @brief Parameters defining bounds and conditions for autonomous movements.
49 */
50struct MoveParams {
51 float maxTranslationSpeed = 127.0f; /**< Maximum speed for translation */
52 float maxRotationSpeed = 127.0f; /**< Maximum speed for rotation */
53 float minSpeed = 0.0f; /**< Minimum speed (avoid stalling) */
54 float exitRange =
55 0.5f; /**< Acceptable position error to consider motion complete */
57 0.0f; /**< Distance to exit early before the movement is fully settled */
58 uint32_t timeout = 5000; /**< Maximum time allowed for movement (ms) */
59 bool async = true; /**< Should the motion run asynchronously */
60};
Core constants to configure the chassis dimensions and hardware.
Definition config.h:8
float trackWidth
Distance between left and right wheels.
Definition config.h:9
float gearRatio
Gear ratio (motor rotations / wheel rotations)
Definition config.h:13
float drivetrainWidth
Physical width of the drivetrain.
Definition config.h:10
float wheelDiameter
Diameter of the drive wheels.
Definition config.h:12
float drivetrainLength
Physical length of the drivetrain.
Definition config.h:11
bool kfEnabled
Use Kalman filtering on encoders if true.
Definition config.h:14
Configuration for active heading correction during driver control.
Definition config.h:39
float kD
Derivative gain for heading hold.
Definition config.h:44
float kP
Proportional gain for heading hold.
Definition config.h:42
float kI
Integral gain for heading hold.
Definition config.h:43
bool correctionOn
True to actively maintain heading when rotation joystick is released.
Definition config.h:40
Represents a simple deadzone-minimum output exponential or linear drive curve.
Definition config.h:21
float minimum_output
Minimum voltage output once deadzone is surpassed.
Definition config.h:24
float deadzone
Deadzone before response begins.
Definition config.h:23
float curve_multipler
Curvature scale.
Definition config.h:22
Holds the drive curves for movement and rotation inputs.
Definition config.h:31
DriveCurve movement
Curve mapping for forward/sideways translation.
Definition config.h:32
DriveCurve rotation
Curve mapping for rotational input.
Definition config.h:33
Parameters defining bounds and conditions for autonomous movements.
Definition config.h:50
float exitRange
Acceptable position error to consider motion complete.
Definition config.h:54
float earlyExitRange
Distance to exit early before the movement is fully settled.
Definition config.h:56
float maxTranslationSpeed
Maximum speed for translation.
Definition config.h:51
float minSpeed
Minimum speed (avoid stalling)
Definition config.h:53
uint32_t timeout
Maximum time allowed for movement (ms)
Definition config.h:58
bool async
Should the motion run asynchronously.
Definition config.h:59
float maxRotationSpeed
Maximum speed for rotation.
Definition config.h:52