From a60aab46018a456df7f3ab6c5661711e0e00878c Mon Sep 17 00:00:00 2001 From: Josh Pieper Date: Mon, 9 May 2022 17:09:06 -0400 Subject: [PATCH] Hmmm, don't know how this wasn't needed initially All tests now indicate that the factor of half is necessary here to get reasonable results, which also makes sense since the voltage is only the difference from the virtual center. --- fw/bldc_servo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fw/bldc_servo.cc b/fw/bldc_servo.cc index 88fe6b74..b0651455 100644 --- a/fw/bldc_servo.cc +++ b/fw/bldc_servo.cc @@ -1685,7 +1685,7 @@ class BldcServo::Impl { // This is conservative... we could use std::hypot(d, q), however // that would take more CPU cycles, and most of the time we'll // only be seeing q != 0. - const float max_V = adjusted_max_power_W_ / + const float max_V = 0.5f * adjusted_max_power_W_ / (std::abs(status_.d_A) + std::abs(status_.q_A)); if (!config_.voltage_mode_control) {