WPILibC++ 2024.3.2
SwerveDriveWheelPositions.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#include <wpi/array.h>
10
12
13namespace frc {
14/**
15 * Represents the wheel positions for a swerve drive drivetrain.
16 */
17template <size_t NumModules>
19 /**
20 * The distances driven by the wheels.
21 */
23
24 /**
25 * Checks equality between this SwerveDriveWheelPositions and another object.
26 *
27 * @param other The other object.
28 * @return Whether the two objects are equal.
29 */
30 bool operator==(const SwerveDriveWheelPositions& other) const = default;
31
32 /**
33 * Checks inequality between this SwerveDriveWheelPositions and another
34 * object.
35 *
36 * @param other The other object.
37 * @return Whether the two objects are not equal.
38 */
39 bool operator!=(const SwerveDriveWheelPositions& other) const = default;
40
42 const SwerveDriveWheelPositions<NumModules>& endValue, double t) const {
43 auto result =
45 for (size_t i = 0; i < NumModules; i++) {
46 result[i] = positions[i].Interpolate(endValue.positions[i], t);
47 }
48 return {result};
49 }
50};
51} // namespace frc
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
This class is a wrapper around std::array that does compile time size checking.
Definition: array.h:26
Definition: AprilTagPoseEstimator.h:15
Represents the wheel positions for a swerve drive drivetrain.
Definition: SwerveDriveWheelPositions.h:18
SwerveDriveWheelPositions< NumModules > Interpolate(const SwerveDriveWheelPositions< NumModules > &endValue, double t) const
Definition: SwerveDriveWheelPositions.h:41
bool operator==(const SwerveDriveWheelPositions &other) const =default
Checks equality between this SwerveDriveWheelPositions and another object.
wpi::array< SwerveModulePosition, NumModules > positions
The distances driven by the wheels.
Definition: SwerveDriveWheelPositions.h:22
bool operator!=(const SwerveDriveWheelPositions &other) const =default
Checks inequality between this SwerveDriveWheelPositions and another object.
constexpr empty_array_t empty_array
Definition: array.h:16