ev3_drivebase/drivebase/run.rs
1use super::DriveBase;
2use ev3dev_lang_rust::Ev3Error;
3
4impl DriveBase {
5 /// Runs the robot forever using the already set speed
6 ///
7 /// # Errors
8 ///
9 /// Errors if it can run the command to run the robot forever
10 pub fn run_forever(&self) -> Result<&Self, Ev3Error> {
11 self.left.run_forever()?;
12 self.right.run_forever()?;
13 Ok(self)
14 }
15
16 /// Runs the robot to a relative position using the already set speed
17 ///
18 /// # Errors
19 ///
20 /// Errors if it can't run the command
21 pub fn run_to_rel_pos(
22 &self,
23 left_position: i32,
24 right_position: i32,
25 ) -> Result<&Self, Ev3Error> {
26 self.left.run_to_rel_pos(Some(left_position))?;
27 self.right.run_to_rel_pos(Some(right_position))?;
28 Ok(self)
29 }
30}