mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-21 23:44:48 +08:00
make encoder dir find and overspeed check
This commit is contained in:
@@ -274,6 +274,15 @@ bool Encoder::update() {
|
||||
snap_to_zero_vel = true;
|
||||
}
|
||||
|
||||
// Check overspeed fault
|
||||
if (config_.overspeed_fault_ratio != 0.0f) { // 0.0f = disabled
|
||||
// TODO: Use separate encoder, motor, controller vel_lim: take min
|
||||
if (fabsf(vel_estimate_) > config_.overspeed_fault_ratio * axis_->controller_.config_.vel_limit) {
|
||||
set_error(ERROR_OVERSPEED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//// run encoder count interpolation
|
||||
int32_t corrected_enc = count_in_cpr_ - config_.offset;
|
||||
// if we are stopped, make sure we don't randomly drift
|
||||
|
||||
Reference in New Issue
Block a user