-
Notifications
You must be signed in to change notification settings - Fork 671
[wpimath] Add ChassisAccelerations and drivetrain accelerations classes and add forward and inverse kinematics for accelerations to the interface #8185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2027
Are you sure you want to change the base?
Conversation
…r accelerations) and make both classes interpolatable Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
…use it already had the protobuf) and fix toString format Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
…celerations, and SwerveModuleAccelerations with relevant protobufs/structs Signed-off-by: Zach Harel <[email protected]>
…anumDriveWheelAccelerations, and SwerveModuleAccelerations with relevant protobufs/structs Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
…classes to include new third generic parameter Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
…them and also make gradle happy Signed-off-by: Zach Harel <[email protected]>
KangarooKoala
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to include adding interpolate() to the wheel speeds classes (and wheel accelerations classes) in this PR? It's already pretty large and doesn't seem directly related.
wpimath/src/main/java/edu/wpi/first/math/kinematics/ChassisAccelerations.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/kinematics/ChassisAccelerations.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/kinematics/ChassisAccelerations.java
Outdated
Show resolved
Hide resolved
|
I included the interpolation here solely because it was also something I wanted to add and I didn't want to make another PR |
wpimath/src/main/java/org/wpilib/math/kinematics/ChassisAccelerations.java
Show resolved
Hide resolved
…celeration vs velocity Signed-off-by: Zach Harel <[email protected]>
…erations and related files Signed-off-by: Zach Harel <[email protected]>
…of angularAcceleration Signed-off-by: Zach Harel <[email protected]>
…rAcceleration and then Signed-off-by: Zach Harel <[email protected]>
…swerve (which includes angular velocity due to centripetal acceleration component) Signed-off-by: Zach Harel <[email protected]>
…y in module acceleration calculations Signed-off-by: Zach Harel <[email protected]>
wpimath/src/main/java/edu/wpi/first/math/kinematics/ChassisAccelerations.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/kinematics/SwerveDriveKinematics.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/kinematics/SwerveDriveKinematics.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/kinematics/SwerveDriveKinematics.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/kinematics/SwerveDriveKinematics.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/edu/wpi/first/math/kinematics/SwerveDriveKinematics.java
Outdated
Show resolved
Hide resolved
…rivekinematics to its own method Signed-off-by: Zach Harel <[email protected]>
…ons for clarity Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
wpimath/src/main/native/include/wpi/math/kinematics/SwerveModuleAccelerations.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
…ematic-acceleration # Conflicts: # wpimath/src/main/native/cpp/kinematics/proto/SwerveModuleAccelerationsProto.cpp # wpimath/src/main/native/cpp/kinematics/struct/ChassisAccelerationsStruct.cpp # wpimath/src/main/native/cpp/kinematics/struct/DifferentialDriveWheelAccelerationsStruct.cpp # wpimath/src/main/native/cpp/kinematics/struct/MecanumDriveWheelAccelerationsStruct.cpp # wpimath/src/main/native/cpp/kinematics/struct/SwerveModuleAccelerationsStruct.cpp # wpimath/src/main/native/include/wpi/math/kinematics/ChassisAccelerations.hpp # wpimath/src/main/native/include/wpi/math/kinematics/DifferentialDriveWheelAccelerations.hpp # wpimath/src/main/native/include/wpi/math/kinematics/MecanumDriveWheelAccelerations.hpp # wpimath/src/main/native/include/wpi/math/kinematics/SwerveModuleAccelerations.hpp # wpimath/src/main/native/include/wpi/math/kinematics/proto/ChassisAccelerationsProto.hpp # wpimath/src/main/native/include/wpi/math/kinematics/proto/DifferentialDriveWheelAccelerationsProto.hpp # wpimath/src/main/native/include/wpi/math/kinematics/proto/MecanumDriveWheelAccelerationsProto.hpp # wpimath/src/main/native/include/wpi/math/kinematics/proto/SwerveModuleAccelerationsProto.hpp # wpimath/src/main/native/include/wpi/math/kinematics/struct/ChassisAccelerationsStruct.hpp # wpimath/src/main/native/include/wpi/math/kinematics/struct/DifferentialDriveWheelAccelerationsStruct.hpp # wpimath/src/main/native/include/wpi/math/kinematics/struct/MecanumDriveWheelAccelerationsStruct.hpp # wpimath/src/main/native/include/wpi/math/kinematics/struct/SwerveModuleAccelerationsStruct.hpp
Signed-off-by: Zach Harel <[email protected]>
…y binding configurations Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was #8185 (comment) ever resolved?
wpimath/src/main/java/org/wpilib/math/kinematics/SwerveModuleAcceleration.java
Show resolved
Hide resolved
Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
…pp/reality Signed-off-by: Zach Harel <[email protected]>
Signed-off-by: Zach Harel <[email protected]>
yes (just now) |
…istency in robotpy Signed-off-by: Zach Harel <[email protected]>
…and operators Signed-off-by: Zach Harel <[email protected]>
KangarooKoala
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So close...
| * @tparam WheelSpeeds Wheel speeds type. | ||
| * @tparam WheelPositions Wheel positions type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * @tparam WheelSpeeds Wheel speeds type. | |
| * @tparam WheelPositions Wheel positions type. | |
| * @tparam WheelPositions Wheel positions type. | |
| * @tparam WheelSpeeds Wheel speeds type. |
| * @tparam WheelSpeeds Wheel speeds type. | ||
| * @tparam WheelPositions Wheel positions type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * @tparam WheelSpeeds Wheel speeds type. | |
| * @tparam WheelPositions Wheel positions type. | |
| * @tparam WheelPositions Wheel positions type. | |
| * @tparam WheelSpeeds Wheel speeds type. |
| * @tparam WheelSpeeds Wheel speeds type. | ||
| * @tparam WheelPositions Wheel positions type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * @tparam WheelSpeeds Wheel speeds type. | |
| * @tparam WheelPositions Wheel positions type. | |
| * @tparam WheelPositions Wheel positions type. | |
| * @tparam WheelSpeeds Wheel speeds type. |
| * @tparam WheelSpeeds Wheel speeds type. | ||
| * @tparam WheelPositions Wheel positions type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * @tparam WheelSpeeds Wheel speeds type. | |
| * @tparam WheelPositions Wheel positions type. | |
| * @tparam WheelPositions Wheel positions type. | |
| * @tparam WheelSpeeds Wheel speeds type. |
| @Override | ||
| public void pack(ProtobufSwerveModuleAcceleration msg, SwerveModuleAcceleration value) { | ||
| msg.setAcceleration(value.acceleration); | ||
| Rotation2d.proto.pack(msg.getAngle(), value.angle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Rotation2d.proto.pack(msg.getAngle(), value.angle); | |
| Rotation2d.proto.pack(msg.getMutableAngle(), value.angle); |
Unpacking doesn't need to be mutable, but packing does (since that's when we modify msg).
| @Override | ||
| public SwerveModuleAcceleration unpack(ProtobufSwerveModuleAcceleration msg) { | ||
| return new SwerveModuleAcceleration( | ||
| msg.getAcceleration(), Rotation2d.proto.unpack(msg.getMutableAngle())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| msg.getAcceleration(), Rotation2d.proto.unpack(msg.getMutableAngle())); | |
| msg.getAcceleration(), Rotation2d.proto.unpack(msg.getAngle())); |
This doesn't need to be mutable since we're only unpacking (so we don't modify anything).
ChassisAccelerations and the drivetrain acceleration types are added in both Java and C++.
ChassisAccelerationsis basically justChassisSpeedsbut for accelerations!DifferentialDriveWheelAccelerations,MecanumDriveWheelAccelerations, andSwerveModuleAccelerationsare the acceleration equivalent of the drivetrain speeds types.In Java, the
Kinematicsinterface now has an additional generic parameterAwhich represents the accelerations, andtoChassisAccelerationsandtoWheelAccelerationsmethods, which are implemented the same way astoChassisSpeedsandtoWheelSpeeds.Protobuf and struct classes were also added for all four classes in Java and C++.