AccumulateSurfaceCoverage Class
Record which parts of a target surface a tool treats, live, while it treats them. 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... | |
Private Member Typedefs Index
| using | StartSurfaceCoverage = moveit_studio_internal_msgs::srv::StartSurfaceCoverage |
| using | StopSurfaceCoverage = moveit_studio_internal_msgs::srv::StopSurfaceCoverage |
Public Constructors Index
| AccumulateSurfaceCoverage (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
|
Constructor for the AccumulateSurfaceCoverage Behavior. More... | |
Private Member Functions Index
| tl::expected< bool, std::string > | doWork () override |
|
Opens the session, then waits until the sweep beside it finishes and halts this Behavior. More... | |
| tl::expected< void, std::string > | doHalt () override |
|
Ends the session, so a failed sweep stops the sampling as surely as a successful one. 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... | |
| void | createClients (const std::string &start_service, const std::string &stop_service) |
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... | |
| rclcpp::Client< StartSurfaceCoverage >::SharedPtr | start_client_ |
| rclcpp::Client< StopSurfaceCoverage >::SharedPtr | stop_client_ |
| std::string | stop_service_name_ |
|
Kept for the halt's diagnostics, which run after the port that named it is out of reach. More... | |
| std::uint64_t | session_id_ = 0 |
| std::mutex | mutex_ |
| std::condition_variable | halt_cv_ |
| bool | halted_ = false |
| std::optional< int > | covered_points_ |
Public Static Functions Index
| static BT::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
Description
Record which parts of a target surface a tool treats, live, while it treats them.
Opens a coverage session for as long as this Behavior runs. The Runtime — not this Behavior — samples the tool's actual pose and paints the target points it reaches, publishing the accumulated result so the 3D view fills in as the sweep proceeds. Because the Runtime owns the session, the history outlives the Objective run that started it.
Run it beside the motion in a Parallel, not before it in a Sequence: the session must end whether the sweep succeeds or fails, and a Parallel halts this Behavior either way. It returns Running while the session is open, and Failure if the Runtime was unavailable or refused the session. It has no success status of its own: BT.CPP resets a halted node to Idle in the same call that halts it, so the sweep finishing normally leaves this node Idle, which the tree view draws the same as a cancelled one. Read covered_points to know a session closed, not this status.
What is recorded is where the tool went, not where it was asked to go — a sweep the controller only partly tracked paints only the part it reached. Transit counts as going: nothing tells the session when treatment is actually on, so keep the Parallel around the treating motion alone and set footprint_range to just past the standoff. A near cutoff on the footprint, or an activation signal from the tool, would close that gap properly.
The tool pose is sampled at the latest transform available, so the painted band trails the true pose by the joint-state and TF publication latency — millimetres at working speeds, and a constant shift rather than a gap.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| target_cloud | input | sensor_msgs::msg::PointCloud2 |
| tool_frame | input | std::string |
| output_frame | input | std::string |
| footprint_radius | input | double |
| footprint_range | input | double |
| treated_color | input | std::vector<int> |
| sample_rate_hz | input | double |
| max_tool_speed | input | double |
| covered_points | output | int |
Definition at line 67 of file accumulate_surface_coverage.hpp.
Private Member Typedefs
StartSurfaceCoverage
|
Definition at line 85 of file accumulate_surface_coverage.hpp.
StopSurfaceCoverage
|
Definition at line 86 of file accumulate_surface_coverage.hpp.
Public Constructors
AccumulateSurfaceCoverage()
|
Constructor for the AccumulateSurfaceCoverage Behavior.
- Parameters
-
name Name of this node instance in the Behavior tree.
config Node configuration, including the port remappings.
shared_resources Shared resources the Behavior uses, such as the ROS node, the logger, and the transform buffer.
Declaration at line 77 of file accumulate_surface_coverage.hpp, definition at line 67 of file accumulate_surface_coverage.cpp.
Private Member Functions
createClients()
|
Stand the two service clients up once the port-supplied names are known. Not the constructor: the names are ports, so they are not readable until the Behavior ticks.
Declaration at line 111 of file accumulate_surface_coverage.hpp, definition at line 73 of file accumulate_surface_coverage.cpp.
doHalt()
| virtual |
Ends the session, so a failed sweep stops the sampling as surely as a successful one.
- Returns
An error when the stop did not reach the Runtime, which leaves it sampling.
Declaration at line 98 of file accumulate_surface_coverage.hpp, definition at line 235 of file accumulate_surface_coverage.cpp.
doWork()
| virtual |
Opens the session, then waits until the sweep beside it finishes and halts this Behavior.
- Returns
True once the session has been closed and the covered count reported.
Declaration at line 92 of file accumulate_surface_coverage.hpp, definition at line 134 of file accumulate_surface_coverage.cpp.
getFuture()
| inline virtual |
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.
Definition at line 101 of file accumulate_surface_coverage.hpp.
Private Member Attributes
covered_points_
|
Read back from the stop response, so the port reports what the Runtime actually accumulated. Empty when the stop never reported a count: leaving the port untouched is the honest outcome, because a zero there reads as a surface nothing treated.
Definition at line 131 of file accumulate_surface_coverage.hpp.
future_
|
Classes derived from AsyncBehaviorBase must have this shared_future as a class member.
Definition at line 107 of file accumulate_surface_coverage.hpp.
halt_cv_
|
Definition at line 124 of file accumulate_surface_coverage.hpp.
halted_
|
Set by doHalt() to release doWork() from its wait, and cleared by doWork() so a re-tick starts a fresh session rather than returning the previous one's result immediately.
Definition at line 127 of file accumulate_surface_coverage.hpp.
mutex_
|
Guards halted_ and covered_points_, which doHalt() writes from the tick thread while doWork() reads them from the async worker.
Definition at line 123 of file accumulate_surface_coverage.hpp.
session_id_
|
The session doWork() opened, named again when stopping it so the Runtime can tell a stale stop from one that belongs to the session it is currently sampling.
Definition at line 119 of file accumulate_surface_coverage.hpp.
start_client_
|
Definition at line 113 of file accumulate_surface_coverage.hpp.
stop_client_
|
Definition at line 114 of file accumulate_surface_coverage.hpp.
stop_service_name_
|
Kept for the halt's diagnostics, which run after the port that named it is out of reach.
Definition at line 116 of file accumulate_surface_coverage.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 82 of file accumulate_surface_coverage.hpp, definition at line 128 of file accumulate_surface_coverage.cpp.
providedPorts()
| static |
Declaration at line 80 of file accumulate_surface_coverage.hpp, definition at line 86 of file accumulate_surface_coverage.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.