pbio/test/trajectory: Test shortest trajectory.
While sub-degree maneuvers cannot be entered by users, we can still have sub-degree maneuvers if a new command is started while the trajectory is already near the target.
This happens relatively often when restarting run_target towards the same target in a tight loop.
See
@@ -145,6 +145,7 @@ static void walk_trajectory(pbio_trajectory_t *trj) {
// Start and end angles in millidegrees.
static const pbio_angle_t angles[] = {
{.rotations = 0, .millidegrees = 0 },
+ {.rotations = 0, .millidegrees = 1 },
{.rotations = 0, .millidegrees = 1 * MDEG_PER_DEG },
{.rotations = 0, .millidegrees = 30 * MDEG_PER_DEG },
{.rotations = 0, .millidegrees = 360 * MDEG_PER_DEG },
@@ -351,7 +352,11 @@ static void test_position_trajectory(void *env) {
pbio_trajectory_reference_t ref;
pbio_trajectory_get_reference(&trj, command.time_start, &ref);
get_position_command(i, &command);
+
+ // FIXME: This should pass even for t1 == 0.
+ if (trj.t1 > 0) {
tt_want(pbio_int_math_sign_not_opposite(ref.speed, command.speed_start));
+ }
// Walk the whole trajectory.
walk_trajectory(&trj);
