InProcessActionChunkProducer Class
Runs a policy that answers in process, without blocking the streaming loop. More...
Declaration
Included Headers
Base class
| class | ActionChunkProducerInterface |
|
Runs one inference of a policy that produces trajectory chunks. More... | |
Public Member Typedefs Index
| using | Predict = std::function< GetActionChunk::Response(const GetActionChunk::Request &, const moveit_pro_ml::model::RunControl &)> |
|
Answers one request, blocking until the response is ready. A failure is a response with status ERROR. More... | |
Public Constructors Index
| InProcessActionChunkProducer (Predict predict, std::chrono::duration< double > timeout, PolicyRunGuard::Lease lease={}) | |
| InProcessActionChunkProducer (const InProcessActionChunkProducer &)=delete | |
| InProcessActionChunkProducer (InProcessActionChunkProducer &&)=delete | |
Public Destructor Index
| ~InProcessActionChunkProducer () override | |
|
Cancels the run and waits for an in-flight call to return. More... | |
Public Operators Index
| InProcessActionChunkProducer & | operator= (const InProcessActionChunkProducer &)=delete |
| InProcessActionChunkProducer & | operator= (InProcessActionChunkProducer &&)=delete |
Public Member Functions Index
| tl::expected< void, std::string > | startActionChunkInference (const GetActionChunk::Request &request) override |
|
Begin one inference without waiting for it. More... | |
| std::optional< InferenceResult > | pollActionChunkInference () override |
|
Check the inference begun by startActionChunkInference() for a result. More... | |
| tl::expected< void, std::string > | warmup (const GetActionChunk::Request &sample_request) override |
| void | cancelActionChunkInference () override |
|
Cancel this run and discard any later result. More... | |
Private Member Attributes Index
| Predict | predict_ |
| PolicyRunGuard::Lease | lease_ |
| std::chrono::duration< double > | timeout_ |
| moveit_pro_ml::model::RunControl | control_ |
| std::future< GetActionChunk::Response > | pending_ |
| std::jthread | worker_ |
| bool | awaiting_response_ = false |
| std::chrono::steady_clock::time_point | call_start_ {} |
Description
Runs a policy that answers in process, without blocking the streaming loop.
Each call runs on its own thread, owned by this producer, so the streaming loop keeps its safety checks running while the model computes. Cancellation and timeout ask the model to stop through RunControl and discard any late response. Destruction waits for an in-flight call to return, so halting ExecutePolicy returns once the current pass finishes, and the handle admits its next run only after that.
Not thread-safe except for cancelActionChunkInference(), as ActionChunkProducerInterface documents.
Definition at line 35 of file in_process_action_chunk_producer.hpp.
Public Member Typedefs
Predict
|
Answers one request, blocking until the response is ready. A failure is a response with status ERROR.
Definition at line 39 of file in_process_action_chunk_producer.hpp.
Public Constructors
InProcessActionChunkProducer()
|
- Parameters
-
predict The policy. Called on a background thread, one call at a time.
timeout How long one call may run before it is asked to stop and reported as a failure. A call that finished before the owner polls is returned even past this bound.
lease Keeps the policy handle busy until this producer is destroyed.
Declaration at line 48 of file in_process_action_chunk_producer.hpp, definition at line 59 of file in_process_action_chunk_producer.cpp.
InProcessActionChunkProducer()
| delete |
Definition at line 52 of file in_process_action_chunk_producer.hpp.
InProcessActionChunkProducer()
| delete |
Definition at line 54 of file in_process_action_chunk_producer.hpp.
Public Destructor
~InProcessActionChunkProducer()
|
Cancels the run and waits for an in-flight call to return.
Declaration at line 50 of file in_process_action_chunk_producer.hpp, definition at line 65 of file in_process_action_chunk_producer.cpp.
Public Operators
operator=()
| delete |
Definition at line 53 of file in_process_action_chunk_producer.hpp.
operator=()
| delete |
Definition at line 55 of file in_process_action_chunk_producer.hpp.
Public Member Functions
cancelActionChunkInference()
| virtual |
Cancel this run and discard any later result.
Must be thread-safe and nonblocking; a halt calls it from another thread.
Declaration at line 66 of file in_process_action_chunk_producer.hpp, definition at line 159 of file in_process_action_chunk_producer.cpp.
pollActionChunkInference()
| virtual |
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. A result that is ready when polled is returned even if the call timeout has passed, so a loop busy with other checks does not lose a completed chunk.
Declaration at line 60 of file in_process_action_chunk_producer.hpp, definition at line 100 of file in_process_action_chunk_producer.cpp.
startActionChunkInference()
| virtual |
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().
Declaration at line 58 of file in_process_action_chunk_producer.hpp, definition at line 72 of file in_process_action_chunk_producer.cpp.
warmup()
| virtual |
Runs one prediction to completion before the run's clock starts, so the first streamed call does not pay the device's first-use cost, and fails when the policy cannot answer the request.
Declaration at line 64 of file in_process_action_chunk_producer.hpp, definition at line 136 of file in_process_action_chunk_producer.cpp.
Private Member Attributes
awaiting_response_
|
Definition at line 80 of file in_process_action_chunk_producer.hpp.
call_start_
|
Definition at line 81 of file in_process_action_chunk_producer.hpp.
control_
|
Definition at line 74 of file in_process_action_chunk_producer.hpp.
lease_
|
Definition at line 70 of file in_process_action_chunk_producer.hpp.
pending_
|
Definition at line 78 of file in_process_action_chunk_producer.hpp.
predict_
|
Definition at line 69 of file in_process_action_chunk_producer.hpp.
timeout_
|
Definition at line 71 of file in_process_action_chunk_producer.hpp.
worker_
|
Definition at line 79 of file in_process_action_chunk_producer.hpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.