Skip to content

Commit 7deaa90

Browse files
committed
pbio/test/drivebase: Test stopping parent.
1 parent 6019de5 commit 7deaa90

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/pbio/test/src/test_drivebase.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ static PT_THREAD(test_drivebase_basics(struct pt *pt)) {
5252
static bool stalled;
5353
static uint32_t stall_duration;
5454

55+
static pbio_dcmotor_actuation_t actuation;
56+
static int32_t voltage;
57+
5558
// Start motor driver simulation process.
5659
pbdrv_motor_driver_init_manual();
5760

@@ -141,6 +144,17 @@ static PT_THREAD(test_drivebase_basics(struct pt *pt)) {
141144
tt_want(pbio_test_int_is_close(drive_speed, 200, 5));
142145
tt_want(pbio_test_int_is_close(turn_rate, 90, 5));
143146

147+
// Stopping a single servo should stop both servos and the drivebase.
148+
pbio_dcmotor_get_state(srv_left->dcmotor, &actuation, &voltage);
149+
tt_uint_op(actuation, ==, PBIO_DCMOTOR_ACTUATION_VOLTAGE);
150+
pbio_dcmotor_get_state(srv_right->dcmotor, &actuation, &voltage);
151+
tt_uint_op(actuation, ==, PBIO_DCMOTOR_ACTUATION_VOLTAGE);
152+
tt_uint_op(pbio_servo_stop(srv_left, PBIO_CONTROL_ON_COMPLETION_COAST), ==, PBIO_SUCCESS);
153+
pbio_dcmotor_get_state(srv_left->dcmotor, &actuation, &voltage);
154+
tt_uint_op(actuation, ==, PBIO_DCMOTOR_ACTUATION_COAST);
155+
pbio_dcmotor_get_state(srv_right->dcmotor, &actuation, &voltage);
156+
tt_uint_op(actuation, ==, PBIO_DCMOTOR_ACTUATION_COAST);
157+
144158
end:
145159

146160
PT_END(pt);

0 commit comments

Comments
 (0)