Skip to main content

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

class moveit_pro::behaviors::SaveMTCTaskInspection { ... }

Included Headers

#include <save_mtc_task_inspection.hpp>

Base class

classAsyncBehaviorBase

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::PortsListprovidedPorts ()
static BT::KeyValueVectormetadata ()

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 NamePort TypeObject Type
taskinputstd::shared_ptr<moveit_pro::task_constructor::Task>
output_directoryinputstd::string
include_trajectoriesinputbool
include_scenesinputbool
generated_fileoutputstd::string
warning

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()

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

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()

tl::expected< bool, std::string > moveit_pro::behaviors::SaveMTCTaskInspection::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()

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::SaveMTCTaskInspection::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_

std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::SaveMTCTaskInspection::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()

BT::KeyValueVector moveit_pro::behaviors::SaveMTCTaskInspection::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()

BT::PortsList moveit_pro::behaviors::SaveMTCTaskInspection::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.