GetMasks2DFromPointQuery Struct
Segment an image using the SAM2 model and point prompts. More...
Declaration
Included Headers
Base struct
| 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
| GetMasks2DFromPointQuery (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< moveit_pro::behaviors::BehaviorContext > &shared_resources, std::unique_ptr< InferenceHandle > inference_handle=std::make_unique< SAM2SegmentHandle >()) | |
|
Constructor for the GetMasks2DFromPointQuery behavior. More... | |
Public Destructor Index
| ~GetMasks2DFromPointQuery () override | |
Private Member Functions Index
| tl::expected< bool, std::string > | doWork () override |
|
User-implemented function which handles executing the potentially-long-running process. More... | |
| tl::expected< void, std::string > | doHalt () override |
|
Cancel an in-flight SAM2 inference via the inference handle. 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::unique_ptr< InferenceHandle > | inference_handle_ |
| std::optional< LatchedModel > | latched_model_ |
| bool | cpu_fallback_warning_published_ { false } |
| 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 () |
|
Implementation of the required providedPorts() function for the Behavior. More... | |
| static BT::KeyValueVector | metadata () |
|
Implementation of the metadata() function for displaying metadata, such as Behavior description and subcategory, in the MoveIt Studio Developer Tool. More... | |
Description
Segment an image using the SAM2 model and point prompts.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| image | input | sensor_msgs::msg::Image |
| pixel_coords | input | std::vector<geometry_msgs::msg::PointStamped> |
| model_bundle_manifest | input | std::string |
| runtime_id | input | std::string |
| model_package | input | std::string |
| masks2d | output | std::vector<moveit_studio_vision_msgs::msg::Mask2D> |
Definition at line 39 of file sam2_segmentation.hpp.
Public Constructors
GetMasks2DFromPointQuery()
|
Constructor for the GetMasks2DFromPointQuery behavior.
- Parameters
-
name The name of a particular instance of this Behavior. This will be set by the behavior tree factory when this Behavior is created within a new behavior tree.
config This contains runtime configuration info for this Behavior, such as the mapping between the Behavior's data ports on the behavior tree's blackboard. This will be set by the behavior tree factory when this Behavior is created within a new behavior tree.
shared_resources Provides access to common resources such as the node handle and failure logger that are shared between all the behaviors that inherit from moveit_pro::behaviors::SharedResourcesNode.
inference_handle Custom inference implementation (default uses SAM2SegmentHandle).
Declaration at line 127 of file sam2_segmentation.hpp, definition at line 143 of file sam2_segmentation.cpp.
Public Destructor
~GetMasks2DFromPointQuery()
|
Definition at line 131 of file sam2_segmentation.hpp.
Private Member Functions
doHalt()
| virtual |
Cancel an in-flight SAM2 inference via the inference handle.
Declaration at line 152 of file sam2_segmentation.hpp, definition at line 308 of file sam2_segmentation.cpp.
doWork()
| virtual |
User-implemented function which handles executing the potentially-long-running process.
This function is called within an async process in a separate thread.
- Returns
A tl::expected which contains a bool indicating task success if the process completed successfully or was canceled, or an error message if the process failed unexpectedly.
Declaration at line 147 of file sam2_segmentation.hpp, definition at line 187 of file sam2_segmentation.cpp.
getFuture()
| inline virtual |
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.
Definition at line 172 of file sam2_segmentation.hpp.
Private Member Attributes
cpu_fallback_warning_published_
|
True once the CPU-inference warning has been published, so it fires once per behavior instance rather than on every tick (load() is idempotent and called from every doWork()).
Definition at line 169 of file sam2_segmentation.hpp.
future_
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member.
Definition at line 178 of file sam2_segmentation.hpp.
inference_handle_
|
Definition at line 161 of file sam2_segmentation.hpp.
latched_model_
|
Set on the first successful load; a later tick asking for a different bundle or runtime fails rather than reloading, because models are not hot-swappable.
Definition at line 165 of file sam2_segmentation.hpp.
Public Static Functions
metadata()
| static |
Implementation of the metadata() function for displaying metadata, such as Behavior description and subcategory, in the MoveIt Studio Developer Tool.
- Returns
A BT::KeyValueVector containing the Behavior metadata.
Declaration at line 144 of file sam2_segmentation.hpp, definition at line 314 of file sam2_segmentation.cpp.
providedPorts()
| static |
Implementation of the required providedPorts() function for the Behavior.
- Returns
List of ports for the behavior.
Declaration at line 137 of file sam2_segmentation.hpp, definition at line 154 of file sam2_segmentation.cpp.
The documentation for this struct was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.