Skip to main content

RecordEpisode Class

Start a Trainer recording session for demonstration collection via the train server node. More...

Declaration

class moveit_pro::behaviors::RecordEpisode { ... }

Included Headers

#include <record_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

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

Constructor. More...

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

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

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

Start a Trainer recording session for demonstration collection via the train server node.

Calls the train server's /trainer/start_recording service — the same session the training panel drives, so a Behavior-started recording shows up live in the UI. Ports set here always win; the named training config only fills in what the ports leave unset. A non-empty camera_topics selects the captured streams even when config_name is set; an empty camera_topics falls back to the config's cameras, then the cameras discovered on the live graph, then the recording defaults. Joint topics and fps resolve from the named config when not otherwise specified. Pair with SaveEpisode to snapshot each episode and StopRecording to end the session and register the dataset.

Data Port NamePort TypeObject TypeDescription
service_nameinputstd::stringName of the Trainer start_recording service.
dataset_nameinputstd::stringRecording name; also the ConvertDataset key.
taskinputstd::stringTask stored with each episode; its conversion label.
config_nameinputstd::stringOptional named training config; empty = defaults.
camera_topicsinputstd::vector<std::string>Camera topics; empty = the config's cameras.
num_episodesinputintEpisodes to collect in this session.
recording_idoutputstd::stringId of the started recording session.

Definition at line 40 of file record_episode.hpp.

Public Constructors

RecordEpisode()

moveit_pro::behaviors::RecordEpisode::RecordEpisode (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 49 of file record_episode.hpp, definition at line 38 of file record_episode.cpp.

RecordEpisode()

moveit_pro::behaviors::RecordEpisode::RecordEpisode (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< StartRecordingSrv > > 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 59 of file record_episode.hpp, definition at line 44 of file record_episode.cpp.

Private Member Functions

createRequest()

tl::expected< StartRecordingSrv::Request, std::string > moveit_pro::behaviors::RecordEpisode::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 70 of file record_episode.hpp, definition at line 87 of file record_episode.cpp.

getFuture()

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

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

Definition at line 78 of file record_episode.hpp.

getResponseTimeout()

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

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

Declaration at line 75 of file record_episode.hpp, definition at line 147 of file record_episode.cpp.

getServiceName()

tl::expected< std::string, std::string > moveit_pro::behaviors::RecordEpisode::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 68 of file record_episode.hpp, definition at line 77 of file record_episode.cpp.

processResponse()

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

Declaration at line 72 of file record_episode.hpp, definition at line 137 of file record_episode.cpp.

Private Member Attributes

future_

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

Definition at line 83 of file record_episode.hpp.

Public Static Functions

metadata()

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

Declaration at line 65 of file record_episode.hpp, definition at line 72 of file record_episode.cpp.

providedPorts()

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

Declaration at line 63 of file record_episode.hpp, definition at line 51 of file record_episode.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.