From 21d7d2a6bff1bc5148b1affc333cc91e4bf5544e Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 21 Apr 2020 16:28:10 +0200 Subject: [PATCH] pbio/source: double default drivebase acceleration As acceleration, we take double the single motor amount, because drivebases are usually expected to respond quickly to speed setpoint changes, particularly when following lines. --- lib/pbio/src/drivebase.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pbio/src/drivebase.c b/lib/pbio/src/drivebase.c index 7adefd32d..d2a18f409 100644 --- a/lib/pbio/src/drivebase.c +++ b/lib/pbio/src/drivebase.c @@ -16,13 +16,16 @@ static pbio_error_t drivebase_adopt_settings(pbio_control_settings_t *s_distance // All rate/count acceleration limits add up, because distance state is two motors counts added s_distance->max_rate = s_left->max_rate + s_right->max_rate; - s_distance->abs_acceleration = s_left->abs_acceleration + s_right->abs_acceleration; s_distance->rate_tolerance = s_left->rate_tolerance + s_right->rate_tolerance; s_distance->count_tolerance = s_left->count_tolerance + s_right->count_tolerance; s_distance->stall_rate_limit = s_left->stall_rate_limit + s_right->stall_rate_limit; s_distance->integral_range = s_left->integral_range + s_right->integral_range; s_distance->integral_rate = s_left->integral_rate + s_right->integral_rate; + // As acceleration, we take double the single motor amount, because drivebases are + // usually expected to respond quickly to speed setpoint changes + s_distance->abs_acceleration = (s_left->abs_acceleration + s_right->abs_acceleration)*2; + // Although counts/errors add up twice as fast, both motors actuate, so apply half of the average PID s_distance->pid_kp = (s_left->pid_kp + s_right->pid_kp)/4; s_distance->pid_ki = (s_left->pid_ki + s_right->pid_ki)/4;