From cfb0e1127220b769f759a8b4186b3f345e4338f3 Mon Sep 17 00:00:00 2001 From: Yannis Chatzikonstantinou Date: Fri, 14 Jun 2019 22:48:57 +0300 Subject: [PATCH] add check for vel_limt == 0 --- Firmware/MotorControl/controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/MotorControl/controller.cpp b/Firmware/MotorControl/controller.cpp index 8fb179be..642e1785 100644 --- a/Firmware/MotorControl/controller.cpp +++ b/Firmware/MotorControl/controller.cpp @@ -201,7 +201,7 @@ bool Controller::update(float pos_estimate, float vel_estimate, float* current_s } // Velocity limiting in current mode - if (config_.control_mode < CTRL_MODE_VELOCITY_CONTROL) { + if (config_.control_mode < CTRL_MODE_VELOCITY_CONTROL && config_.vel_limit > 0) { float Imax = (config_.vel_limit - fabsf(vel_estimate)) * config_.vel_gain; if (Iq > 0 && Iq > Imax) { limited = true;