WPILibC++ 2024.3.2
MecanumDriveWheelPositions.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <wpi/MathExtras.h>
8#include <wpi/SymbolExports.h>
9
10#include "units/length.h"
11
12namespace frc {
13/**
14 * Represents the wheel positions for a mecanum drive drivetrain.
15 */
17 /**
18 * Distance driven by the front-left wheel.
19 */
20 units::meter_t frontLeft = 0_m;
21
22 /**
23 * Distance driven by the front-right wheel.
24 */
25 units::meter_t frontRight = 0_m;
26
27 /**
28 * Distance driven by the rear-left wheel.
29 */
30 units::meter_t rearLeft = 0_m;
31
32 /**
33 * Distance driven by the rear-right wheel.
34 */
35 units::meter_t rearRight = 0_m;
36
37 /**
38 * Checks equality between this MecanumDriveWheelPositions and another object.
39 *
40 * @param other The other object.
41 * @return Whether the two objects are equal.
42 */
43 bool operator==(const MecanumDriveWheelPositions& other) const = default;
44
45 /**
46 * Checks inequality between this MecanumDriveWheelPositions and another
47 * object.
48 *
49 * @param other The other object.
50 * @return Whether the two objects are not equal.
51 */
52 bool operator!=(const MecanumDriveWheelPositions& other) const = default;
53
55 const MecanumDriveWheelPositions& endValue, double t) const {
56 return {wpi::Lerp(frontLeft, endValue.frontLeft, t),
57 wpi::Lerp(frontRight, endValue.frontRight, t),
58 wpi::Lerp(rearLeft, endValue.rearLeft, t),
59 wpi::Lerp(rearRight, endValue.rearRight, t)};
60 }
61};
62} // namespace frc
63
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
Definition: AprilTagPoseEstimator.h:15
constexpr T Lerp(const T &startValue, const T &endValue, double t)
Linearly interpolates between two values.
Definition: MathExtras.h:638
Represents the wheel positions for a mecanum drive drivetrain.
Definition: MecanumDriveWheelPositions.h:16
bool operator==(const MecanumDriveWheelPositions &other) const =default
Checks equality between this MecanumDriveWheelPositions and another object.
MecanumDriveWheelPositions Interpolate(const MecanumDriveWheelPositions &endValue, double t) const
Definition: MecanumDriveWheelPositions.h:54
units::meter_t frontLeft
Distance driven by the front-left wheel.
Definition: MecanumDriveWheelPositions.h:20
units::meter_t rearRight
Distance driven by the rear-right wheel.
Definition: MecanumDriveWheelPositions.h:35
bool operator!=(const MecanumDriveWheelPositions &other) const =default
Checks inequality between this MecanumDriveWheelPositions and another object.
units::meter_t frontRight
Distance driven by the front-right wheel.
Definition: MecanumDriveWheelPositions.h:25
units::meter_t rearLeft
Distance driven by the rear-left wheel.
Definition: MecanumDriveWheelPositions.h:30