Deferrable + Canceleable Lifecycle Transitions

Yes there are a few ways to call a service within a service as you mention. You can spin up another internal executor although I would personally put this into the “hacky-workaround” bin. Not that the workaround is bad but more-so that it should* not be necessary for a common functional need of calling a service from within a service.

I think a good point @oysstu brings up here is there should* exist something that allows you to easily to throw callback work onto the executor (I’m also a big fan of coroutines coming more from the games world / another rclcpp discussion I found discussing coroutines while working on this: rclcpp#1533). I think this would be a great issue to bring up / feature to add (although a bit off topic for the core of this post in my opinion).

One of the core ideas and motivations of this post is to allow for cancellation requests from external nodes while mid-transition. This also extends toward the idea we want other services available while a transition is ongoing (e.g., GetState.srv).

This is not possible* (although I am sure there is a very hacky workaround) with spinning up a secondary executor as your node’s main executor cannot receive/process any requests as it is still servicing the ChangeState callback itself (unless the node is on a multithreaded executor which shouldn’t* be a requirement).

1 Like