@@ -141,8 +141,19 @@ static PT_THREAD(test_drivebase_basics(struct pt *pt)) {
141141 // After a while, the target speed/rate should be reached.
142142 pbio_test_sleep_ms (& timer , 2000 );
143143 tt_uint_op (pbio_drivebase_get_state_user (db , & drive_distance , & drive_speed , & turn_angle , & turn_rate ), = = , PBIO_SUCCESS );
144+ pbio_test_sleep_until (pbio_drivebase_is_done (db ));
144145 tt_want (pbio_test_int_is_close (drive_speed , 200 , 5 ));
145146 tt_want (pbio_test_int_is_close (turn_rate , 90 , 5 ));
147+ tt_uint_op (pbio_drivebase_is_stalled (db , & stalled , & stall_duration ), = = , PBIO_SUCCESS );
148+ tt_want (!stalled );
149+
150+ // Test a small curve.
151+ tt_uint_op (pbio_drivebase_get_state_user (db , & drive_distance , & drive_speed , & turn_angle_start , & turn_rate ), = = , PBIO_SUCCESS );
152+ tt_uint_op (pbio_drivebase_drive_curve (db , 10 , 360 , PBIO_CONTROL_ON_COMPLETION_HOLD ), = = , PBIO_SUCCESS );
153+ pbio_test_sleep_until (pbio_drivebase_is_done (db ));
154+ tt_uint_op (pbio_drivebase_get_state_user (db , & drive_distance , & drive_speed , & turn_angle , & turn_rate ), = = , PBIO_SUCCESS );
155+ tt_want (pbio_test_int_is_close (turn_angle , turn_angle_start + 360 , 5 ));
156+ tt_uint_op (pbio_drivebase_stop (db , PBIO_CONTROL_ON_COMPLETION_HOLD ), = = , PBIO_SUCCESS );
146157
147158 // Stopping a single servo should stop both servos and the drivebase.
148159 pbio_dcmotor_get_state (srv_left -> dcmotor , & actuation , & voltage );
@@ -155,6 +166,11 @@ static PT_THREAD(test_drivebase_basics(struct pt *pt)) {
155166 pbio_dcmotor_get_state (srv_right -> dcmotor , & actuation , & voltage );
156167 tt_uint_op (actuation , = = , PBIO_DCMOTOR_ACTUATION_COAST );
157168
169+ // Closing any motor should make drivebase operations invalid.
170+ tt_uint_op (pbio_dcmotor_close (srv_left -> dcmotor ), = = , PBIO_SUCCESS );
171+ pbio_test_sleep_ms (& timer , 100 );
172+ tt_uint_op (pbio_drivebase_is_stalled (db , & stalled , & stall_duration ), = = , PBIO_ERROR_INVALID_OP );
173+
158174end :
159175
160176 PT_END (pt );
0 commit comments