Public Member Functions | |
FeedbackMotor (bool internal_pwm, uint8_t external_speed_pin, PinName internal_speed_pin, PinName microswitch_pin, PinMode microswitch_mode=PullNone) | |
virtual void | updateMotor () |
virtual bool | setControlParameters (uint8_t length, uint8_t *data) |
virtual uint8_t * | readControlParameters (uint8_t &length) |
virtual long | readTargetPosition () |
virtual long | readTargetVelocity () |
virtual void | setDestination (long encoderPosition, long duration) |
Protected Attributes | |
float | dt_ |
float | target_position_ |
float | position_error_ |
float | target_velocity_ |
float | integral_error_ |
float | p_gain_ |
float | i_gain_ |
float | d_gain_ |
float | i_saturation_ |
float | max_pwm_ |
float | velocity_threshold_ |
float | pwm_ |
bool | control_enabled_ |
Definition at line 8 of file feedback_motor.h.
bool FeedbackMotor::setControlParameters | ( | uint8_t | length, | |
uint8_t * | data | |||
) | [virtual] |
Update the control algorithm's parameters
Takes in raw data from the serial port, checks the length, and deserializes the data. Note: it is the implementer's responsibility to deallocate the data using the delete operator.
int | length The number of bytes in the data buffer | |
uint8_t | *data The serialized parameters |
Implements Motor.
Definition at line 76 of file feedback_motor.cpp.
References Motor::update_in_progress_.
void FeedbackMotor::updateMotor | ( | ) | [virtual] |
Runs a single step of the control algorithm
Updates the PWM value for the given motor
Implements Motor.
Definition at line 27 of file feedback_motor.cpp.
References Motor::desired_distance_, Motor::desired_encoder_, Motor::desired_move_duration_, Motor::encoder_, Motor::move_duration_, and Motor::update_in_progress_.