[wpimath] Add ChassisSpeeds::ToTwist2d() to ChassisSpeeds (#6634)

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
ncorrea210
2024-05-20 15:19:17 -04:00
committed by GitHub
parent 820f68dc08
commit 0b5aec82ff
2 changed files with 25 additions and 0 deletions

View File

@@ -38,6 +38,17 @@ struct WPILIB_DLLEXPORT ChassisSpeeds {
*/
units::radians_per_second_t omega = 0_rad_per_s;
/**
* Creates a Twist2d from ChassisSpeeds.
*
* @param dt The duration of the timestep.
*
* @return Twist2d.
*/
Twist2d ToTwist2d(units::second_t dt) const {
return Twist2d{vx * dt, vy * dt, omega * dt};
}
/**
* Disretizes a continuous-time chassis speed.
*