@@ -269,8 +269,19 @@ auto FieldOperatorApplication::engage() -> void
269
269
" The simulator attempted to request Autoware to engage, but was aborted because "
270
270
" Autoware's current state is " ,
271
271
state, " ." );
272
+ case LegacyAutowareState::initializing:
273
+ // The initial pose has been sent but has not yet reached Autoware.
274
+ waitForAutowareStateToBe (
275
+ LegacyAutowareState::initializing, LegacyAutowareState::waiting_for_route);
276
+ [[fallthrough]];
277
+ case LegacyAutowareState::waiting_for_route:
278
+ // The route has been sent but has not yet reached Autoware.
279
+ waitForAutowareStateToBe (
280
+ LegacyAutowareState::waiting_for_route, LegacyAutowareState::planning);
281
+ [[fallthrough]];
272
282
case LegacyAutowareState::planning:
273
- waitForAutowareStateToBe (LegacyAutowareState::waiting_for_engage);
283
+ waitForAutowareStateToBe (
284
+ LegacyAutowareState::planning, LegacyAutowareState::waiting_for_engage);
274
285
[[fallthrough]];
275
286
case LegacyAutowareState::waiting_for_engage:
276
287
requestEngage (
@@ -280,8 +291,12 @@ auto FieldOperatorApplication::engage() -> void
280
291
return request;
281
292
}(),
282
293
30 );
294
+ waitForAutowareStateToBe (
295
+ LegacyAutowareState::waiting_for_engage, LegacyAutowareState::driving);
283
296
time_limit = std::decay_t <decltype (time_limit)>::max ();
284
297
break ;
298
+ case LegacyAutowareState::driving:
299
+ break ;
285
300
}
286
301
});
287
302
}
@@ -309,6 +324,10 @@ auto FieldOperatorApplication::initialize(const geometry_msgs::msg::Pose & initi
309
324
" The simulator attempted to initialize Autoware, but aborted because Autoware's "
310
325
" current state is " ,
311
326
state, " ." );
327
+ case LegacyAutowareState::undefined:
328
+ waitForAutowareStateToBe (
329
+ LegacyAutowareState::undefined, LegacyAutowareState::initializing);
330
+ [[fallthrough]];
312
331
case LegacyAutowareState::initializing:
313
332
requestInitialPose (
314
333
[&]() {
@@ -324,6 +343,8 @@ auto FieldOperatorApplication::initialize(const geometry_msgs::msg::Pose & initi
324
343
return request;
325
344
}(),
326
345
30 );
346
+ waitForAutowareStateToBe (
347
+ LegacyAutowareState::initializing, LegacyAutowareState::waiting_for_route);
327
348
break ;
328
349
}
329
350
});
@@ -343,8 +364,9 @@ auto FieldOperatorApplication::plan(const std::vector<geometry_msgs::msg::PoseSt
343
364
" current state is " ,
344
365
state, " ." );
345
366
case LegacyAutowareState::initializing:
367
+ // The initial pose has been sent but has not yet reached Autoware.
346
368
case LegacyAutowareState::arrived_goal:
347
- waitForAutowareStateToBe (LegacyAutowareState::waiting_for_route);
369
+ waitForAutowareStateToBe (state, LegacyAutowareState::waiting_for_route);
348
370
[[fallthrough]];
349
371
case LegacyAutowareState::waiting_for_route:
350
372
requestSetRoutePoints (
@@ -369,7 +391,7 @@ auto FieldOperatorApplication::plan(const std::vector<geometry_msgs::msg::PoseSt
369
391
370
392
[1] https://github.com/autowarefoundation/autoware_adapi_msgs/commit/805f8ebd3ca24564844df9889feeaf183101fbef
371
393
[2] https://github.com/autowarefoundation/autoware_adapi_msgs/commit/cf310bd038673b6cbef3ae3b61dfe607212de419
372
- */
394
+ */
373
395
if constexpr (
374
396
DetectMember_option<SetRoutePoints::Request>::value and
375
397
DetectMember_allow_goal_modification<
@@ -381,6 +403,10 @@ auto FieldOperatorApplication::plan(const std::vector<geometry_msgs::msg::PoseSt
381
403
return request;
382
404
}(),
383
405
30 );
406
+ waitForAutowareStateToBe (
407
+ LegacyAutowareState::waiting_for_route, LegacyAutowareState::planning);
408
+ waitForAutowareStateToBe (
409
+ LegacyAutowareState::planning, LegacyAutowareState::waiting_for_engage);
384
410
break ;
385
411
}
386
412
});
0 commit comments