WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
MecanumDriveWheelPositions.hpp
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/units/length.hpp"
10
11namespace wpi::math {
12/**
13 * Represents the wheel positions for a mecanum drive drivetrain.
14 */
16 /**
17 * Distance driven by the front-left wheel.
18 */
19 wpi::units::meter_t frontLeft = 0_m;
20
21 /**
22 * Distance driven by the front-right wheel.
23 */
24 wpi::units::meter_t frontRight = 0_m;
25
26 /**
27 * Distance driven by the rear-left wheel.
28 */
29 wpi::units::meter_t rearLeft = 0_m;
30
31 /**
32 * Distance driven by the rear-right wheel.
33 */
34 wpi::units::meter_t rearRight = 0_m;
35
36 /**
37 * Checks equality between this MecanumDriveWheelPositions and another object.
38 *
39 * @param other The other object.
40 * @return Whether the two objects are equal.
41 */
42 constexpr bool operator==(const MecanumDriveWheelPositions& other) const =
43 default;
44
46 const MecanumDriveWheelPositions& endValue, double t) const {
47 return {wpi::util::Lerp(frontLeft, endValue.frontLeft, t),
49 wpi::util::Lerp(rearLeft, endValue.rearLeft, t),
50 wpi::util::Lerp(rearRight, endValue.rearRight, t)};
51 }
52};
53} // namespace wpi::math
54
#define WPILIB_DLLEXPORT
Definition SymbolExports.hpp:36
Definition LinearSystem.hpp:20
constexpr T Lerp(const T &startValue, const T &endValue, double t)
Linearly interpolates between two values.
Definition MathExtras.hpp:780
Represents the wheel positions for a mecanum drive drivetrain.
Definition MecanumDriveWheelPositions.hpp:15
wpi::units::meter_t frontLeft
Distance driven by the front-left wheel.
Definition MecanumDriveWheelPositions.hpp:19
wpi::units::meter_t rearRight
Distance driven by the rear-right wheel.
Definition MecanumDriveWheelPositions.hpp:34
constexpr MecanumDriveWheelPositions Interpolate(const MecanumDriveWheelPositions &endValue, double t) const
Definition MecanumDriveWheelPositions.hpp:45
wpi::units::meter_t frontRight
Distance driven by the front-right wheel.
Definition MecanumDriveWheelPositions.hpp:24
constexpr bool operator==(const MecanumDriveWheelPositions &other) const =default
Checks equality between this MecanumDriveWheelPositions and another object.
wpi::units::meter_t rearLeft
Distance driven by the rear-left wheel.
Definition MecanumDriveWheelPositions.hpp:29