Skip to main content

GenerateSurfaceCoveragePath Class

Generates a serpentine coverage path of tool poses over a region, flat or following a scanned surface. More...

Declaration​

class moveit_pro::behaviors::GenerateSurfaceCoveragePath { ... }

Included Headers​

#include <generate_surface_coverage_path.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​

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

User-implemented function which handles executing the potentially-long-running process. More...

std::shared_future< tl::expected< bool, std::string > > &getFuture () override

Gets the shared future which is used to monitor the progress of the async process. More...

Private Member Attributes Index​

std::shared_future< tl::expected< bool, std::string > >future_

Public Static Functions Index​

static BT::PortsListprovidedPorts ()
static BT::KeyValueVectormetadata ()

Description​

Generates a serpentine coverage path of tool poses over a region, flat or following a scanned surface.

The region is a selection box: a center pose plus full extents, drawn in the 3D view or produced by GetOrientedBoundingBoxFromPointCloud. Its +Z axis is the side the tool approaches from and its X axis the raster line direction, unless raster_layout turns the lines along the box Y axis; the sweep starts at the box -X, -Y corner with lines along X and at the +X, -Y corner with lines along Y. The raster layout comes from the raster_layout message (line and point spacing, margin, line direction); when that port is left unwired the deprecated line_spacing, point_spacing and margin ports are used instead, and one of them set beside the message is rejected. A serpentine raster is laid out on the box's +Z face, inset by the margin, and each waypoint is placed one standoff from the surface along its tool axis with orientation_offset applied in the waypoint's own frame; the waypoint X axis points along the raster lines. In PLANAR projection, the default, the surface is the box's +Z face itself and the points' depth is never read; point_cloud may be left unwired, and when it is wired it is only cropped to the box for the region_cloud output. In SURFACE projection the points inside the box are the surface: each raster sample is projected along -Z onto them, the tool axis is the local surface normal kept within orientation_cap of the box +Z axis, raster samples with no points under them are dropped and bridged, and the Behavior fails when fewer than min_covered_fraction of them survive or when too few points lie inside the box. Where two surfaces stack along the box Z axis, the path follows the one nearest the tool, and a sample whose local normal is nearly perpendicular to the box Z axis is seen edge-on and dropped like empty space.

When a point cloud is given, it is transformed into the box frame at its own acquisition stamp, the region pose is taken as valid at that stamp, and the path is emitted at it, so a camera that moved between capture and generation cannot shift the sweep as long as output_frame is a fixed frame; a path left in the sensor's own frame moves with the sensor once consumers stop resolving that stamp, and the Behavior warns when that is the case. Without a cloud the path carries the region pose's stamp. The path is emitted in output_frame, or the region pose's frame when empty, and then no transform is needed at all without a cloud. The Behavior is asynchronous: it returns RUNNING while the path is generated, then SUCCESS or FAILURE.

Data Port NamePort TypeObject Type
region_poseinputgeometry_msgs::msg::PoseStamped
region_dimensionsinputstd::vector<double>
raster_layoutinputmoveit_studio_msgs::msg::RasterLayout
line_spacinginputdouble
point_spacinginputdouble
standoffinputdouble
margininputdouble
point_cloudinputsensor_msgs::msg::PointCloud2
projection_modeinputstd::string
orientation_offsetinputstd::vector<double>
orientation_capinputdouble
surface_resolutioninputdouble
min_covered_fractioninputdouble
output_frameinputstd::string
coverage_pathoutputstd::vector<geometry_msgs::msg::PoseStamped>
region_cloudoutputsensor_msgs::msg::PointCloud2
Parameters
name

The name of this Behavior.

config

The configuration options for this Behavior.

shared_resources

The shared resources common to all Behaviors.

Definition at line 84 of file generate_surface_coverage_path.hpp.

Public Constructors​

GenerateSurfaceCoveragePath()​

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

Declaration at line 87 of file generate_surface_coverage_path.hpp, definition at line 268 of file generate_surface_coverage_path.cpp.

Private Member Functions​

doWork()​

tl::expected< bool, std::string > moveit_pro::behaviors::GenerateSurfaceCoveragePath::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 95 of file generate_surface_coverage_path.hpp, definition at line 358 of file generate_surface_coverage_path.cpp.

getFuture()​

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::GenerateSurfaceCoveragePath::getFuture ()
inline virtual

Gets the shared future which is used to monitor the progress of the async process.

Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.

This exists to prevent destruction of the derived class while the async process is still in-progress. If the derived class is destroyed, the definitions of the functions used within doWork() will be destroyed too, which will result in the virtual functions in the base class being called instead and cause a fault.

This function will force derived classes to add an instance of this type and return a reference to it. The base class can then use this virtual function to access the shared future in functions like onStart.

By adding this virtual function we're properly demonstrating how this future depends on things from the derived class and the natural flow of object lifetimes will do the hard work for us. The std::shared_future destructor will get the value of the future before the derived class is destructed assuming it's the last reference to the shared state. Doing it this way means neither the base nor derived class should need to implement a destructor which is a nice property to have.

Returns

Returns the shared_future, which should be owned by the child class.

Definition at line 97 of file generate_surface_coverage_path.hpp.

Private Member Attributes​

future_​

std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::GenerateSurfaceCoveragePath::future_

Definition at line 102 of file generate_surface_coverage_path.hpp.

Public Static Functions​

metadata()​

BT::KeyValueVector moveit_pro::behaviors::GenerateSurfaceCoveragePath::metadata ()
static

Declaration at line 92 of file generate_surface_coverage_path.hpp, definition at line 352 of file generate_surface_coverage_path.cpp.

providedPorts()​

BT::PortsList moveit_pro::behaviors::GenerateSurfaceCoveragePath::providedPorts ()
static

Declaration at line 90 of file generate_surface_coverage_path.hpp, definition at line 274 of file generate_surface_coverage_path.cpp.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.