klipper icon indicating copy to clipboard operation
klipper copied to clipboard

Axis movement without homing

Open ich777 opened this issue 8 years ago • 46 comments

Is it possible to move the axis without homing the printer or an override? Nothing found in the configuration folder.

If a print is finished i tell my printer to go to the back left position but if i want to higher the Z axis it's not possible, is there anything that i'm missing? Even if the steppers turn off i can't move the axes any more.

ich777 avatar May 11 '18 13:05 ich777

This is covered in the FAQ https://github.com/KevinOConnor/klipper/blob/master/docs/FAQ.md#why-cant-i-move-the-stepper-before-homing-the-printer

HorseEars avatar May 13 '18 21:05 HorseEars

@HorseEars Thank you for that, but is there an implementation or option to turn that off? This would be a nice feature (there are enough ways to crash your axis without that option :D ).

ich777 avatar May 14 '18 04:05 ich777

I generally agree with you and would like to see an option for this because you can crash either way, especially on my dual carriage. It's possible to go into the source and disable the checks if you want.

HorseEars avatar May 14 '18 07:05 HorseEars

I think a simple configuration in the printer.cfg would be the best solution. My coding skills are not the best and i think this would be a nice option to have.

ich777 avatar May 14 '18 08:05 ich777

Kevin didn't like that...so we didn't even try to create a pull request.

@ich777:

there are enough ways to crash your axis without that option

I agree...

There are some aspects:

  • after powering the printer the position is not known (though I tend to always move it to the same position before poweroff, but there are edge cases)
  • after disabling motors the position can change (I think this is usually correct, but depends on the printer construction)
  • I think there is a difference between automatic movment (e.g. gcode file) and manual movement (you should know what you are doing), but I don't see how the firmware could distinguish these two situations safely.
  • several printers need manual intervention before starting an automatic homing procedure at least in edge cases. Not being able to manually move makes rescue from bad situations more difficult. So it's one safety reason against another.

That said, @cruwaller has code for the simple setting to disable the safety "feature". I also have an implementation, but am using cruwaller's now.

There are two cases to consider:

  1. moving before homing
  2. moving after motor off

Both are separately configurable for cruwallers code.

hg42 avatar May 14 '18 18:05 hg42

I think something like this should work:

G92 Z0
G91
G1 Z7 F300
M114
G28 X0 Y0
G90
G1 Y180 F6000

Basically: I'd say if you G92 a position the printer should assume that it is in this position and allow movement.

oderwat avatar May 24 '18 12:05 oderwat

I don't have much to add to this issue outside of that which is in the FAQ cited above. I've accidentally crashed my head into the bed/wall too many times - it's very frustrating. So, I think some simple software checks against obviously bad commands are worthwhile. To me, this isn't about protecting users from themselves; it's more about basic sanity checks.

I've no objection if someone wants to add a feature to move the printer without homing. (Indeed it's on the Todo list.) I've never gotten a pull request with that feature. Note, though, this is not as easy as disabling the check_moves() method, as some kinematics require check_moves() to operate correctly.

Separately, sometimes it is necessary to move the steppers for testing purposes. I recently added a STEPPER_BUZZ command to facilitate this (commit ee4f37fe).

-Kevin

KevinOConnor avatar May 25 '18 17:05 KevinOConnor

I've no objection if someone wants to add a feature to move the printer without homing

oh, really? I always had the impression you wouldn't accept it (I think we had discussions about it).

I am already trying if I can switch back to your repo. I always wanted this, but there are some things, I need/want which you didn't accept, and that were discussed in some PRs and issues, apart from the tmc2130 and lpc176x etc. which are on the way now. You didn't explicitely reject all of them, but kind of implicitly. So, there is hope for me...

If I get around my current problems with switching back and real life gets out of my way, I already plan to reimplement some of these features: allow_moves_before_homing motor_off_does_not_invalidate_position (with enough friction, axes don't move by themselves) retract_after_homing (to free the end stops) homing_slowdown (allow to configure the speed of the second move, 1/2 is not enough for me)

hg42 avatar May 25 '18 18:05 hg42

I may try to implement a force homing with offesets as extension to the G28 command:

`G28 X0 Y50 Z5 O1' may then "think" the printer homed and is at X0 Y50 Z5 without doing any movement from the actual position.

I actually only want to move Z up relative and never more down than it went up. So I could also allow Z up without homing but always set Z0 to the last position automatically.

Something in those lines.

oderwat avatar May 25 '18 20:05 oderwat

@KevinOConnor I destroyed beds, nozzles, linear rods and printing surfaces while testing my BLTouch and other sensor modifications for the Anet A8 / Marlin. In the end I created a Z axis decoupling so it physically could not move into the bed with much force anymore. I also modified my current printer with a separating Z coupler. I think that is just what happens when you are experimenting with and developing firmware or hardware.

I still understand your point of view but to me it is part of a safety procedure that I can lift Z by some mm anytime even if not homed!

oderwat avatar May 25 '18 20:05 oderwat

On Fri, May 25, 2018 at 11:54:05AM -0700, Harald wrote:

I've no objection if someone wants to add a feature to move the printer without homing

oh, really? I always had the impression you wouldn't accept it (I think we had discussions about it).

I don't recall that, but this topic has been raised enough times that it is a bit of a blur to me.

FWIW, I do have some general preferences:

  • I think the default should continue to be to implement basic move sanity checks
  • best if it is in an "extras" module and mostly contained within that module
  • best to avoid "legacy g-code" style commands

So, for example, I wouldn't be excited about an implementation that modified the move() method, added a bunch of flags to check_move() in every kinematic implemntation, or made significant changes to gcode.py.

In contrast, for example, a new klippy/extras/i_really_want_to_move.py that adds a new "I_REALLY_WANT_TO_MOVE" command which calls toolhead.get_kin().set_position(pos, homing_axes=...) ; toolhead.move()..

Cheers, -Kevin

KevinOConnor avatar May 25 '18 22:05 KevinOConnor

On Fri, May 25, 2018 at 01:35:43PM -0700, Hans Raaf wrote:

@KevinOConnor I destroyed beds, nozzles, linear rods and printing surfaces while testing my BLTouch and other sensor modifications for the Anet A8 / Marlin. In the end I created a Z axis decoupling so it physically could not move into the bed with much force anymore. I also modified my current printer with a separating Z coupler. I think that is just what happens when you are experimenting with and developing firmware or hardware.

Ah, to be clear, my collisions were back with Marlin when I first started doing 3d printing. I basically never get collisions now. Partly because the software stops that, but mostly because I'm more knowledgeable. In any case, I was frustrated enough with the Marlin behaviour that I don't want to return to it, and I see no reason to inflict it on other new users. Some basic checks can prevent a huge amount of frustration.

-Kevin

KevinOConnor avatar May 25 '18 22:05 KevinOConnor

@KevinOConnor Oh, I missed a post of you

In contrast, for example, a new klippy/extras/i_really_want_to_move.py that adds a new "I_REALLY_WANT_TO_MOVE" command which calls toolhead.get_kin().set_position(pos, homing_axes=...) ; toolhead.move()..

ok, I already know your preferences, but I don't agree with everything (though I can understand and accept your reasons). The solution above makes sense and I admit I wouldn't have thought of this possibility. I would have created a pull request with a setting to enable the movement. But this is also because I have different goals.

Nobody (excluding experts) manually enters movement commands. Out there is a whole world of tools that simply don't expect this restriction. If you can only move the toolhead with a special command, every host software with arrow buttons etc. doesn't work out of the box (before homing) and must be changed in code or configured. I guess most hosts don't allow configuring another command for G0 or G1.

But, I think the real problem is another one. I hope you agree...if someone moves the tool head manually (with buttons), he/she knows why and usually obeys the physical conditions (limits etc.). The protection makes sense when printing automatically, and even more if the print is started remotely.

So the main problem would be to distinguish between manual and automatic movement. This is not possible by looking at the gcode. The commands are basically the same. Perhaps the speed of incoming gcode commands could give a hint.

But, on the other hand, which slicer produces gcode without a home command? Which other cases need this kind of protection?

Additionally, I think it is often dangerous for the printer hardware to issue a home command, because after a failure everything can be wrong. And that's the main case where you have to move the toolhead before homing. Who protects the home command from doing bad things? E.g. if my printer's toolhead is beneath and below the bed it cannot home directly. The only one who can solve this is the user, so why should we restrict him/her?

hg42 avatar Jun 06 '18 20:06 hg42

The thing with the dangerous "G28" came to my mind too. I still think the limitation is artificial and not needed. May idea is to tell the printer "enable your motors and register that you are at the given position" it should just allow this and take an internal state being at that position. After this you can move it. Of course the user could make a failure. But he can do that also through other manipulations. Having a way a manual positioning, avoiding using the end stops seems like a reasonable wish to me.

oderwat avatar Jun 06 '18 20:06 oderwat

The movement is prohibited by setting the limits to an impossible range (min = 1, max = -1) when the kinematics object is created and after motor_off:

self.limits = [(1.0, -1.0)] * 3

So there could be a command (like ALLOW_MOVEMENT_WITHOUT_HOMING) to set these to (min = -(position_max-position_min), max = +(position_max-position_min)), assuming the toolhead initially is at (0, 0), so it can move a full width in both directions.

Unfortunately there are hosts that do not allow the definition of custom buttons.

--

It is impossible to override arbitrary code by a module. You can usually only override parts that are designed to allow this. So, most behavior implemented in the code base cannot be changed by a module (or extension, plugin).

That's why I once started an issue to discuss about an infrastructure for plugins. But at that time @KevinOConnor didn't like the idea. Now we have "extras" as a mechanism to extend the code base. That's fine, but there are still a lot of things we cannot do in such an extra module.

--

One possibility to override certain code is to define hooks or handlers. A registration system could allow multiple modules to chain their manipulations. This allows to intercept behavior, but the possibilities are restricted to functionality that is explicitly designed for interception (= providing hooks).

--

The natural way in object oriented software would be to create a derived class and use this instead of the base class. For example, a new kinematics class CoreXYKinematics_allowing_movement_without_homing could be derived from CoreXYKinematics and used instead.

Something similar could be done with a wrapper object delegating everything to the original object and replacing only the desired functionality.

Both object oriented ways can only override (=replace) complete functions. This means functions should be small and do only one thing. This is a major rule in OOP.

In some cases (e.g. values or state kept in variables) it is possible to inherit the complete behavior and change something afterwards in the wrapper function.

f()      # the base functionality
  var = value

g()      # the wrapper
  call f()   # inherit all functionality from f()
  var = other_value  # override value

This would indeed work for self.limits.

But it would not work in many other cases. E.g. if var would be used in side f() or if some behavior in f() should be removed.

hg42 avatar Jun 06 '18 23:06 hg42

On Wed, Jun 06, 2018 at 01:23:15PM -0700, Harald wrote:

But, I think the real problem is another one. I hope you agree...if someone moves the tool head manually (with buttons), he/she knows why and usually obeys the physical conditions (limits etc.).

As I mentioned earlier in this thread, when I first started with 3d printers I had a very frustrating time with accidental bed/wall crashes. The vast majority of these were due to me incorrectly jogging the head into the wall/bed. It was very frustrating. It is way too easy to accidentilly issue an incorrect jogging move during calibration (due to my perspective when looking at the printer I'd hit up when I meant down, or I'd hit the 10mm button to move the X and then try to adjust the Z without first hitting the .1mm button, or I'd just accidentally mis-click and go further than I wanted, etc.) These types of moves are obviously incorrect, and I don't feel there is a compelling reason to accept those actions when preventing them is obviously correct and trivial.

So, I don't agree that some G0/G1 actions should be accepted blindly. If the user wants to turn off checks, then that's fine with me, but I do think it should be an explicit decision to do so. The default should be to do basic sanity checks on movements.

Additionally, I think it is often dangerous for the printer hardware to issue a home command, because after a failure everything can be wrong. And that's the main case where you have to move the toolhead before homing.

The main "use case" for movement without homing that I'm aware of is a user that instructed the motors to turn off (typically via a scripted action) when the user actually wanted to move the motors. It seems to me, the simplest solution is to not turn the motors off if one doesn't want the motors off. That's why the FAQ is worded to help users fix that:

https://github.com/KevinOConnor/klipper/blob/master/docs/FAQ.md#why-cant-i-move-the-stepper-before-homing-the-printer

-Kevin

KevinOConnor avatar Jun 07 '18 15:06 KevinOConnor

I think the only way I actually need moving without homing is after I pressed the "EMERGENCY" button / cut off serial. Then I want to move the head up as quick as possible to not drop and melt into whatever is on the plate. I may also want to move it to the side or front / back. But as the motors are off, I could do that manual as long as I am near the printer. So what about allowing a "move Z up for max of X mm" anytime?

Beside finding a "public agreed method" I am going to implement something, what I want to use later. It's open source after all.

P.S.: @KevinOConnor maybe not everybody is bad with "up/down" and "left/right". Do you really think it is fair to limit others to what seems to be your personal weakness?

oderwat avatar Jun 07 '18 15:06 oderwat

On Thu, Jun 07, 2018 at 03:20:52PM +0000, Hans Raaf wrote:

I think the only way I actually need moving without homing is after I pressed the "EMERGENCY" button / cut off serial. Then I want to move the head up as quick as possible to not drop and melt into whatever is on the plate. I may also want to move it to the side or front / back. But as the motors are off, I could do that manual as long as I am near the printer. So what about allowing a "move Z up for max of X mm" anytime?

The above is true. Alas, commanding the micro-controller code after the micro-controller code has entered a shutdown state is non-trivial and has notable risks. Someone can tackle that if they wish - I suspect engineering a mechanical solution would be simpler and more effective (eg, using a mechanical mechanism to retract the head, homing away from the bed, etc.).

P.S.: @KevinOConnor maybe not everybody is bad with "up/down" and "left/right". Do you really think it is fair to limit others to what seems to be your personal weakness?

Your comment above and comments elsewhere can be easily interpretted as insulting. It's hampering effective communication between us. I suggest that in the future you take a moment to proofread your posts and limit them to technical matters.

I do not feel I am limiting others. It's trivial for a developer to change the code to do whatever they wish - for example, the klippy/extras/homing_override.py code disables the boundary checks in a single python statement. I've repeatedly said that I was open to others submitting a change to the code to disable the boundary checks. I feel my experience is an important "use case" that is not unique.

-Kevin

KevinOConnor avatar Jun 07 '18 15:06 KevinOConnor

the EMRGENCY case is my main argument, too. E.g. my delta used to release one or two of it's magnetic arms and this sometimes moved the toolhead to a bad position (melting something etc.). I then wanted to move it away quickly. This should be possible. Mechanical solutions don't help, if you are controlling it remotely.

Anyways, you said, the main reason is because of beginners (as you were, when it was frustrating, I also remember these times for me). And:

If the user wants to turn off checks, then that's fine with me, but I do think it should be an explicit decision to do so. The default should be to do basic sanity checks on movements.

So, I think, there are these cases:

  • beginners that need protection against their own errors
  • more advanced users (but still non-programmers) that don't need this kind of protection anymore
  • programmers

The second group needs a simple solution (config) to disable the protection without fiddling with code. And not all programmers want to maintain their own forks only to disable such things.

So, please could you accept a PR for a setting to disable this? Such a setting could be described in a document, that only advanced users will find. You could even call it "dangerous settings - keep away".

hg42 avatar Jun 07 '18 17:06 hg42

engineering a mechanical solution would be simpler and more effective

Yes. I have that. On my A8 I decoupled the Z Axis by using gravity and teflon matte for the connection. That worked very well and made it possible to lift up the Z-axis anytime, even while printing. On my Ender 3 I use coupler which separate when a sufficient force is applied. This already saved me from disasters while I was experimenting with different magnetic print plate solutions and forgot that a mirror is much thicker than a PEI foil :-)

Your comment above and comments elsewhere can be easily interpretted as insulting.

I could answer with some long smart ass comment about what I can "interpret" into what other people did to me. I hope you will eventually recognise that I am not spending time on GitHub Issues to insult people. I myself got upset because of ineffective communication. I usually try to let this not get into the way. I am a very pragmatic person. Maybe sitting in the same room with some of you guys would make all the difference.

Even if you don't feel like you are limiting others, you do and this is also your job as maintainer and main developer. I already got, that you probably will accept a PR. I just don't have the time to make a careful change, testing and contributing it.

oderwat avatar Jun 07 '18 17:06 oderwat