ActionChunkProducerInterface Class
Runs one inference of a policy that produces trajectory chunks. More...
Declaration
Included Headers
Public Member Typedefs Index
| using | GetActionChunk = moveit_pro_ml_msgs::srv::GetActionChunk |
| using | InferenceResult = tl::expected< GetActionChunk::Response, std::string > |
|
Outcome of one inference: the policy response, or an error if the call could not complete. More... | |
Public Destructor Index
| ~ActionChunkProducerInterface ()=default | |
Public Member Functions Index
| tl::expected< void, std::string > | startActionChunkInference (const GetActionChunk::Request &request)=0 |
|
Begin one inference without waiting for it. More... | |
| std::optional< InferenceResult > | pollActionChunkInference ()=0 |
|
Check the inference begun by startActionChunkInference() for a result. More... | |
| tl::expected< void, std::string > | warmup (const GetActionChunk::Request &) |
|
Exercise the full policy round-trip once before the run's clock starts. More... | |
Description
Runs one inference of a policy that produces trajectory chunks.
Hidden behind an interface so the production service client and a test double share one seam. The caller fills the request observation and real-time-chunking carryover, starts the inference, and polls for the result, so it can keep streaming and re-checking motion while the policy computes. One inference is in flight at a time. A failed result means the call itself could not complete; a completed call's response carries its own status, which distinguishes a produced chunk from the policy's graceful end of the run and from a reported error.
Not thread-safe: startActionChunkInference() and pollActionChunkInference() share state, so one thread must own the whole start/poll cycle.
Definition at line 293 of file execute_policy.hpp.
Public Member Typedefs
GetActionChunk
|
Definition at line 296 of file execute_policy.hpp.
InferenceResult
|
Outcome of one inference: the policy response, or an error if the call could not complete.
Definition at line 298 of file execute_policy.hpp.
Public Destructor
~ActionChunkProducerInterface()
| virtual default |
Definition at line 300 of file execute_policy.hpp.
Public Member Functions
pollActionChunkInference()
|
Check the inference begun by startActionChunkInference() for a result.
- Returns
std::nullopt while the inference is still running; otherwise its result, which also ends the in-flight state. Polling with no inference in flight returns an error result.
Definition at line 316 of file execute_policy.hpp.
startActionChunkInference()
|
Begin one inference without waiting for it.
- Parameters
-
request The observation and real-time-chunking carryover for this step.
- Returns
An error if the request could not be sent or an inference is already in flight, otherwise success. The result is collected with pollActionChunkInference().
Definition at line 309 of file execute_policy.hpp.
warmup()
| inline virtual |
Exercise the full policy round-trip once before the run's clock starts.
Sends one throwaway inference so the first streamed inference on the run timeline does not pay the cold cost of establishing the request/response path (service discovery and the transport's first-message endpoint matching, which is seconds on a fresh connection). Paid on the timeline, that cost stalls the first chunk so it lands in the controller's past with nothing to stitch, and inflates the latency estimate that places every later seam. The request is shaped like a first inference (new_episode set). The response's chunk is discarded, but its status is not: a producer must return an error when the policy answers with anything other than a produced chunk or the graceful end of the run, so a policy that is unreachable, still loading, or misconfigured fails the run before the trajectory clock starts. The default does nothing, which suits an in-process producer with no transport to warm.
- Parameters
-
sample_request A representative first-inference request used only to drive the round-trip.
- Returns
An error if the policy cannot be reached or answers with a failing status, otherwise success.
Definition at line 334 of file execute_policy.hpp.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.