14 #ifndef _PBIO_OBSERVER_H_ 15 #define _PBIO_OBSERVER_H_ 147 #endif // _PBIO_OBSERVER_H_ int32_t d_current_d_voltage
uint32_t stall_start
If stalled, this is the time that stall was first detected.
int32_t feedback_voltage_stall_ratio
When the motor is stuck, the observer moves ahead and pushes back with a feedback voltage...
int32_t d_speed_d_current
struct _pbio_observer_model_t pbio_observer_model_t
Device-type specific constants that describe the motor model.
uint32_t stall_time
Minimum consecutive stall time before stall flag getter returns true.
bool pbio_observer_is_stalled(const pbio_observer_t *obs, uint32_t time, uint32_t *stall_duration)
Checks whether system is stalled by testing how far the estimate is ahead of the measured angle...
int32_t d_current_d_speed
Device-type specific constants that describe the motor model.
int32_t feedback_gain_low
Feedback gain (mV/deg) to correct the observer for low estimation errors.
int32_t current
Current state of observer (estimated system current) in tenths of milliAmperes: 10000 = 1A...
int32_t d_angle_d_current
int32_t feedback_voltage_negligible
Lower limit of the feedback voltage where we cannot get useful stall information because it is less t...
int32_t d_torque_d_acceleration
int32_t pbio_observer_torque_to_voltage(const pbio_observer_model_t *model, int32_t desired_torque)
Converts a torque to a voltage based on the given motor model.
Motor state observer object.
int32_t speed
Speed state of observer (estimated system speed) in millidegrees/second.
bool stalled
Whether the motor is stalled according to the model.
int32_t d_torque_d_voltage
pbio_observer_settings_t settings
Control settings, which includes stall settings.
int32_t pbio_observer_voltage_to_torque(const pbio_observer_model_t *model, int32_t voltage)
Converts a voltage to a torque based on the given motor model.
Configurable observer settings.
int32_t feedback_gain_high
Feedback gain (mV/deg) to correct the observer for high estimation error.
int32_t d_current_d_torque
void pbio_observer_update(pbio_observer_t *obs, uint32_t time, const pbio_angle_t *angle, pbio_dcmotor_actuation_t actuation, int32_t voltage)
Predicts next system state and corrects the model using a measurement.
int32_t pbio_observer_get_max_torque(void)
Gets the maximum torque for use by user input validators.
int32_t pbio_observer_get_feedforward_torque(const pbio_observer_model_t *model, int32_t rate_ref, int32_t acceleration_ref)
Calculates the feedforward torque needed to achieve the requested reference rotational speed and acce...
pbio_dcmotor_actuation_t
Actuation types that can be applied by a dc motor.
int32_t feedback_gain_threshold
Threshold angle (mdeg) from which the higher observer feedback is used.
int32_t coulomb_friction_speed_cutoff
Speed (mdeg/s) below which the coulomb friction starts to linearly scale to zero to avoid a sudden nu...
Angle type for up to 2^31 rotations with millidegree resolution.
int32_t d_speed_d_voltage
pbio_differentiator_t differentiator
Numeric angle differentiator used to verify estimated speed.
int32_t speed_numeric
Latest speed value from angle differentiator.
Differentiator of position signal.
struct _pbio_observer_settings_t pbio_observer_settings_t
Configurable observer settings.
void pbio_observer_get_estimated_state(const pbio_observer_t *obs, int32_t *speed_num, pbio_angle_t *angle_est, int32_t *speed_est)
Gets the observer state, which is the estimated state of the real system.
struct _pbio_observer_t pbio_observer_t
Motor state observer object.
void pbio_observer_reset(pbio_observer_t *obs, const pbio_angle_t *angle)
Resets the observer to a new angle.
const pbio_observer_model_t * model
Model parameters used by this model.
int32_t d_voltage_d_torque
int32_t pbio_observer_get_feedback_voltage(const pbio_observer_t *obs, const pbio_angle_t *angle)
Gets observer feedback voltage that keeps it close to measured value.
int32_t d_current_d_current
int32_t stall_speed_limit
If this speed cannot be reached even with the maximum control signal defined in actuation_max, the controller is stalled.
pbio_angle_t angle
Angle state of observer (estimated system angle) in millidegrees.
int32_t d_angle_d_voltage