WPILibC++ 2023.4.3
DifferentialDriveWheelSpeeds.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/SymbolExports.h>
8
9#include "units/velocity.h"
10
11namespace frc {
12/**
13 * Represents the wheel speeds for a differential drive drivetrain.
14 */
16 /**
17 * Speed of the left side of the robot.
18 */
19 units::meters_per_second_t left = 0_mps;
20
21 /**
22 * Speed of the right side of the robot.
23 */
24 units::meters_per_second_t right = 0_mps;
25
26 /**
27 * Renormalizes the wheel speeds if either side is above the specified
28 * maximum.
29 *
30 * Sometimes, after inverse kinematics, the requested speed from one or more
31 * wheels may be above the max attainable speed for the driving motor on that
32 * wheel. To fix this issue, one can reduce all the wheel speeds to make sure
33 * that all requested module speeds are at-or-below the absolute threshold,
34 * while maintaining the ratio of speeds between wheels.
35 *
36 * @param attainableMaxSpeed The absolute max speed that a wheel can reach.
37 */
38 void Desaturate(units::meters_per_second_t attainableMaxSpeed);
39};
40} // namespace frc
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
Definition: AprilTagFieldLayout.h:22
Represents the wheel speeds for a differential drive drivetrain.
Definition: DifferentialDriveWheelSpeeds.h:15
void Desaturate(units::meters_per_second_t attainableMaxSpeed)
Renormalizes the wheel speeds if either side is above the specified maximum.