mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpimath] Add ChassisSpeeds::ToTwist2d() to ChassisSpeeds (#6634)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user