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.
| 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 |
| region | Output | geometry_msgs::msg::PolygonStamped |
Definition at line 37 of file get_region_from_user.hpp.
Public Constructors
GetRegionFromUser()
| explicit |
Construct a new GetRegionFromUser object.
- Parameters
-
name config shared_resources
Declaration at line 46 of file get_region_from_user.hpp, definition at line 97 of file get_region_from_user.cpp.
Private Member Functions
createRequest()
|
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 66 of file get_region_from_user.hpp, definition at line 130 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 85 of file get_region_from_user.hpp, definition at line 241 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 79 of file get_region_from_user.hpp, definition at line 213 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 88 of file get_region_from_user.hpp.
processResponse()
|
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 72 of file get_region_from_user.hpp, definition at line 174 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 94 of file get_region_from_user.hpp.
request_client_
|
Definition at line 95 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 59 of file get_region_from_user.hpp, definition at line 125 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 53 of file get_region_from_user.hpp, definition at line 105 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.9.8.