mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpimath] Add ChassisAccelerations and drivetrain accelerations classes and add forward and inverse kinematics for accelerations to the interface (#8185)
ChassisAccelerations and the drivetrain acceleration types are added in both Java and C++. `ChassisAccelerations` is basically just `ChassisSpeeds` but for accelerations! `DifferentialDriveWheelAccelerations`, `MecanumDriveWheelAccelerations`, and `SwerveModuleAccelerations` are the acceleration equivalent of the drivetrain speeds types. In Java, the `Kinematics` interface now has an additional generic parameter `A` which represents the accelerations, and `toChassisAccelerations` and `toWheelAccelerations` methods, which are implemented the same way as `toChassisSpeeds` and `toWheelSpeeds`. Protobuf and struct classes were also added for all four classes in Java and C++. --------- Signed-off-by: Zach Harel <zach@zharel.me> Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com> Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
@@ -2,18 +2,22 @@ defaults:
|
||||
subpackage: estimator
|
||||
|
||||
extra_includes:
|
||||
- wpi/math/kinematics/DifferentialDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/SwerveModuleAcceleration.hpp
|
||||
- wpi/math/kinematics/SwerveDriveKinematics.hpp
|
||||
|
||||
|
||||
classes:
|
||||
wpi::math::PoseEstimator:
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
- WheelSpeeds
|
||||
- WheelAccelerations
|
||||
methods:
|
||||
PoseEstimator:
|
||||
SetVisionMeasurementStdDevs:
|
||||
@@ -34,30 +38,36 @@ templates:
|
||||
DifferentialDrivePoseEstimatorBase:
|
||||
qualname: wpi::math::PoseEstimator
|
||||
params:
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelPositions
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelAccelerations
|
||||
MecanumDrivePoseEstimatorBase:
|
||||
qualname: wpi::math::PoseEstimator
|
||||
params:
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelPositions
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelAccelerations
|
||||
SwerveDrive2PoseEstimatorBase:
|
||||
qualname: wpi::math::PoseEstimator
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,2>
|
||||
SwerveDrive3PoseEstimatorBase:
|
||||
qualname: wpi::math::PoseEstimator
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,3>
|
||||
SwerveDrive4PoseEstimatorBase:
|
||||
qualname: wpi::math::PoseEstimator
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,4>
|
||||
SwerveDrive6PoseEstimatorBase:
|
||||
qualname: wpi::math::PoseEstimator
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,6>
|
||||
|
||||
@@ -2,17 +2,21 @@ defaults:
|
||||
subpackage: estimator
|
||||
|
||||
extra_includes:
|
||||
- wpi/math/kinematics/DifferentialDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/SwerveModuleAcceleration.hpp
|
||||
- wpi/math/kinematics/SwerveDriveKinematics.hpp
|
||||
|
||||
classes:
|
||||
wpi::math::PoseEstimator3d:
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
- WheelSpeeds
|
||||
- WheelAccelerations
|
||||
methods:
|
||||
PoseEstimator3d:
|
||||
SetVisionMeasurementStdDevs:
|
||||
@@ -34,30 +38,36 @@ templates:
|
||||
DifferentialDrivePoseEstimator3dBase:
|
||||
qualname: wpi::math::PoseEstimator3d
|
||||
params:
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelPositions
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelAccelerations
|
||||
MecanumDrivePoseEstimator3dBase:
|
||||
qualname: wpi::math::PoseEstimator3d
|
||||
params:
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelPositions
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelAccelerations
|
||||
SwerveDrive2PoseEstimator3dBase:
|
||||
qualname: wpi::math::PoseEstimator3d
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,2>
|
||||
SwerveDrive3PoseEstimator3dBase:
|
||||
qualname: wpi::math::PoseEstimator3d
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,3>
|
||||
SwerveDrive4PoseEstimator3dBase:
|
||||
qualname: wpi::math::PoseEstimator3d
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,4>
|
||||
SwerveDrive6PoseEstimator3dBase:
|
||||
qualname: wpi::math::PoseEstimator3d
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,6>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
classes:
|
||||
wpi::math::ChassisAccelerations:
|
||||
attributes:
|
||||
ax:
|
||||
ay:
|
||||
alpha:
|
||||
methods:
|
||||
ToRobotRelative:
|
||||
ToFieldRelative:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const ChassisAccelerations& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
@@ -14,6 +14,8 @@ classes:
|
||||
const wpi::units::meter_t, const wpi::units::meter_t [const]:
|
||||
const DifferentialDriveWheelPositions&, const DifferentialDriveWheelPositions& [const]:
|
||||
Interpolate:
|
||||
ToChassisAccelerations:
|
||||
ToWheelAccelerations:
|
||||
|
||||
inline_code: |
|
||||
SetupWPyStruct<wpi::math::DifferentialDriveKinematics>(cls_DifferentialDriveKinematics);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
classes:
|
||||
wpi::math::DifferentialDriveWheelAccelerations:
|
||||
attributes:
|
||||
left:
|
||||
right:
|
||||
methods:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const DifferentialDriveWheelAccelerations& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
@@ -1,8 +1,11 @@
|
||||
extra_includes:
|
||||
- wpi/math/kinematics/DifferentialDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/SwerveModuleAcceleration.hpp
|
||||
- wpi/math/kinematics/SwerveDriveKinematics.hpp
|
||||
|
||||
|
||||
@@ -11,43 +14,52 @@ classes:
|
||||
force_type_casters:
|
||||
- wpi::util::array
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
- WheelSpeeds
|
||||
- WheelAccelerations
|
||||
methods:
|
||||
ToChassisSpeeds:
|
||||
ToWheelSpeeds:
|
||||
ToTwist2d:
|
||||
Interpolate:
|
||||
ToChassisAccelerations:
|
||||
ToWheelAccelerations:
|
||||
|
||||
|
||||
templates:
|
||||
DifferentialDriveKinematicsBase:
|
||||
qualname: wpi::math::Kinematics
|
||||
params:
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelPositions
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelAccelerations
|
||||
MecanumDriveKinematicsBase:
|
||||
qualname: wpi::math::Kinematics
|
||||
params:
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelPositions
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelAccelerations
|
||||
SwerveDrive2KinematicsBase:
|
||||
qualname: wpi::math::Kinematics
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,2>
|
||||
SwerveDrive3KinematicsBase:
|
||||
qualname: wpi::math::Kinematics
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,3>
|
||||
SwerveDrive4KinematicsBase:
|
||||
qualname: wpi::math::Kinematics
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,4>
|
||||
SwerveDrive6KinematicsBase:
|
||||
qualname: wpi::math::Kinematics
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,6>
|
||||
|
||||
@@ -45,6 +45,11 @@ classes:
|
||||
GetRearLeft:
|
||||
GetRearRight:
|
||||
Interpolate:
|
||||
ToChassisAccelerations:
|
||||
ToWheelAccelerations:
|
||||
overloads:
|
||||
const ChassisAccelerations&, const Translation2d& [const]:
|
||||
const ChassisAccelerations& [const]:
|
||||
|
||||
inline_code: |
|
||||
SetupWPyStruct<wpi::math::MecanumDriveKinematics>(cls_MecanumDriveKinematics);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
classes:
|
||||
wpi::math::MecanumDriveWheelAccelerations:
|
||||
attributes:
|
||||
frontLeft:
|
||||
frontRight:
|
||||
rearLeft:
|
||||
rearRight:
|
||||
methods:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const MecanumDriveWheelAccelerations& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
@@ -1,15 +1,19 @@
|
||||
extra_includes:
|
||||
- wpi/math/kinematics/DifferentialDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/SwerveModuleAcceleration.hpp
|
||||
- wpi/math/kinematics/SwerveDriveKinematics.hpp
|
||||
|
||||
classes:
|
||||
wpi::math::Odometry:
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
- WheelSpeeds
|
||||
- WheelAccelerations
|
||||
methods:
|
||||
Odometry:
|
||||
ResetPosition:
|
||||
@@ -23,30 +27,36 @@ templates:
|
||||
DifferentialDriveOdometryBase:
|
||||
qualname: wpi::math::Odometry
|
||||
params:
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelPositions
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelAccelerations
|
||||
MecanumDriveOdometryBase:
|
||||
qualname: wpi::math::Odometry
|
||||
params:
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelPositions
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelAccelerations
|
||||
SwerveDrive2OdometryBase:
|
||||
qualname: wpi::math::Odometry
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,2>
|
||||
SwerveDrive3OdometryBase:
|
||||
qualname: wpi::math::Odometry
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,3>
|
||||
SwerveDrive4OdometryBase:
|
||||
qualname: wpi::math::Odometry
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,4>
|
||||
SwerveDrive6OdometryBase:
|
||||
qualname: wpi::math::Odometry
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,6>
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
extra_includes:
|
||||
- wpi/math/kinematics/DifferentialDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/DifferentialDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelAccelerations.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelPositions.hpp
|
||||
- wpi/math/kinematics/MecanumDriveWheelSpeeds.hpp
|
||||
- wpi/math/kinematics/SwerveModuleAcceleration.hpp
|
||||
- wpi/math/kinematics/SwerveDriveKinematics.hpp
|
||||
|
||||
classes:
|
||||
wpi::math::Odometry3d:
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
- WheelSpeeds
|
||||
- WheelAccelerations
|
||||
methods:
|
||||
Odometry3d:
|
||||
ResetPosition:
|
||||
@@ -24,30 +28,36 @@ templates:
|
||||
DifferentialDriveOdometry3dBase:
|
||||
qualname: wpi::math::Odometry3d
|
||||
params:
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelPositions
|
||||
- wpi::math::DifferentialDriveWheelSpeeds
|
||||
- wpi::math::DifferentialDriveWheelAccelerations
|
||||
MecanumDriveOdometry3dBase:
|
||||
qualname: wpi::math::Odometry3d
|
||||
params:
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelPositions
|
||||
- wpi::math::MecanumDriveWheelSpeeds
|
||||
- wpi::math::MecanumDriveWheelAccelerations
|
||||
SwerveDrive2Odometry3dBase:
|
||||
qualname: wpi::math::Odometry3d
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,2>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,2>
|
||||
SwerveDrive3Odometry3dBase:
|
||||
qualname: wpi::math::Odometry3d
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,3>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,3>
|
||||
SwerveDrive4Odometry3dBase:
|
||||
qualname: wpi::math::Odometry3d
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,4>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,4>
|
||||
SwerveDrive6Odometry3dBase:
|
||||
qualname: wpi::math::Odometry3d
|
||||
params:
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModulePosition,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleState,6>
|
||||
- wpi::util::array<wpi::math::SwerveModuleAcceleration,6>
|
||||
|
||||
@@ -77,6 +77,13 @@ classes:
|
||||
|
||||
Interpolate:
|
||||
GetModules:
|
||||
ToSwerveModuleAccelerations:
|
||||
ToWheelAccelerations:
|
||||
ToChassisAccelerations:
|
||||
overloads:
|
||||
ModuleAccelerations&&... [const]:
|
||||
ignore: true
|
||||
const wpi::util::array<SwerveModuleAcceleration, NumModules>& [const]:
|
||||
|
||||
template_inline_code: |
|
||||
if constexpr (NumModules == 2) {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
classes:
|
||||
wpi::math::SwerveModuleAcceleration:
|
||||
attributes:
|
||||
acceleration:
|
||||
angle:
|
||||
methods:
|
||||
operator==:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const SwerveModuleAcceleration& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
Reference in New Issue
Block a user