ev3_drivebase/drivebase/
ramping.rs

1use super::DriveBase;
2use ev3dev_lang_rust::Ev3Error;
3
4impl DriveBase {
5    /// Sets the acceleration of the drivebase in deg/s^2
6    ///
7    /// # Errors
8    ///
9    /// Errors if the value is negative or it can't set the value
10    pub fn set_acceleration(&self, acceleration: i32) -> Result<&Self, Ev3Error> {
11        self.left.set_ramp_up_sp(acceleration)?;
12        self.right.set_ramp_up_sp(acceleration)?;
13        Ok(self)
14    }
15
16    /// Sets the deceleration of the drivebase in deg/s^2
17    ///
18    /// # Errors
19    ///
20    /// Errors if the value is negative or it can't set the value
21    pub fn set_deceleration(&self, deceleration: i32) -> Result<&Self, Ev3Error> {
22        self.left.set_ramp_down_sp(deceleration)?;
23        self.right.set_ramp_down_sp(deceleration)?;
24        Ok(self)
25    }
26}