GetRegionFromUser Class
Requests a 2D region (bounding box or polygon) from the user by switching the view and displaying a prompt in the UI. 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
| GetRegionFromUser (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
|
Construct a new GetRegionFromUser object. More... | |
Private Member Functions Index
| tl::expected< RequestRegionFromUser::Request, std::string > | createRequest () const |
|
Compose a RequestRegionFromUser::Request message from the input port values specified. More... | |
| tl::expected< bool, std::string > | processResponse (const RequestRegionFromUser::Request &request, const RequestRegionFromUser::Response &response) |
|
Validate the returned region against the request and, on success, write it to the output port. More... | |
| tl::expected< bool, std::string > | doWork () override |
|
Publish the UI prompt request and wait for the correlated response. More... | |
| tl::expected< void, std::string > | doHalt () override |
|
Cancel the in-flight UI prompt request when the Behavior is halted. 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... | |
| std::shared_ptr< utils::UIRequestResponseClient > | request_client_ |
Public Static Functions Index
| static BT::PortsList | providedPorts () |
|
Returns list of ports for this Behavior. More... | |
| static BT::KeyValueVector | metadata () |
|
Returns metadata for this Behavior. More... | |
Description
Requests a 2D region (bounding box or polygon) from the user by switching the view and displaying a prompt in the UI.
The user draws either a rectangular bounding box or a polygon on the named camera view. The output is a geometry_msgs/PolygonStamped whose points are normalized image coordinates in [0..1] (z unused). A bounding box returns four axis-aligned corners; a polygon returns the convex hull of the user's clicks. The returned region is validated on the backend, not trusted from the UI. Polygon selection is validated by the backend but is not yet available in the UI.
When initial_region is wired, it is validated and canonicalized like a returned region and sent as a proposal the user can move, resize, or replace; a wired but unreadable or invalid proposal fails the Behavior before the user is prompted.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| view_name | Input | std::string |
| region_name | Input | std::string |
| prompt | Input | std::string |
| shape_mode | Input | std::string |
| min_vertices | Input | int |
| max_vertices | Input | int |
| initial_region | Input | geometry_msgs::msg::PolygonStamped |
| region | Output | geometry_msgs::msg::PolygonStamped |
Definition at line 42 of file get_region_from_user.hpp.
Public Constructors
GetRegionFromUser()
| explicit |
Construct a new GetRegionFromUser object.
- Parameters
-
name config shared_resources
Declaration at line 51 of file get_region_from_user.hpp, definition at line 161 of file get_region_from_user.cpp.
Private Member Functions
createRequest()
| nodiscard |
Compose a RequestRegionFromUser::Request message from the input port values specified.
- Returns
Returns the service request message if successful. If not successful, returns an error message.
Declaration at line 71 of file get_region_from_user.hpp, definition at line 199 of file get_region_from_user.cpp.
doHalt()
| virtual |
Cancel the in-flight UI prompt request when the Behavior is halted.
- Returns
An empty success result.
Declaration at line 90 of file get_region_from_user.hpp, definition at line 350 of file get_region_from_user.cpp.
doWork()
| virtual |
Publish the UI prompt request and wait for the correlated response.
- Returns
If the prompt flow succeeded, returns true. If it failed, returns an error message.
Declaration at line 84 of file get_region_from_user.hpp, definition at line 322 of file get_region_from_user.cpp.
getFuture()
| inline virtual |
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.
Definition at line 93 of file get_region_from_user.hpp.
processResponse()
| nodiscard |
Validate the returned region against the request and, on success, write it to the output port.
- Returns
If the response succeeded and the region is valid, returns true; otherwise an error message.
Declaration at line 77 of file get_region_from_user.hpp, definition at line 297 of file get_region_from_user.cpp.
Private Member Attributes
future_
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member.
Definition at line 99 of file get_region_from_user.hpp.
request_client_
|
Definition at line 100 of file get_region_from_user.hpp.
Public Static Functions
metadata()
| static |
Returns metadata for this Behavior.
- Returns
BT::KeyValueVector The Behavior metadata.
Declaration at line 64 of file get_region_from_user.hpp, definition at line 194 of file get_region_from_user.cpp.
providedPorts()
| static |
Returns list of ports for this Behavior.
- Returns
BT::PortsList The list of I/O Ports
Declaration at line 58 of file get_region_from_user.hpp, definition at line 169 of file get_region_from_user.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.15.0.