-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add Axis-Aligned Bounding Box option to Plane-Slicer Planner #123
Open
DavidMerzJr
wants to merge
76
commits into
ros-industrial:master
Choose a base branch
from
DavidMerzJr:feature/axis-aligned-bounding-box
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
812f52e
Add Axis-Aligned Bounding Box option to Plane-Slicer Planner
DavidMerzJr 4e32857
Clang fixes and PlaneSlicerConfig Serialization
DavidMerzJr 4e5c022
implemented simple max_edge_segment function
steviedale a52ac5a
added max_segment_length msg params
steviedale 12181b3
fixed lenth->length typo and made splitSegments turn off for max_segm…
steviedale 40551b3
added generate_extra_rasters capability to the plane slicer raster pl…
drchrislewis 54dffd5
clang format
drchrislewis 7dd640d
Merge pull request #2 from drchrislewis/generate_extra_rasters
DavidMerzJr 0a88246
inprogress, but rebasing
drchrislewis 8693919
first compile of bug fix for raster across holes switching directions…
drchrislewis 08c6a00
Fix plane slicer axes for vertical parts and offsets for first slice
3ac6cf9
reordered, but now all returned rasters flow in same order. TODO, add…
drchrislewis 308194e
added function to reverse odd rasters, and a config to enable/disable…
drchrislewis f804f23
clang
drchrislewis 4ffd272
removed some code between if(0)
drchrislewis 14746af
minor changes to catch zero length cases
drchrislewis acf9da4
minor improvement
drchrislewis 37ccd05
clang
drchrislewis 80d33a4
Merge pull request #3 from drchrislewis/reorder_planeslice_segs
DavidMerzJr 7b03eae
Update cmake_common_scripts to ros_industrial_cmake_boilerplate
5d0911f
Merge pull request #4 from Levi-Armstrong/feature/axis-aligned-boundi…
DavidMerzJr c698b1c
fixed bug in utility to add extra raster
4999eae
first compile no testing yet
drchrislewis d76613e
implemented segmentByAxes
steviedale 9f8c123
added testing script (should probably delete this before merging)
steviedale 327acf9
addingExtraWaypoints is now working under gtest examples
drchrislewis f58ccca
updated segmentByAxes with major axis detection
steviedale 2b1527f
added gtest unit test for segmentByAxes, viz not working and needs mo…
steviedale bf3547d
updated addWaypoints to prefer the original over the shifted. This pr…
drchrislewis 6bee60f
modified prunning to use dot product as method.
drchrislewis 4ccb86a
replaces splitSegements() with segmentByAxes() in edge generators
steviedale 725267d
modified conditions for adding extra waypoints. This should eliminate…
drchrislewis d423984
fixed a few bugs in addExtraWaypoints, added a test that loads a mesh…
drchrislewis d8ab78e
edge path points are condsidered in a centroid frame to improve behavior
e3bc666
removed debug data structure
694c15a
Merge pull request #2 from colin-lewis-19/feature/segment_by_axes
steviedale 510511a
refactored segementByAxes to splitByAxes
steviedale 2b26ffa
Merge pull request #5 from drchrislewis/addExtraWaypoints
DavidMerzJr 793fdb4
Reset Value in Utest
DavidMerzJr 2320237
Merge branch 'feature/axis-aligned-bounding-box' into feature/segment…
DavidMerzJr 2861348
Fix specification of raster direction to be more consistent
DavidMerzJr f28beac
Fix repeated uses causing changes in behavior
DavidMerzJr a3bea86
Fix Vector Math
DavidMerzJr 734f27c
Fix Strange Deflection when Specifying Raster Direction Directly
DavidMerzJr f805353
Appease Clang and Fixup Unit Test
DavidMerzJr 9ef7316
Merge pull request #7 from DavidMerzJr/fix/raster-direction-specifica…
DavidMerzJr 7b64064
Merge branch 'feature/axis-aligned-bounding-box' into feature/segment…
DavidMerzJr d845ba5
removed test node
steviedale e9671a0
fixed fail cases
steviedale 3688fa4
removed unused dependency from CMakeLists.txt
steviedale 78b6fc2
support for splitting ToolPath objects with multiple ToolPathSegment …
steviedale 01bec84
Merge pull request #6 from steviedale/feature/segment_by_axes
DavidMerzJr ef6fa61
Trying to Correct Malformed Post-Filtering Meshes
DavidMerzJr 49837e1
reinstated a heat_raster interface and made a few minor simplifying c…
drchrislewis 8cc8584
clang tidy
drchrislewis b79f539
added call to smoother and a utility function to generate interleaved…
drchrislewis 6419c78
added search_radius to service so that we average the normals over so…
drchrislewis ef05d02
fixed quite a few bugs in the plane slicer. These caused crashes. Thi…
drchrislewis b53758d
added parameters to service call to plane slicer for smoothing, and i…
drchrislewis 8ea64ab
updated utilities to allow normal estimation using MLS
drchrislewis 07e3f7f
updated method for setting x-direction of pose
drchrislewis caad679
added MLS normal estimation and other utility functions(e.g. compute …
drchrislewis d6a59f1
removed include file no longer necessary
drchrislewis 189eef2
clang, removed unnecessary and complex if(), renamed a static functio…
drchrislewis 224d6fb
text of error message corrected
drchrislewis 4f0a139
Fixed extra raster_directions param that slipped through on rebase
marrts fdbf72e
Merge pull request #12 from marrts/smoothing_and_interleaving_rebase
DavidMerzJr 74246a1
Fixed default raster direction to be zero vector rather than unit Y s…
marrts e41a18e
Merge pull request #13 from marrts/fix/raster_direction_default
DavidMerzJr 5899b4d
Reorganizing and Missing Headers
DavidMerzJr 41a65ae
Sequencer: Guard against disallowed front() back()
DavidMerzJr e751fc6
Added ability to hop inlets and peninsulas
marrts 958d584
Clang formatting and renamed variables to be clearer
marrts f033397
Clarified param units and better infinite loop check
marrts 6713141
Ensures monotonically decreasing toolpath sizes
marrts 0135230
Merge pull request #14 from marrts/feature/peninsula_and_inlet_hopper
DavidMerzJr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# PCL ros tools, this is required because using custom version of PCL and VTK | ||
- git: {local-name: perception_pcl, uri: 'https://github.com/ros-perception/perception_pcl.git', version: 1.7.1} | ||
- git: {local-name: cmake_common_scripts, uri: 'https://github.com/ros-industrial/cmake_common_scripts.git', version: master} | ||
- git: {local-name: ros_industrial_cmake_boilerplate, uri: 'https://github.com/ros-industrial/ros_industrial_cmake_boilerplate.git', version: master} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#include <noether_filtering/utils.h> | ||
|
||
#include <pcl/conversions.h> | ||
#include <pcl/point_cloud.h> | ||
#include <pcl/point_types.h> | ||
#include <pcl/surface/vtk_smoothing/vtk_utils.h> | ||
#include <vtkPointData.h> | ||
|
||
namespace noether_filtering | ||
{ | ||
namespace utils | ||
{ | ||
int vtk2TriangleMesh(const vtkSmartPointer<vtkPolyData>& poly_data, pcl::PolygonMesh& mesh) | ||
{ | ||
mesh.polygons.clear(); | ||
mesh.cloud.data.clear(); | ||
mesh.cloud.width = mesh.cloud.height = 0; | ||
mesh.cloud.is_dense = true; | ||
|
||
vtkSmartPointer<vtkPoints> mesh_points = poly_data->GetPoints(); | ||
vtkIdType nr_points = mesh_points->GetNumberOfPoints(); | ||
vtkIdType nr_polygons = poly_data->GetNumberOfPolys(); | ||
|
||
if (nr_points == 0) | ||
return 0; | ||
|
||
vtkUnsignedCharArray* poly_colors = nullptr; | ||
if (poly_data->GetPointData() != nullptr) | ||
poly_colors = vtkUnsignedCharArray::SafeDownCast(poly_data->GetPointData()->GetScalars("Colors")); | ||
|
||
// Some applications do not save the name of scalars (including PCL's native vtk_io) | ||
if (!poly_colors) | ||
poly_colors = vtkUnsignedCharArray::SafeDownCast(poly_data->GetPointData()->GetScalars("scalars")); | ||
|
||
// TODO: currently only handles rgb values with 3 components | ||
if (poly_colors && (poly_colors->GetNumberOfComponents() == 3)) | ||
{ | ||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_temp(new pcl::PointCloud<pcl::PointXYZRGB>()); | ||
cloud_temp->points.resize(nr_points); | ||
double point_xyz[3]; | ||
unsigned char point_color[3]; | ||
for (vtkIdType i = 0; i < mesh_points->GetNumberOfPoints(); ++i) | ||
{ | ||
mesh_points->GetPoint(i, &point_xyz[0]); | ||
(*cloud_temp)[i].x = static_cast<float>(point_xyz[0]); | ||
(*cloud_temp)[i].y = static_cast<float>(point_xyz[1]); | ||
(*cloud_temp)[i].z = static_cast<float>(point_xyz[2]); | ||
|
||
poly_colors->GetTupleValue(i, &point_color[0]); | ||
(*cloud_temp)[i].r = point_color[0]; | ||
(*cloud_temp)[i].g = point_color[1]; | ||
(*cloud_temp)[i].b = point_color[2]; | ||
} | ||
cloud_temp->width = cloud_temp->size(); | ||
cloud_temp->height = 1; | ||
cloud_temp->is_dense = true; | ||
|
||
pcl::toPCLPointCloud2(*cloud_temp, mesh.cloud); | ||
} | ||
else // in case points do not have color information: | ||
{ | ||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_temp(new pcl::PointCloud<pcl::PointXYZ>()); | ||
cloud_temp->points.resize(nr_points); | ||
double point_xyz[3]; | ||
for (vtkIdType i = 0; i < mesh_points->GetNumberOfPoints(); ++i) | ||
{ | ||
mesh_points->GetPoint(i, &point_xyz[0]); | ||
(*cloud_temp)[i].x = static_cast<float>(point_xyz[0]); | ||
(*cloud_temp)[i].y = static_cast<float>(point_xyz[1]); | ||
(*cloud_temp)[i].z = static_cast<float>(point_xyz[2]); | ||
} | ||
cloud_temp->width = cloud_temp->size(); | ||
cloud_temp->height = 1; | ||
cloud_temp->is_dense = true; | ||
|
||
pcl::toPCLPointCloud2(*cloud_temp, mesh.cloud); | ||
} | ||
|
||
mesh.polygons.reserve(nr_polygons); | ||
#ifdef VTK_CELL_ARRAY_V2 | ||
vtkIdType const* cell_points; | ||
#else | ||
vtkIdType* cell_points; | ||
#endif | ||
vtkIdType nr_cell_points; | ||
vtkCellArray* mesh_polygons = poly_data->GetPolys(); | ||
mesh_polygons->InitTraversal(); | ||
int id_poly = 0; | ||
while (mesh_polygons->GetNextCell(nr_cell_points, cell_points)) | ||
{ | ||
if (nr_cell_points == 3 && cell_points[0] != cell_points[1] && cell_points[1] != cell_points[2] && | ||
cell_points[2] != cell_points[0]) | ||
{ | ||
mesh.polygons.emplace_back(pcl::Vertices()); | ||
mesh.polygons[id_poly].vertices.resize(nr_cell_points); | ||
for (vtkIdType i = 0; i < nr_cell_points; ++i) | ||
mesh.polygons[id_poly].vertices[i] = static_cast<unsigned int>(cell_points[i]); | ||
++id_poly; | ||
} | ||
} | ||
|
||
return (static_cast<int>(nr_points)); | ||
} | ||
|
||
} // namespace utils | ||
} // namespace noether_filtering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
float64 point_spacing # Required spacing between path points | ||
float64 raster_spacing # Offset between two rasters | ||
float64 tool_offset # How far off the surface the tool needs to be | ||
float64 min_hole_size # A path passes over smaller holes breaks into two on larger wholes | ||
float64 min_segment_size # The minimum segment size to allowed | ||
float64 raster_rot_offset # use this angle when no sources are povided | ||
bool generate_extra_rasters # Add extra strokes off the boundaries (NOT YET IMPLEMENTED BY HEAT METHOD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
float64 raster_spacing # Offset between two rasters | ||
float64 point_spacing # Required spacing between path points | ||
float64 raster_rot_offset # Specifies the direction of the raster path in radians | ||
float64 min_segment_size # The minimum segment size to allow when finding intersections; small segments will be discarded | ||
float64 min_hole_size # A path may pass over holes smaller than this, but must be broken when larger holes are encounterd. | ||
float64 tool_offset # How far off the surface the tool needs to be | ||
float64 raster_spacing # Offset between two rasters | ||
float64 point_spacing # Required spacing between path points | ||
float64 raster_rot_offset # Specifies the direction of the raster path in radians. Rotates about short dimension of bounding box. | ||
float64 min_segment_size # The minimum segment size to allow when finding intersections; small segments will be discarded | ||
float64 min_hole_size # A path may pass over holes smaller than this, but must be broken when larger holes are encounterd. | ||
float64 tool_offset # How far off the surface the tool needs to be | ||
float64 search_radius # radius over which the normals are averaged | ||
bool generate_extra_rasters # Whether an extra raster stroke should be added to the beginning and end of the raster pattern | ||
bool interleave_rasters # create a second set of rasters interleaved inbetween first set | ||
bool smooth_rasters # post process poses by fitting a cubic b-spline and re-sampling | ||
int32 raster_style # 0,1,2 for mow_style, paint_style and read_style | ||
|
||
# When set to TRUE: initial cuts are determined using an axis-aligned bounding box. (global axes) | ||
# When set to FALSE: initial cuts are determined using an object-oriented bounding box and the | ||
# principal axes of the part. (Note that ROS sets message fields to 0/False by default.) | ||
bool raster_wrt_global_axes | ||
|
||
# Normal of the cutting planes. Points from the first raster to the second raster, not the | ||
# direction from the first point in one raster to the second point of the same raster. Specified | ||
# in the frame of the input mesh. Overrides raster_wrt_global_axes | ||
geometry_msgs/Vector3 raster_direction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This perhaps could be made to be num_of_extra_rasters so that more than one could be added if needed. Zero would be the default case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea. thanks