File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -298,7 +298,32 @@ where
298298 }
299299
300300 fn execute_goal_expired ( & self ) -> Result < ( ) , RclrsError > {
301- todo ! ( )
301+ // We assume here that only one goal expires at a time. If not, the only consequence is
302+ // that we'll call rcl_action_expire_goals() more than necessary.
303+
304+ // SAFETY: No preconditions
305+ let mut expired_goal = unsafe { rcl_action_get_zero_initialized_goal_info ( ) } ;
306+ let mut num_expired = 1 ;
307+
308+ loop {
309+ unsafe {
310+ // SAFETY: The action server is locked through the handle. The `expired_goal`
311+ // argument points to an array of one rcl_action_goal_info_t and num_expired points
312+ // to a `size_t`.
313+ rcl_action_expire_goals ( & * self . handle . lock ( ) , & mut expired_goal, 1 , & mut num_expired)
314+ }
315+ . ok ( ) ?;
316+
317+ if num_expired > 0 {
318+ // Clean up the expired goal.
319+ let uuid = GoalUuid ( expired_goal. goal_id . uuid ) ;
320+ self . goal_handles . lock ( ) . unwrap ( ) . remove ( & uuid) ;
321+ } else {
322+ break
323+ }
324+ }
325+
326+ Ok ( ( ) )
302327 }
303328
304329 fn publish_status ( & self ) -> Result < ( ) , RclrsError > {
You can’t perform that action at this time.
0 commit comments