SaveMTCTaskInspection Class
Walks an MTC Task and saves all introspection data (stage tree, statistics, every solution and failure, interface states, per-stage failure explanations) to a JSON file on disk. More...
Declaration
Included Headers
Base class
| class | AsyncBehaviorBase |
|
A base class for behaviors which need to asynchronously run a function that might take a long time to complete. More... | |
Public Constructors Index
| SaveMTCTaskInspection (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
Private Member Functions Index
| tl::expected< bool, std::string > | doWork () override |
|
Serializes the MTC task, resolves the destination directory, and writes the JSON file. More... | |
| std::shared_future< tl::expected< bool, std::string > > & | getFuture () override |
|
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member. More... | |
Private Member Attributes Index
| std::shared_future< tl::expected< bool, std::string > > | future_ |
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member. More... | |
Public Static Functions Index
| static BT::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
Description
Walks an MTC Task and saves all introspection data (stage tree, statistics, every solution and failure, interface states, per-stage failure explanations) to a JSON file on disk.
Intended for offline triage of MTC planning failures, so the customer can ship a single file back to support instead of needing live RViz access at the moment of failure. Plug it in either as a fallback below PlanMTCTask (to capture only failures) or between Plan and Execute (to capture every plan).
The destination directory accepts:
- An absolute path (e.g. /var/log/mtc_inspection).
- A path relative to the first configured objectives library directory (e.g. mtc_dumps/eternal_tool_change).
- A path beginning with ~ or $HOME, expanded against the current user's home directory.
The file name is always generated as <task_id>_<YYYYMMDDHHMMSSmmm>.json from the task's internal id. The trailing 3 digits are milliseconds-within-second so that rapid back-to-back invocations (e.g. retries inside a Fallback) do not overwrite each other. The absolute path of the written file is exposed on the generated_file output port.
If the Task was created with introspection disabled (enable_introspection set to false on InitializeMTCTask), there is no inspection data to save: this Behavior logs a warning, clears the generated_file output port, and succeeds without writing a file.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| task | input | std::shared_ptr<moveit_pro::task_constructor::Task> |
| output_directory | input | std::string |
| include_trajectories | input | bool |
| include_scenes | input | bool |
| generated_file | output | std::string |
Inherits from AsyncBehaviorBase because, with include_scenes=true and a non-trivial planning scene, JSON serialization + disk write can run for hundreds of milliseconds. A synchronous tick would block the BT executor for the duration.
Definition at line 59 of file save_mtc_task_inspection.hpp.
Public Constructors
SaveMTCTaskInspection()
|
Declaration at line 62 of file save_mtc_task_inspection.hpp, definition at line 120 of file save_mtc_task_inspection.cpp.
Private Member Functions
doWork()
| virtual |
Serializes the MTC task, resolves the destination directory, and writes the JSON file.
- Returns
true on success, or an error string if path resolution, mkdir, or the file write fails.
Declaration at line 75 of file save_mtc_task_inspection.hpp, definition at line 150 of file save_mtc_task_inspection.cpp.
getFuture()
| inline virtual |
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.
Definition at line 78 of file save_mtc_task_inspection.hpp.
Private Member Attributes
future_
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member.
Definition at line 84 of file save_mtc_task_inspection.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 67 of file save_mtc_task_inspection.hpp, definition at line 144 of file save_mtc_task_inspection.cpp.
providedPorts()
| static |
Declaration at line 65 of file save_mtc_task_inspection.hpp, definition at line 126 of file save_mtc_task_inspection.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.