ros-industrial / noether

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

Point ordering issue with plane_slicer #178

Open InigoMoreno opened 1 year ago

InigoMoreno commented 1 year ago

Hello. I am trying to use noether with complex geometry (such as a cylinder) and I am seeing some issues.

I am running the plane_slicer_rastering_generator_demo.launch with a cylindrical mesh (download link) and getting the following in noether.

image

As you can see, while the points seem to be correct, they seem to be ordered by the x coordinate instead of going around the cyllinder. Can someone help me figure out where to look to try and solve this?

InigoMoreno commented 1 year ago

I changed the parameters so that it only generates one raster to better show the issue. image

marip8 commented 1 year ago

What is the behavior that you are expecting from this tool path planner? Are you wanting circular paths that traverse around the perimeter of the cylinder at different heights, or do you want the same type of coverage pattern shown above, just in a different orientation?

InigoMoreno commented 1 year ago

I want circular paths that traverse around the perimeter. The piece is a cylinder, so trajectories shown above actually go through the inside of the piece.

marip8 commented 1 year ago

noether in general was not necessarily designed to handle closed or watertight shapes like this, so I'm not surprised you're seeing this error. Most of the planners are written with the assumption that you're working with a single open flat-ish surface. The reason the paths come out like this is due to the RasterOrganizationModifier which assumes that each line in the tool path segment has a relatively straight line direction (as in a regular planar raster) and attempts to sort the points by their projected distance along that average direction. This is not the case for the cylinder where each tool path segment in the "raster" is actually a circle, hence the behavior you see.

To fix this, we would need to create a new tool path modifier which sorts the points in a tool path segment in a circular fashion based on some criteria (e.g., choose points greedily by distance to previous point, etc.). Then you could apply this new modifier behind the plane slice planner in a tool path planner pipeline to produce the results you are looking for

InigoMoreno commented 1 year ago

@marip8 AFAIK the plane_slicer_rastering_generator_demo.launch does not use the RasterOrganizationModifier (see this section of code). That is why I was wondering were this sorting behaviour could be coming from.

marip8 commented 1 year ago

AFAIK the plane_slicer_rastering_generator_demo.launch does not use the RasterOrganizationModifier

It actually does. If you dig down deep enough:

This example is a bit convoluted, but that's why the reorganization is happening. Ultimately our goal is to replace tool_path_planner and some other packages with noether_tpp and simplify the examples, but we haven't had time to progress that far yet

InigoMoreno commented 1 year ago

Okay, thanks I got a bit lost there. Now I can at least try to modify it myself to suit my needs.

marip8 commented 1 year ago

Let me know if you need any more clarification or help implementing my suggestion from above if you end up creating a new tool path modifier. I would be happy to review and accept it as a contribution to the repository if don't mind making it open-source

InigoMoreno commented 1 year ago

Just commenting out the RasterOrganizationModifier seems to work fine for my use case.