mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
// Copyright (c) FIRST and other WPILib contributors.
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
#pragma once
|
|
|
|
#include "wpi/units/length.hpp"
|
|
#include "wpi/util/MathExtras.hpp"
|
|
#include "wpi/util/SymbolExports.hpp"
|
|
|
|
namespace frc {
|
|
/**
|
|
* Represents the wheel positions for a differential drive drivetrain.
|
|
*/
|
|
struct WPILIB_DLLEXPORT DifferentialDriveWheelPositions {
|
|
/**
|
|
* Distance driven by the left side.
|
|
*/
|
|
units::meter_t left = 0_m;
|
|
|
|
/**
|
|
* Distance driven by the right side.
|
|
*/
|
|
units::meter_t right = 0_m;
|
|
|
|
/**
|
|
* Checks equality between this DifferentialDriveWheelPositions and another
|
|
* object.
|
|
*
|
|
* @param other The other object.
|
|
* @return Whether the two objects are equal.
|
|
*/
|
|
constexpr bool operator==(
|
|
const DifferentialDriveWheelPositions& other) const = default;
|
|
|
|
constexpr DifferentialDriveWheelPositions Interpolate(
|
|
const DifferentialDriveWheelPositions& endValue, double t) const {
|
|
return {wpi::Lerp(left, endValue.left, t),
|
|
wpi::Lerp(right, endValue.right, t)};
|
|
}
|
|
};
|
|
} // namespace frc
|
|
|
|
#include "wpi/math/kinematics/proto/DifferentialDriveWheelPositionsProto.hpp"
|
|
#include "wpi/math/kinematics/struct/DifferentialDriveWheelPositionsStruct.hpp"
|