Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
feat: add max RPM getter for Gearset
Browse files Browse the repository at this point in the history
  • Loading branch information
Tropix126 committed Mar 8, 2024
1 parent 5ad9b43 commit 86125ae
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/pros-devices/src/smart/motor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,22 @@ impl Gearset {
pub const RPM_200: Gearset = Gearset::Green;
/// 600 rpm
pub const RPM_600: Gearset = Gearset::Blue;

/// Rated max speed for a smart motor with a red gearset cartridge.
pub const MAX_RED_RPM: f64 = 100.0;
/// Rated speed for a smart motor with a green cartridge.
pub const MAX_GREEN_RPM: f64 = 200.0;
/// Rated speed for a smart motor with a blue cartridge.
pub const MAX_BLUE_RPM: f64 = 600.0;

/// Get the rated maximum speed for this motor gearset.
pub const fn max_rpm(&self) -> f64 {
match self {
Self::Red => Self::MAX_RED_RPM,
Self::Green => Self::MAX_GREEN_RPM,
Self::Blue => Self::MAX_BLUE_RPM,
}
}
}

impl From<Gearset> for pros_sys::motor_gearset_e_t {
Expand Down

0 comments on commit 86125ae

Please sign in to comment.