Skip to main content

ConvertDataset Class

Start an MCAP-to-LeRobot conversion of a recorded dataset via the train server node. More...

Declaration

class moveit_pro::behaviors::ConvertDataset { ... }

Included Headers

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

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

Constructor. More...

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

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

tl::expected< bool, std::string >processResponse (const ConvertDatasetSrv::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 an MCAP-to-LeRobot conversion of a recorded dataset via the train server node.

Calls the train server's /trainer/convert_dataset service with the dataset's name (the RecordEpisode dataset_name). The node derives the conversion request from the dataset itself — bag path, sibling -lerobot output directory and repo id from its record, and the cameras, fps, joint topics, and robot type from the recording options pinned to it, never from the Training Config's current values — the same way the training panel's convert tab does; the optional ports override the output directory, the robot type, and the task of any episode that recorded none of its own (an episode's own task always wins). A dataset with no pin (recorded before pins existed) or an unreadable one fails the Behavior rather than converting against guessed settings; record into it again to establish a pin. The conversion runs as a background job: this Behavior succeeds when the job is started, not when it finishes. Track it via the training panel or the /trainer/list_conversions service.

Data Port NamePort TypeObject TypeDescription
service_nameinputstd::stringName of the Trainer convert_dataset service.
dataset_nameinputstd::stringRecorded dataset to convert (RecordEpisode's name).
taskinputstd::stringTask for episodes with none of their own; empty = the recorded task.
output_dirinputstd::stringOptional output override; empty = sibling -lerobot.
robot_typeinputstd::stringOptional robot type override; empty = the recorded one.
job_idoutputstd::stringId of the started conversion job.

Definition at line 42 of file convert_dataset.hpp.

Public Constructors

ConvertDataset()

moveit_pro::behaviors::ConvertDataset::ConvertDataset (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 51 of file convert_dataset.hpp, definition at line 37 of file convert_dataset.cpp.

ConvertDataset()

moveit_pro::behaviors::ConvertDataset::ConvertDataset (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< ConvertDatasetSrv > > 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 61 of file convert_dataset.hpp, definition at line 43 of file convert_dataset.cpp.

Private Member Functions

createRequest()

tl::expected< ConvertDatasetSrv::Request, std::string > moveit_pro::behaviors::ConvertDataset::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 72 of file convert_dataset.hpp, definition at line 82 of file convert_dataset.cpp.

getFuture()

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

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

Definition at line 80 of file convert_dataset.hpp.

getResponseTimeout()

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

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

Declaration at line 77 of file convert_dataset.hpp, definition at line 109 of file convert_dataset.cpp.

getServiceName()

tl::expected< std::string, std::string > moveit_pro::behaviors::ConvertDataset::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 70 of file convert_dataset.hpp, definition at line 72 of file convert_dataset.cpp.

processResponse()

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

Declaration at line 74 of file convert_dataset.hpp, definition at line 99 of file convert_dataset.cpp.

Private Member Attributes

future_

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

Definition at line 85 of file convert_dataset.hpp.

Public Static Functions

metadata()

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

Declaration at line 67 of file convert_dataset.hpp, definition at line 67 of file convert_dataset.cpp.

providedPorts()

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

Declaration at line 65 of file convert_dataset.hpp, definition at line 50 of file convert_dataset.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.