Skip to main content

SaveEpisode Class

End the current episode of the active Trainer recording and snapshot it to the dataset. More...

Declaration

class moveit_pro::behaviors::SaveEpisode { ... }

Included Headers

#include <save_episode.hpp>

Base class

classServiceClientBehaviorBase<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::PortsListprovidedPorts ()
static BT::KeyValueVectormetadata ()

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 NamePort TypeObject TypeDescription
service_nameinputstd::stringName of the Trainer control_recording service.

Definition at line 31 of file save_episode.hpp.

Public Constructors

SaveEpisode()

moveit_pro::behaviors::SaveEpisode::SaveEpisode (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources)
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()

moveit_pro::behaviors::SaveEpisode::SaveEpisode (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< ControlRecordingSrv > > client_interface)
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()

tl::expected< ControlRecordingSrv::Request, std::string > moveit_pro::behaviors::SaveEpisode::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()

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::SaveEpisode::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()

tl::expected< std::chrono::duration< double >, std::string > moveit_pro::behaviors::SaveEpisode::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()

tl::expected< std::string, std::string > moveit_pro::behaviors::SaveEpisode::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()

tl::expected< bool, std::string > moveit_pro::behaviors::SaveEpisode::processResponse (const ControlRecordingSrv::Response & response)

Declaration at line 63 of file save_episode.hpp, definition at line 73 of file save_episode.cpp.

Private Member Attributes

future_

std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::SaveEpisode::future_

Definition at line 74 of file save_episode.hpp.

Public Static Functions

metadata()

BT::KeyValueVector moveit_pro::behaviors::SaveEpisode::metadata ()
static

Declaration at line 56 of file save_episode.hpp, definition at line 51 of file save_episode.cpp.

providedPorts()

BT::PortsList moveit_pro::behaviors::SaveEpisode::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.