Skip to content

Commit 323c8ea

Browse files
committed
pbio/test/trajectory: Fix test for small speed reductions.
1 parent 9af922d commit 323c8ea

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/pbio/test/src/test_trajectory.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,14 @@ static void test_position_trajectory(void *env) {
354354
tt_want_int_op(trj.w3, ==, 0);
355355
}
356356

357-
// Initial speed may now be bounded. Verify that the sign is the same.
357+
// Initial speed may now be bounded. Verify that the sign is the same,
358+
// or more precisely, not opposite. First we get reference to compare.
358359
pbio_trajectory_reference_t ref;
359360
pbio_trajectory_get_reference(&trj, command.time_start, &ref);
360361
get_position_command(i, &command);
361-
362-
// FIXME: This should pass even for t1 == 0.
363-
if (trj.t1 > 0) {
362+
int32_t speed_difference = pbio_int_math_abs(ref.speed - command.speed_start);
363+
// We avoid doing this check for nonzero but negligible speed differences.
364+
if (!speed_difference || speed_difference > 2 * MDEG_PER_DEG) {
364365
tt_want(pbio_int_math_sign_not_opposite(ref.speed, command.speed_start));
365366
}
366367

0 commit comments

Comments
 (0)