Skip to content
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

Home offset to motion limits #26256

Conversation

kisslorand
Copy link
Contributor

Description

Since PR #25996 Home Offset is not taken into account for motion limits. There's no prevention for moving elements to try to move beyond the endstops resulting in grinding and losing real coordinates.
I have home offset defined as my nozzle cannot reach the bed at 0, 0 coordinates. However "G0 X0 Y0" command tries to move my nozzle to that coordinate.

This PR fixes this issue by limiting motion commands based on the defined home offset also.

@smiksky
Copy link
Contributor

smiksky commented Sep 10, 2023

Your home offsets need to be inverted, this is an... alternative duplicate (?) of #26257

@kisslorand
Copy link
Contributor Author

kisslorand commented Sep 11, 2023

Your home offsets need to be inverted

That would be a really bad idea!

@smiksky
Copy link
Contributor

smiksky commented Sep 12, 2023

I recommend that you try to correctly set your printer parameters before adding making a pull request for code that adds an inverted implementation of an extant feature.

@thinkyhead
Copy link
Member

This make pretty good sense to me. Any comment on this @InsanityAutomation ?

@smiksky
Copy link
Contributor

smiksky commented Nov 13, 2023

Is this feature not just a duplicate of software end-stops with the offsets backwards? As mentioned in #26257, both that PR and this one are fixes for a mistake in the author's configuration file. For a correctly configured system, I think this would just break all printers with home offsets, as it conflicts with software end-stops and cannot be disabled.

@smiksky
Copy link
Contributor

smiksky commented Nov 13, 2023

This PR also enforces the ends of travel to be at its newly defined bed limits, which are offset from the bed by 2 × home offset. If a printer has optical end-stops which are not at the end–of–travel, or a leveling sensor which requires the nozzle to exit the bed, they should no longer function as expected.

@kisslorand
Copy link
Contributor Author

kisslorand commented Nov 13, 2023

As mentioned in #26257, both that PR and this one are fixes for a mistake in the author's configuration file.

It worth mentioning that this is only an opinion of a user who doesn't know the exact setup of my printer.

My printer is set up in a way that the nozzle can reach the bed anywhere where physically is possible, my bed size is set up correctly, it is 310mm x 310mm, and when I issue a G0 X155 Y155 command the nozzle goes exactly at the middle of the bed. Also G28 moves my BlTouch exacty to the middle of the bed.
Without this PR the G0 X0 Y0 would force the nozzle to go to the X0 Y0 coordinates which is physically impossible on my printer.

I think this would just break all printers with home offsets, as it conflicts with software end-stops and cannot be disabled.

This PR fixes an issue with printers using HOME_OFFSET.
I have HOME_OFFSET set to X11.0000 Y16.0000 Z0.0000, so when the carriage hits the X endstop and the bed hits the Y endstop my nozzle is at 11mm to the right from the left edge of the bed and it is at 16mm to the back from the front edge of the bed.

This PR also enforces the ends of travel to be at its newly defined bed limits, which are offset from the bed by 2 × home offset. If a printer has optical end-stops which are not at the end–of–travel, or a leveling sensor which requires the nozzle to exit the bed, they should no longer function as expected.

You got it all wrong.

@InsanityAutomation
Copy link
Contributor

Fundamentally, this doesn't seem complete in thought process. It only limits movement in the direction of the home command, which doesn't make sense to me in the overall concept of the PR. Id think you would want to shift the movement space by the home offset if you want to apply anything, which follows expected function of a moved end stop switch or changed plate causing a different trigger point.

On the other PR mentioned, that would be a regression IMO. The intent of the offset is to follow a hardware change to line 0/0 back up to the front corner of the bed so that alludes to additional setup issues from the start.

I would support adjusting the softendstop limit min / max following the home offset to keep the stop in the same native space pre offset as a configurable element per direction to supersede both of these PR's. I can see the home direction stopping at the home point always, opposing direction could be either depending on the machine. Being part of soft limits allows user to disable when it acts up.

@thisiskeithb
Copy link
Member

Without this PR the G0 X0 Y0 would force the nozzle to go to the X0 Y0 coordinates which is physically impossible on my printer.

Sounds like you need to reduce your configured bed size since it’s not fully reachable.

@kisslorand
Copy link
Contributor Author

That would be a wrong configuration because my bed IS 310mm x 310mm, Reducing the configured bed size will make more area unreachable (the other ends from the endstops).
Having the probe to an offset from the nozzle makes the probe to not be able to reach the whole bed also. This doesn't mean one should reduce the bed size also for the probe to be able to reach the whole defined bed size. It's the same with the nozzle, it's positioned at an offset from the X and Y endstops.
Isn't this the whole purpose of the HOME_OFFSET? To define where is the nozzle regarding to the endstops? What about those with dual nozzle? They should also define a smaller bed because one of the nozzles cannot reach the whole bed?
Those who define also HOME_OFFSET for Z should also reduce the Z_MAX_POS accordingly?

My configuration reflects the state of my machine and together with this PR makes the nozzle to be able to reach the whole physically available bed area and not to go beyond the physical limits, positions the nozzle and the probe exactly at the real coordinates of the bed. How is this wrong? What other "right" configuration makes these possible?

@ellensp
Copy link
Contributor

ellensp commented Nov 14, 2023

Travel size can be larger than bed size, but bedsize should never be larger than travel size (from the firmware point of view)

"my nozzle cannot reach the bed at 0, 0 coordinates" You must allow for this. home X,Y, this is your X0, Y0 point (or x_min, Y_min pint if off the bed) , take all bed measurements from your X0,Yo point. regardless if its sicks out somewhere, this is unreachable and thus irrelevant to firmware

Yes the firmware expects to be able to move the axis from the x_min to the x_max and the y_min to the y_max value, that is what these values are for.

@kisslorand
Copy link
Contributor Author

kisslorand commented Nov 14, 2023

So what about printers with dual nozzle where one of the nozzle cannot reach 0,0 coordinates? Users of those machines should also configure a smaller bed?

What about printers where you can change the toolhead and the nozzle is at a different position on each toolhead? One should recompile Marlin with different bed size configured for each toolhead and reflash the FW each time the toolhead is changed? It should be as simple as to set the home offset for each toolhead and to be good to go without the danger of the toolhead to want to go beyond the physical limits. Also it would be nice to have the nozzle of each toolhead to go to the exact same location on the bed for the same G0 X Y command.

@thinkyhead
Copy link
Member

thinkyhead commented Nov 14, 2023

So what about printers with dual nozzle where one of the nozzle cannot reach 0,0 coordinates?

That has long been accounted for by modifying the soft endstop limits on a tool change.

Users of those machines should also configure a smaller bed?

Sometimes. Generally, you define the bed area as being within the total movement area. A given tool may or may not be able to reach all points on the bed, so effectively the bed is made smaller. On a carriage with two nozzles, the left nozzle might not be able to reach the right edge of the bed while the other tool can. We can tell whether this is the case by looking at the motion limits for X, the offset of the tool relative to the carriage, and the defined bed width.

it would be nice to have the nozzle of each toolhead to go to the exact same location on the bed for the same G0 X Y command

That should be the case, assuming soft endstop constraints have not been applied.

@thinkyhead
Copy link
Member

So, when your carriage is at the farthest movement limit at the front-left, where is the nozzle positioned? Is it within the bed area? Then you could define that as your 0, 0 if you like. But, if you'd rather call that position "20, 20" then you could go ahead and set your XY MIN_POS and HOME_POS to 20, 20. If that means your printable area is smaller by 20mm in each dimension, then that does need to be reflected in your configuration. The "bed size" in Marlin is not just the size of the bed plate. It's the printable area size, which is most often smaller than the build plate size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants