From 07406d103e83760e2670ce5c3a15fbf017413dea Mon Sep 17 00:00:00 2001 From: Josh Pieper Date: Mon, 4 Dec 2023 14:50:57 -0500 Subject: [PATCH] Tweak in-family results and ensure that main loop stalls will result in faults --- utils/dynamometer_drive.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/dynamometer_drive.cc b/utils/dynamometer_drive.cc index 97f93d2a..1b3c1e40 100644 --- a/utils/dynamometer_drive.cc +++ b/utils/dynamometer_drive.cc @@ -449,6 +449,8 @@ class Controller { fmt::format("conf set motor_position.output.sign {}", pid.output_sign)); } + co_await Command("conf set servo.timing_fault 1"); + co_return; } @@ -2041,8 +2043,8 @@ class Application { } tests[] = { { 100.0, 3.80 }, { 20.0, 3.00 }, - { 10.0, 1.90 }, - { 5.0, 1.30 }, + { 10.0, 2.00 }, + { 5.0, 1.40 }, }; std::string errors; @@ -2060,15 +2062,16 @@ class Application { co_await Sleep(0.5); const double end_pos = dut_->servo_stats().position; const double average_speed = (end_pos - start_pos) / 0.5; + constexpr double tolerance = 0.20; fmt::print("Power {} / Speed {}\n", test.power_W, average_speed); - if (RelativeError(average_speed, test.expected_speed_Hz) > 0.15) { + if (RelativeError(average_speed, test.expected_speed_Hz) > tolerance) { 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, tolerance * 100); } co_await dut_->Command("d stop");