SaveEpisode Class
End the current episode of the active Trainer recording and snapshot it to the dataset. More...
Declaration
Included Headers
Base class
| class | ServiceClientBehaviorBase<ServiceT> |
|
A base class for behaviors which need to send a request to a ROS service client and wait for a result. More... | |
Public Constructors Index
| SaveEpisode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
|
Constructor. More... | |
| SaveEpisode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< ControlRecordingSrv > > client_interface) | |
|
Constructor that injects a service client interface, used to supply a mock in tests. More... | |
Private Member Functions Index
| tl::expected< std::string, std::string > | getServiceName () override |
|
User-provided function to get the name of the service when initializing the service client. More... | |
| tl::expected< ControlRecordingSrv::Request, std::string > | createRequest () override |
|
User-provided function to create the service request. More... | |
| tl::expected< bool, std::string > | processResponse (const ControlRecordingSrv::Response &response) override |
| tl::expected< std::chrono::duration< double >, std::string > | getResponseTimeout () override |
|
Bound the wait so an unresponsive train server fails the Behavior instead of hanging forever. More... | |
| std::shared_future< tl::expected< bool, std::string > > & | getFuture () override |
|
Classes derived from AsyncBehaviorBase must implement getFuture() so it returns a shared_future member. More... | |
Private Member Attributes Index
| std::shared_future< tl::expected< bool, std::string > > | future_ |
Public Static Functions Index
| static BT::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
Description
End the current episode of the active Trainer recording and snapshot it to the dataset.
Calls the train server's /trainer/control_recording service with the exit_early action — the training panel's "Save" button. The snapshot is ordered on success and flushes in the background; StopRecording waits for the flush before ending the session. An Objective must tick this Behavior after the demonstrated task and before StopRecording, or the episode is discarded.
| Data Port Name | Port Type | Object Type | Description |
|---|---|---|---|
| service_name | input | std::string | Name of the Trainer control_recording service. |
Definition at line 31 of file save_episode.hpp.
Public Constructors
SaveEpisode()
| explicit |
Constructor.
- Parameters
-
name The name of the Behavior as it appears in the Behavior tree.
config The node configuration, including the port remappings.
shared_resources Shared resources such as the node handle and transform buffer.
Declaration at line 40 of file save_episode.hpp, definition at line 32 of file save_episode.cpp.
SaveEpisode()
| explicit |
Constructor that injects a service client interface, used to supply a mock in tests.
- Parameters
-
name The name of the Behavior as it appears in the Behavior tree.
config The node configuration, including the port remappings.
shared_resources Shared resources such as the node handle and transform buffer.
client_interface The service client interface to use instead of a real client.
Declaration at line 50 of file save_episode.hpp, definition at line 38 of file save_episode.cpp.
Private Member Functions
createRequest()
| virtual |
User-provided function to create the service request.
- Returns
Returns a service request message. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.
Declaration at line 61 of file save_episode.hpp, definition at line 66 of file save_episode.cpp.
getFuture()
| inline virtual |
Classes derived from AsyncBehaviorBase must implement getFuture() so it returns a shared_future member.
Definition at line 69 of file save_episode.hpp.
getResponseTimeout()
| virtual |
Bound the wait so an unresponsive train server fails the Behavior instead of hanging forever.
Declaration at line 66 of file save_episode.hpp, definition at line 82 of file save_episode.cpp.
getServiceName()
| virtual |
User-provided function to get the name of the service when initializing the service client.
- Returns
Returns the name of the service. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.
Declaration at line 59 of file save_episode.hpp, definition at line 56 of file save_episode.cpp.
processResponse()
|
Declaration at line 63 of file save_episode.hpp, definition at line 73 of file save_episode.cpp.
Private Member Attributes
future_
|
Definition at line 74 of file save_episode.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 56 of file save_episode.hpp, definition at line 51 of file save_episode.cpp.
providedPorts()
| static |
Declaration at line 54 of file save_episode.hpp, definition at line 45 of file save_episode.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.