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, the task of any episode that recorded none of its own (an episode's own task always wins), and the action-label source. Conversion defaults to command labels read from the pinned commanded-joint topic and refuses an episode whose command stream is empty or mirrors the state; a task the robot performs on its own records no commands, so set action_source to next_state to label each frame's action with the state of the following frame (one dataset frame later; the episode's last frame is dropped). 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. With command labels, if every MCAP split's summary confirms the pinned command topic has no messages, the Behavior fails before starting a job. Missing or unreadable summaries and frame-level validation remain the conversion job's responsibility. 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.
action_sourceinputstd::stringOptional: command, next_state, or auto; empty = command.
job_idoutputstd::stringId of the started conversion job.

Definition at line 51 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 60 of file convert_dataset.hpp, definition at line 40 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 70 of file convert_dataset.hpp, definition at line 46 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 81 of file convert_dataset.hpp, definition at line 91 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 89 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 86 of file convert_dataset.hpp, definition at line 119 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 79 of file convert_dataset.hpp, definition at line 81 of file convert_dataset.cpp.

processResponse()​

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

Declaration at line 83 of file convert_dataset.hpp, definition at line 109 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 94 of file convert_dataset.hpp.

Public Static Functions​

metadata()​

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

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

providedPorts()​

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

Declaration at line 74 of file convert_dataset.hpp, definition at line 53 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.