Added a retrieve method
This will let you get the speed from the motor directly without the future communication system being needed
This commit is contained in:
@@ -40,6 +40,12 @@ impl<T: motor::Driver + motor::Sensor> Controller<T> {
|
|||||||
.set_speed_and_direction(motor_command, self.current_direction);
|
.set_speed_and_direction(motor_command, self.current_direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Retrieve the speed from the motor inside the controller.
|
||||||
|
/// This allows you to get a speed value from behind the move.
|
||||||
|
pub fn retrieve(&self) -> motor::Speed {
|
||||||
|
self.motor.get_speed()
|
||||||
|
}
|
||||||
|
|
||||||
///Creates a new Controller with a motor (of type T), a max speed and a pid::Config
|
///Creates a new Controller with a motor (of type T), a max speed and a pid::Config
|
||||||
/// This then allows for you to use the controller with the provided types
|
/// This then allows for you to use the controller with the provided types
|
||||||
pub fn new(motor: T, max_speed: Speed, config: pid::Config) -> Self {
|
pub fn new(motor: T, max_speed: Speed, config: pid::Config) -> Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user