Skip to main content

StopRecording Class

Stop the active Trainer recording session and register the saved episodes as a dataset. More...

Declaration

class moveit_pro::behaviors::StopRecording { ... }

Included Headers

#include <stop_recording.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

StopRecording (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)

Constructor. More...

StopRecording (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< StopRecordingSrv > > 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< StopRecordingSrv::Request, std::string >createRequest () override

User-provided function to create the service request. More...

tl::expected< bool, std::string >processResponse (const StopRecordingSrv::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

Stop the active Trainer recording session and register the saved episodes as a dataset.

Calls the train server's /trainer/stop_recording service. Episodes already snapshotted (see SaveEpisode) are kept; the in-progress episode is NOT snapshotted. The stop is idempotent — the Behavior succeeds when no recording was active, so it is safe in cleanup branches of an Objective.

Data Port NamePort TypeObject TypeDescription
service_nameinputstd::stringName of the Trainer stop_recording service.

Definition at line 30 of file stop_recording.hpp.

Public Constructors

StopRecording()

moveit_pro::behaviors::StopRecording::StopRecording (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 39 of file stop_recording.hpp, definition at line 30 of file stop_recording.cpp.

StopRecording()

moveit_pro::behaviors::StopRecording::StopRecording (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< StopRecordingSrv > > 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 49 of file stop_recording.hpp, definition at line 36 of file stop_recording.cpp.

Private Member Functions

createRequest()

tl::expected< StopRecordingSrv::Request, std::string > moveit_pro::behaviors::StopRecording::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 60 of file stop_recording.hpp, definition at line 64 of file stop_recording.cpp.

getFuture()

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::StopRecording::getFuture ()
inline virtual

Classes derived from AsyncBehaviorBase must implement getFuture() so it returns a shared_future member.

Definition at line 68 of file stop_recording.hpp.

getResponseTimeout()

tl::expected< std::chrono::duration< double >, std::string > moveit_pro::behaviors::StopRecording::getResponseTimeout ()
virtual

Bound the wait so an unresponsive train server fails the Behavior instead of hanging forever.

Declaration at line 65 of file stop_recording.hpp, definition at line 79 of file stop_recording.cpp.

getServiceName()

tl::expected< std::string, std::string > moveit_pro::behaviors::StopRecording::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 58 of file stop_recording.hpp, definition at line 54 of file stop_recording.cpp.

processResponse()

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

Declaration at line 62 of file stop_recording.hpp, definition at line 70 of file stop_recording.cpp.

Private Member Attributes

future_

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

Definition at line 73 of file stop_recording.hpp.

Public Static Functions

metadata()

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

Declaration at line 55 of file stop_recording.hpp, definition at line 49 of file stop_recording.cpp.

providedPorts()

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

Declaration at line 53 of file stop_recording.hpp, definition at line 43 of file stop_recording.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.