jkuusama / LitePlacer-retired-experiment

3 stars 15 forks source link

Implement position confidence model to enforce homing #8

Open mrandt opened 9 years ago

mrandt commented 9 years ago

I suggest to introduce some sort of position confidence management - could be very basic for now.

The application could keep an internal flag that stores if the current position is "valid". Flag should be enabled after the machine is homed and disabled again whenever TinyG is reset, connection is lost or motor power is disabled.

If software is not confident about the actual position, it should not allow any movements and request the user to home the machine first.

This would greatly reduce the risk of "banging the machine into the wall".

For experts, we could still keep an option to override so they can still crash their machines ;-)

thethereza commented 9 years ago

dunno. the tinyg keeps track of position and reinfoms the application when it restarts. one way would be to query the position and trust it if it isn't zero. but what if you shut it down while at zero?

mrandt commented 9 years ago

There are many situations, where TinyG "virtual" position differs from "physical" machine position:

My suggestion is simple: We should have a variable "positionValid" or similar somewhere in software, that can be queried from all movement functions.

While this flag is false, no machine movement (besides homing operation) shall be allowed. No jogging with keys, no defined locations, etc.

On software startup, flag should be initialized to false.

If machine is homed, this variable is set to true and normal operation can start.

If motors are powered off (standby) or connection to TinyG is lost (reset, emergency stop), variable is set to false again.

As a courtesy, the error message of any movement that is not allowed could ask you if you want to home - like "LitePlacer software is not confident of physical machine position. Please home machine first. Do you want to home now?"

mrandt commented 9 years ago

OK, in SVN Release 18 Reza went one step towards this - the "Home" button indicates whether the machine has been homed or not (red if not homed, green after homing).

However, the status is currently not reset. I think, home status should turn red if TinyG connection is lost, TinyG is reset (Hardware switch or unexpectedly hit limit switch) or motor power is cut (checkbox or standby).