ClemensElflein / open_mower_ros

Other
500 stars 124 forks source link

Obstacle too close to the area bound can lead to wrong path #63

Closed alexvaut closed 4 months ago

alexvaut commented 1 year ago

I have an example where an obstacle is close to the area bound. It makes the polygon of the first outline to be split. It could be fine, but the assumption is that n outlines (by default n=4) beginning and end are close to each other so they can form a unique path. This assumption is wrong (I believe).

Here is the 4th outline which is cut into 3 pieces (a long one and the 2 highlighted): image

And here you can see when the 2 are finished, it goes straight to the next outline (the second), the beginning of this one is too far way: image

It passes outside of the authorized navigation area.

From my point of view, the issue is in function planPath of coverage_planner.cpp but I don't know exactly, having unit tests would help...

alexvaut commented 1 year ago

Visualization of the fix: image

TomasSeven commented 10 months ago

this fix is working for me

ClemensElflein commented 4 months ago

Thank you for the PR, while it fixes the issue you see it re-introduces an old one (which is the reason why the paths were merged in the first place).

The initial issue was that when not having the paths merged, there will be a piece of navigation between each outline (e.g. from the innermost to the next outer one). This will cause the mower to do the "rotate - drive - rotate" thing between each outline change. If we are close to an obstacle, the mower will crash in that case, because it is not round and therefore cannot necessarily rotate in place. This is especially true near obstacles. Since outlines are often near obstacles, it was a large issue - hence the grouping.

For a real fix, we need to group, but more intelligently (i.e. detect if the added path segment would lead through a forbidden area. In this case not group)

karlranseierausrom commented 4 months ago

I have no idea of the source-code of Slic3r and I am more comfortable with graphical programming. It will be really hard for me to understand the code. But: For me it sounds like the problem is somewhere else, but not in the slic3r. Why is it rotating when it changes to navigation? In 3D printing it makes sense to distinguish between printing and moving, but here every move can be mowing. So maybe it is solved, if the navigation is redefined as mowing? Anyway I had examples with hand drawn rectangles, where at one path the mowing motor was switches off. There were only 3 straight lines mowing, and one line was not shown, but the mower drove it with slow mowing motor.

ClemensElflein commented 4 months ago

@karlranseierausrom since the mower cannot move sideways, on tight turns it needs to rotate on spot. It has nothing to do with mowing vs not mowing.

I.e. if you are driving the outline as a spiral, it will be one continuous motion, but if you do like two tight 90 degree turns between the lines, the mower will rotate in place, because it cannot just shift sideways like that. During polygon grouping, we can make sure that there are no such small 90 degree turns in there in order to avoid this behavior.

ClemensElflein commented 4 months ago

should be fixed in main, please test and report back. If anyone has map.bag files to test, feel free to share (e.g. discord or link here).

ClemensElflein commented 4 months ago

thank you @11phc for providing a very problematic map, here are some before and after pics before1 before2 before3 after1 after2 after3

11phc commented 4 months ago

That is looking much better, thank you. So do you think you have fixed it now in the slicer / router planner?
Or are my maps a bit "corrupted" from the start (because of my alternative way of creating them in arcgis and exporting to GPX etc.) and you did it instead by modifying my maps?

ClemensElflein commented 4 months ago

Code changes only, I did not touch the maps

karlranseierausrom commented 4 months ago

@karlranseierausrom since the mower cannot move sideways, on tight turns it needs to rotate on spot. It has nothing to do with mowing vs not mowing.

Looks like I didn't understand the problem. I observed some weird 270° and -270° moves at some point. I thought you were talking abut the

Is a json file useful, too? Do you want another? I deleted the area and will rewrite it on the weekend and test the new version. Than I can stay on official edge and don't need my extra repo.

Thanks for all your work!

jludo1 commented 4 months ago

currently in edge version (I have just completely redone the SD card)

my mower always tries to cross my obstacles I attach a screenshot of the GUI interface

I share with you by map.bag on (post@x-tech.online)

thank you for your work on this project map

ClemensElflein commented 4 months ago

This looks like an edited map with sparse points which is known to break the path planning algorithm

jludo1 commented 4 months ago

I drew the map from the gui interface (https://github.com/cedbossneo/openmower-gui) the problem and maybe due to that?

Is there a way to modify the map and correct this?

ClemensElflein commented 4 months ago

Yes, the edited maps are known to cause issues. I did not look into the map editors too much, so I can't really help with this. Best would be to just record the map instead of creating it in the UI. If you have questions regarding map editing, you can try asking on Discord or in the GUI repo, I know that some people do it successfully.

I'm closing this for now, since it is reported fixed by some people.