-
-
Notifications
You must be signed in to change notification settings - Fork 179
Add support for forbidden zones #731
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for working on this. It is an interesting feature and has been requested multiple times. |
dalegaard
left a comment
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.
Overall fine but needs a couple of tweaks.
| self.axes_max = toolhead.Coord(*[r[1] for r in ranges], e=0.0) | ||
| self.dc_module = None | ||
| self.supports_dual_carriage = True | ||
| self.forbidden_zones = ForbiddenZones(config) |
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.
I think this should move in to the toolhead so all kinematics benefit. Toolhead calls check_move, so the forbidden_zones check_move can go right before that.
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.
Sounds good, i'm on it.
| # | ||
| # This file may be distributed under the terms of the GNU GPLv3 license. | ||
|
|
||
| from shapely import from_wkt, STRtree, LineString |
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 should be lazy-loaded if config.has_section("forbidden_zones") passes. Otherwise, all existing machines are broken until they update dependencies, which I think is a bit extreme. The way LoadCellPrinterProbe does this is fine, as a reference.
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.
Ditto
Thanks. I'll take care of it all, and update the docs/etc as well. |
This change add supports for forbidden zones of movement.
They are specified as shapes (in WKT format), and any movement
that intersects with a forbidden zone raises a move error.
This is useful when you have a toolchanger or other area that
you want avoided, but it's not the width/length of the entire
bed, so changing the bed size is unhelpful.
The current implementation is very simple - we use shapely to
parse WKT and build an STRtree, and check for intersection
of the move line with the forbidden zones.
Performance implications are ~nil.
If there are no forbidden zones, there is no time spent checking.
In the the common case of 1-2 polygons that basically never intersect,
you add a few x/y point comparisons to notice
the non-intersection. It would actually be more theoretically optimal
in terms of comparisons to add the endstops as lines to the STRtree and
eliminate the existing endstop checks.
But even with an absurd amount of polygons, the per-check time is essentially
non-measurable on an rpi 4/5.
The current PR is not fully done, but works.
Before i went further, wanted to see if anyone else wanted it.
Stuff to still be done:
Anyway, if folks think it is useful enough, i'll finish it up and flag is as non-draft.
Checklist