Skip to content

Commit

Permalink
Revert a60aab4
Browse files Browse the repository at this point in the history
I'm not sure what I was testing with, but all 5 motors I have tested
with today limit to half of the power specified with this change.
  • Loading branch information
jpieper committed Jul 28, 2022
1 parent 25bc68a commit dcb900c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fw/bldc_servo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,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 = 0.5f * adjusted_max_power_W_ /
const float max_V = adjusted_max_power_W_ /
(std::abs(status_.d_A) + std::abs(status_.q_A));

if (!config_.voltage_mode_control) {
Expand Down
17 changes: 12 additions & 5 deletions utils/dynamometer_drive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1898,11 +1898,13 @@ class Application {
double expected_speed_Hz;
} tests[] = {
{ 100.0, 4.04 },
{ 20.0, 2.20 },
{ 10.0, 1.35 },
{ 5.0, 1.00 },
{ 20.0, 3.12 },
{ 10.0, 2.14 },
{ 5.0, 1.43 },
};

std::string errors;

for (const auto test : tests) {
dut_pid.max_power_W = test.power_W;
co_await dut_->ConfigurePid(dut_pid);
Expand All @@ -1920,10 +1922,11 @@ class Application {
fmt::print("Power {} / Speed {}\n", test.power_W, average_speed);

if (RelativeError(average_speed, test.expected_speed_Hz) > 0.15) {
throw mjlib::base::system_error::einval(
if (!errors.empty()) { errors += "\n"; }
errors +=
fmt::format(
"Speed {} != {} (within {}%)",
average_speed, test.expected_speed_Hz, 0.15 * 100));
average_speed, test.expected_speed_Hz, 0.15 * 100);
}

co_await dut_->Command("d stop");
Expand All @@ -1934,6 +1937,10 @@ class Application {
co_await dut_->Command("d stop");
co_await fixture_->Command("d stop");

if (!errors.empty()) {
throw mjlib::base::system_error::einval(errors);
}

co_return;
}

Expand Down

0 comments on commit dcb900c

Please sign in to comment.