Skip to content

Commit

Permalink
pbio/control: fix relative travel by 0 angle
Browse files Browse the repository at this point in the history
Previously, this behavior was not well-defined in case of trajectory patching. For now, this enforces hold behavior, going vertically to the origin in the angle/speed phase plot. This matches the behavior of angles > 0

In the future, relative angles >= 0 with speed in excess of what it can decelerate in time without overshoot, should curve around the origin of the phase plot, then decelerate smoothly back to the target. This is already done for angles < 0.
  • Loading branch information
laurensvalk committed Apr 20, 2020
1 parent f727c1a commit 672b493
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/pbio/src/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ pbio_error_t pbio_control_start_relative_angle_control(pbio_control_t *ctl, int3
// The target count is the start count plus the count to be traveled. If speed is negative, traveled count also flips.
int32_t target_count = count_start + (target_rate < 0 ? -relative_target_count: relative_target_count);

// FIXME: Enable 0 angle and angle > 0 with excess speed as standard case instead to decelerate & return.
if (target_count == count_start) {
return pbio_control_start_hold_control(ctl, time_now, target_count);
}

return pbio_control_start_angle_control(ctl, time_now, count_now, target_count, rate_now, target_rate, acceleration, after_stop);
}

Expand Down

0 comments on commit 672b493

Please sign in to comment.