Skip to content

Commit 341d0bc

Browse files
committed
pbio/test/trajectory: Test start and endpoint.
1 parent 6fa81f5 commit 341d0bc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/pbio/test/src/trajectory.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,21 @@ static void test_position_trajectory(void *env) {
324324
// Otherwise we want success.
325325
tt_want_int_op(err, ==, PBIO_SUCCESS);
326326

327+
// Get command again in case it was changed.
328+
get_position_command(i, &command);
329+
330+
// Check reference endpoint.
331+
pbio_trajectory_reference_t end;
332+
pbio_trajectory_get_endpoint(&trj, &end);
333+
if (command.speed_target == 0) {
334+
// With zero movement, we expect stationary, so start equals end.
335+
tt_want_int_op(pbio_angle_diff_mdeg(&trj.start.position, &end.position), ==, 0);
336+
} else {
337+
// When there is movement, assert that start and endpoint match command.
338+
tt_want_int_op(pbio_angle_diff_mdeg(&trj.start.position, &command.position_start), ==, 0);
339+
tt_want_int_op(pbio_angle_diff_mdeg(&end.position, &command.position_end), ==, 0);
340+
}
341+
327342
// Verify that we maintain a constant speed when done.
328343
if (command.continue_running) {
329344
tt_want_int_op(trj.w3, ==, trj.w1);

0 commit comments

Comments
 (0)