ConvertDataset Class
Start an MCAP-to-LeRobot conversion of a recorded dataset via the train server node. More...
Declaration
Included Headers
Base class
| class | ServiceClientBehaviorBase<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::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
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 Name | Port Type | Object Type | Description |
|---|---|---|---|
| service_name | input | std::string | Name of the Trainer convert_dataset service. |
| dataset_name | input | std::string | Recorded dataset to convert (RecordEpisode's name). |
| task | input | std::string | Task for episodes with none of their own; empty = the recorded task. |
| output_dir | input | std::string | Optional output override; empty = sibling -lerobot. |
| robot_type | input | std::string | Optional robot type override; empty = the recorded one. |
| action_source | input | std::string | Optional: command, next_state, or auto; empty = command. |
| job_id | output | std::string | Id of the started conversion job. |
Definition at line 51 of file convert_dataset.hpp.
Public Constructors
ConvertDataset()
| 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()
| 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()
| 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()
| 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()
| 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()
| 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()
|
Declaration at line 83 of file convert_dataset.hpp, definition at line 109 of file convert_dataset.cpp.
Private Member Attributes
future_
|
Definition at line 94 of file convert_dataset.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 76 of file convert_dataset.hpp, definition at line 76 of file convert_dataset.cpp.
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.