Trait robot_traits::Robot [−][src]
pub trait Robot { fn forward(&mut self, speed: f32); fn turn(&mut self, speed: f32); fn stop(&mut self); }
Represents a differential drive robot. All commands are assumed to supercede the previous one, i.e. they are not additive.
All speed
fields are in arbitrary units of "power" between 0.0 and 1.0
Required Methods
fn forward(&mut self, speed: f32)
Drive the robot forward by running both motors. A negative speed will drive the robot backwards.
speed
should be in the range [-1.0, 1.0]
fn turn(&mut self, speed: f32)
A positive speed makes the robot turn right (clockwise). A negative speed makes the robot turn left (counter-clockwise).
speed
should be in the range [-1.0, 1.0]
fn stop(&mut self)
Stop the robot.