ros-industrial / noether

Tool path planning and surface segmenter
124 stars 45 forks source link

Bug fix for surface-walk tool path planner #119

Closed marip8 closed 3 years ago

marip8 commented 3 years ago

I encountered the a bug in the surface-walk tool path planner relating to the specification of the cut_direction and cut_centroid parameters. The size of the cut_direction vector is used to create the initial slice through the mesh. If you set this without regard to the size of your mesh, the first plane cutting the mesh may not fully cross the mesh. The result is tool paths that do not span the entire surface. My solution to this issue is to scale the cut_direction vector by the size of the largest OBB axis such that the cutting plane is always wide enough to intersect the entire mesh

This PR also removes the cut_centroid parameter. This parameter is unused in the rest of the repository and isn't even defined in the noether_msgs surface walk planner config message. Retaining the default value of [0, 0, 0] causes issues if the centroid of the mesh is not near [0, 0, 0], like the example below:

Screenshot from 2020-12-11 09-44-47

Here the cutting plane (whose size is defined by the extents of the mesh) doesn't even intersect the mesh because it's assumed to be at the defined centroid of [0, 0, 0]. Since we already know the centroid of the mesh, why does the user need to specify a centroid if they just want to specify the cut direction? If you do this naively or incorrectly (like how I initially encountered this issue), then the planner fails or only cuts through part of the mesh. My solution is to eliminate the cut_centroid parameter and use the already-known centroid of the mesh to generate the cutting plane. The result for my mesh then looks appropriate:

Screenshot from 2020-12-11 09-40-29