WPILibC++ 2024.3.2
DifferentialDriveFeedforward.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
11#include "units/acceleration.h"
14#include "units/length.h"
15#include "units/time.h"
16#include "units/velocity.h"
17#include "units/voltage.h"
18
19namespace frc {
20/**
21 * A helper class which computes the feedforward outputs for a differential
22 * drive drivetrain.
23 */
26
27 public:
28 /**
29 * Creates a new DifferentialDriveFeedforward with the specified parameters.
30 *
31 * @param kVLinear The linear velocity gain in volts per (meters per second).
32 * @param kALinear The linear acceleration gain in volts per (meters per
33 * second squared).
34 * @param kVAngular The angular velocity gain in volts per (radians per
35 * second).
36 * @param kAAngular The angular acceleration gain in volts per (radians per
37 * second squared).
38 * @param trackwidth The distance between the differential drive's left and
39 * right wheels, in meters.
40 */
41 DifferentialDriveFeedforward(decltype(1_V / 1_mps) kVLinear,
42 decltype(1_V / 1_mps_sq) kALinear,
43 decltype(1_V / 1_rad_per_s) kVAngular,
44 decltype(1_V / 1_rad_per_s_sq) kAAngular,
45 units::meter_t trackwidth);
46
47 /**
48 * Creates a new DifferentialDriveFeedforward with the specified parameters.
49 *
50 * @param kVLinear The linear velocity gain in volts per (meters per second).
51 * @param kALinear The linear acceleration gain in volts per (meters per
52 * second squared).
53 * @param kVAngular The angular velocity gain in volts per (meters per
54 * second).
55 * @param kAAngular The angular acceleration gain in volts per (meters per
56 * second squared).
57 */
58 DifferentialDriveFeedforward(decltype(1_V / 1_mps) kVLinear,
59 decltype(1_V / 1_mps_sq) kALinear,
60 decltype(1_V / 1_mps) kVAngular,
61 decltype(1_V / 1_mps_sq) kAAngular);
62
63 /**
64 * Calculates the differential drive feedforward inputs given velocity
65 * setpoints.
66 *
67 * @param currentLeftVelocity The current left velocity of the differential
68 * drive in meters/second.
69 * @param nextLeftVelocity The next left velocity of the differential drive in
70 * meters/second.
71 * @param currentRightVelocity The current right velocity of the differential
72 * drive in meters/second.
73 * @param nextRightVelocity The next right velocity of the differential drive
74 * in meters/second.
75 * @param dt Discretization timestep.
76 */
78 units::meters_per_second_t currentLeftVelocity,
79 units::meters_per_second_t nextLeftVelocity,
80 units::meters_per_second_t currentRightVelocity,
81 units::meters_per_second_t nextRightVelocity, units::second_t dt);
82};
83} // namespace frc
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
A helper class which computes the feedforward outputs for a differential drive drivetrain.
Definition: DifferentialDriveFeedforward.h:24
DifferentialDriveWheelVoltages Calculate(units::meters_per_second_t currentLeftVelocity, units::meters_per_second_t nextLeftVelocity, units::meters_per_second_t currentRightVelocity, units::meters_per_second_t nextRightVelocity, units::second_t dt)
Calculates the differential drive feedforward inputs given velocity setpoints.
DifferentialDriveFeedforward(decltype(1_V/1_mps) kVLinear, decltype(1_V/1_mps_sq) kALinear, decltype(1_V/1_mps) kVAngular, decltype(1_V/1_mps_sq) kAAngular)
Creates a new DifferentialDriveFeedforward with the specified parameters.
DifferentialDriveFeedforward(decltype(1_V/1_mps) kVLinear, decltype(1_V/1_mps_sq) kALinear, decltype(1_V/1_rad_per_s) kVAngular, decltype(1_V/1_rad_per_s_sq) kAAngular, units::meter_t trackwidth)
Creates a new DifferentialDriveFeedforward with the specified parameters.
Definition: AprilTagPoseEstimator.h:15
Motor voltages for a differential drive.
Definition: DifferentialDriveWheelVoltages.h:14