pub trait Robot {
// Required methods
fn forward(&mut self, speed: f32);
fn turn(&mut self, speed: f32);
fn stop(&mut self);
}
Expand description
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§
Sourcefn forward(&mut self, speed: f32)
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]