WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
DifferentialDriveWheelPositions.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 differential drive drivetrain.
14 */
16 /**
17 * Distance driven by the left side.
18 */
19 wpi::units::meter_t left = 0_m;
20
21 /**
22 * Distance driven by the right side.
23 */
24 wpi::units::meter_t right = 0_m;
25
26 /**
27 * Checks equality between this DifferentialDriveWheelPositions and another
28 * object.
29 *
30 * @param other The other object.
31 * @return Whether the two objects are equal.
32 */
33 constexpr bool operator==(
34 const DifferentialDriveWheelPositions& other) const = default;
35
37 const DifferentialDriveWheelPositions& endValue, double t) const {
38 return {wpi::util::Lerp(left, endValue.left, t),
39 wpi::util::Lerp(right, endValue.right, t)};
40 }
41};
42} // namespace wpi::math
43
#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 differential drive drivetrain.
Definition DifferentialDriveWheelPositions.hpp:15
wpi::units::meter_t left
Distance driven by the left side.
Definition DifferentialDriveWheelPositions.hpp:19
constexpr DifferentialDriveWheelPositions Interpolate(const DifferentialDriveWheelPositions &endValue, double t) const
Definition DifferentialDriveWheelPositions.hpp:36
wpi::units::meter_t right
Distance driven by the right side.
Definition DifferentialDriveWheelPositions.hpp:24
constexpr bool operator==(const DifferentialDriveWheelPositions &other) const =default
Checks equality between this DifferentialDriveWheelPositions and another object.