The motor controllers in src/motor.rs will be responsible for making decisions regarding how much force to generate from the motor. The physics driver will supply current state information regarding all known measurements of location, velocity, and so on. Currently, the motor controller uses only the most current information to make control decisions. However, this may change in the future, in which case the controller may store past measurements.
Extracting the same control algorithm from the previous chapter, the new MotorController definition becomes as follows:
pub struct SimpleMotorController{ pub esp: ElevatorSpecification}impl MotorController for SimpleMotorController{ fn init(&mut self, esp: ElevatorSpecification, ...