@@ -37,6 +37,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
37
37
.duty_cycle = 50 ,
38
38
.group_id = 0 ,
39
39
.seq_id = 0 ,
40
+ .stay_engaged = 0 ,
40
41
.stop_condition = MoveStopCondition::limit_switch};
41
42
test_objs.queue .try_write_isr (msg);
42
43
@@ -49,6 +50,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
49
50
THEN (" The motor hardware proceeds to home" ) {
50
51
/* motor shouldn't be gripping */
51
52
REQUIRE (!test_objs.hw .get_is_gripping ());
53
+ REQUIRE (!test_objs.hw .get_stay_enabled ());
52
54
test_objs.hw .set_encoder_value (1000 );
53
55
test_objs.hw .set_limit_switch (true );
54
56
@@ -67,6 +69,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
67
69
REQUIRE (read_ack.ack_id ==
68
70
AckMessageId::stopped_by_condition);
69
71
REQUIRE (test_objs.handler .is_idle );
72
+ REQUIRE (!test_objs.hw .get_stay_enabled ());
70
73
}
71
74
}
72
75
}
@@ -79,6 +82,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
79
82
REQUIRE (test_objs.reporter .messages .size () == 1 );
80
83
Ack read_ack = std::get<Ack>(test_objs.reporter .messages .back ());
81
84
REQUIRE (read_ack.ack_id == AckMessageId::timeout);
85
+ REQUIRE (!test_objs.hw .get_stay_enabled ());
82
86
}
83
87
}
84
88
@@ -87,6 +91,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
87
91
.duty_cycle = 50 ,
88
92
.group_id = 0 ,
89
93
.seq_id = 0 ,
94
+ .stay_engaged = 1 ,
90
95
.stop_condition = MoveStopCondition::none};
91
96
test_objs.queue .try_write_isr (msg);
92
97
@@ -99,6 +104,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
99
104
THEN (" The motor hardware proceeds to grip" ) {
100
105
/* motor should be gripping */
101
106
REQUIRE (test_objs.hw .get_is_gripping ());
107
+ REQUIRE (test_objs.hw .get_stay_enabled ());
102
108
test_objs.hw .set_encoder_value (30000 );
103
109
104
110
AND_WHEN (" The encoder speed timer overflows" ) {
@@ -125,6 +131,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
125
131
REQUIRE (read_ack.encoder_position == 30000 );
126
132
REQUIRE (read_ack.ack_id ==
127
133
AckMessageId::complete_without_condition);
134
+ REQUIRE (test_objs.hw .get_stay_enabled ());
128
135
}
129
136
}
130
137
}
@@ -140,6 +147,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
140
147
REQUIRE (test_objs.reporter .messages .size () == 1 );
141
148
Ack read_ack = std::get<Ack>(test_objs.reporter .messages .back ());
142
149
REQUIRE (read_ack.ack_id == AckMessageId::timeout);
150
+ REQUIRE (test_objs.hw .get_stay_enabled ());
143
151
}
144
152
}
145
153
GIVEN (" A message to move" ) {
@@ -226,13 +234,15 @@ SCENARIO("estop pressed during Brushed motor interrupt handler") {
226
234
.duty_cycle = 50 ,
227
235
.group_id = 0 ,
228
236
.seq_id = 0 ,
237
+ .stay_engaged = 1 ,
229
238
.stop_condition = MoveStopCondition::limit_switch};
230
239
test_objs.queue .try_write_isr (msg);
231
240
WHEN (" Estop is pressed" ) {
232
241
// Burn through the startup ticks
233
242
for (uint32_t i = 0 ; i <= HOLDOFF_TICKS; i++) {
234
243
test_objs.handler .run_interrupt ();
235
244
}
245
+ REQUIRE (test_objs.hw .get_stay_enabled ());
236
246
test_objs.hw .set_estop_in (true );
237
247
test_objs.handler .run_interrupt ();
238
248
THEN (" Errors are sent" ) {
@@ -242,6 +252,7 @@ SCENARIO("estop pressed during Brushed motor interrupt handler") {
242
252
std::get<can::messages::ErrorMessage>(
243
253
test_objs.reporter .messages .front ());
244
254
REQUIRE (err.error_code == can::ids::ErrorCode::estop_detected);
255
+ REQUIRE (test_objs.hw .get_stay_enabled ());
245
256
}
246
257
}
247
258
}
@@ -255,6 +266,7 @@ SCENARIO("labware dropped during grip move") {
255
266
.duty_cycle = 50 ,
256
267
.group_id = 0 ,
257
268
.seq_id = 0 ,
269
+ .stay_engaged = 1 ,
258
270
.stop_condition = MoveStopCondition::none};
259
271
test_objs.queue .try_write_isr (msg);
260
272
WHEN (" grip is complete" ) {
@@ -263,6 +275,7 @@ SCENARIO("labware dropped during grip move") {
263
275
for (uint32_t i = 0 ; i <= 100 ; i++) {
264
276
test_objs.handler .run_interrupt ();
265
277
}
278
+ REQUIRE (test_objs.hw .get_stay_enabled ());
266
279
test_objs.handler .set_enc_idle_state (true );
267
280
test_objs.handler .run_interrupt ();
268
281
THEN (" Move complete message is sent" ) {
@@ -303,6 +316,7 @@ SCENARIO("collision while homed") {
303
316
.duty_cycle = 50 ,
304
317
.group_id = 0 ,
305
318
.seq_id = 0 ,
319
+ .stay_engaged = 0 ,
306
320
.stop_condition = MoveStopCondition::limit_switch};
307
321
test_objs.queue .try_write_isr (msg);
308
322
WHEN (" home is complete" ) {
0 commit comments