MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_pro::behaviors::SaveEpisode Class Referencefinal

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

#include <save_episode.hpp>

Inheritance diagram for moveit_pro::behaviors::SaveEpisode:
Collaboration diagram for moveit_pro::behaviors::SaveEpisode:

Public Member Functions

 SaveEpisode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 Constructor.
 
 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.
 
- Public Member Functions inherited from moveit_pro::behaviors::ServiceClientBehaviorBase< ControlRecordingSrv >
 ServiceClientBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 Constructs ServiceClientBehaviorBase using the RclcppClientInterface.
 
 ServiceClientBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< ControlRecordingSrv > > client_interface)
 Constructs ServiceClientBehaviorBase using a user-provided implementation of ClientInterfaceBase.
 
 ~ServiceClientBehaviorBase () override=default
 
virtual tl::expected< std::chrono::duration< double >, std::string > getWaitForServerAvailableTimeout ()
 Optional user-provided function to set the timeout used when waiting for the service server to be available.
 
virtual tl::expected< bool, std::string > processResponse (const typename ServiceT::Response &)
 Optional user-provided function to process the service response after the service has finished.
 
tl::expected< void, std::string > doHalt () override
 Handles halting logic which is specific to the service client behavior implementation.
 
- Public Member Functions inherited from moveit_pro::behaviors::AsyncBehaviorBase
 AsyncBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 
 ~AsyncBehaviorBase () override=default
 
BT::NodeStatus onStart () override
 Required implementation of BT::StatefulActionNode::onStart().
 
BT::NodeStatus onRunning () override
 Required implementation of BT::StatefulActionNode::onRunning().
 
void onHalted () override
 Required implementation of BT::StatefulActionNode::onHalted().
 
void resetStatus ()
 Resets the internal status of this node.
 
void notifyCanHalt ()
 Called when runAsync() finishes to notify onHalted() that the async process has finished.
 
- Public Member Functions inherited from moveit_pro::behaviors::SharedResourcesNode< BT::StatefulActionNode >
 SharedResourcesNode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &behavior_context)
 Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node.
 
const std::shared_ptr< BehaviorContext > & getBehaviorContext () const
 

Static Public Member Functions

static BT::PortsList providedPorts ()
 
static BT::KeyValueVector metadata ()
 

Additional Inherited Members

- Static Public Attributes inherited from moveit_pro::behaviors::ServiceClientBehaviorBase< ControlRecordingSrv >
static constexpr std::chrono::seconds kTimeoutWaitForServiceServer
 

Detailed 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.

Constructor & Destructor Documentation

◆ SaveEpisode() [1/2]

moveit_pro::behaviors::SaveEpisode::SaveEpisode ( const std::string &  name,
const BT::NodeConfiguration &  config,
const std::shared_ptr< BehaviorContext > &  shared_resources 
)
explicit

Constructor.

Parameters
nameThe name of the Behavior as it appears in the Behavior tree.
configThe node configuration, including the port remappings.
shared_resourcesShared resources such as the node handle and transform buffer.

◆ SaveEpisode() [2/2]

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
nameThe name of the Behavior as it appears in the Behavior tree.
configThe node configuration, including the port remappings.
shared_resourcesShared resources such as the node handle and transform buffer.
client_interfaceThe service client interface to use instead of a real client.

Member Function Documentation

◆ metadata()

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

◆ providedPorts()

BT::PortsList moveit_pro::behaviors::SaveEpisode::providedPorts ( )
static

The documentation for this class was generated from the following files: