Added simple controller
This commit is contained in:
parent
30bcc00331
commit
c9fbc03e79
2 changed files with 17 additions and 1 deletions
|
@ -66,6 +66,7 @@ class GCodeToMotors:
|
|||
z_throttle : int = 0
|
||||
|
||||
feedrate: float = 0. # In m/mn
|
||||
ctrl_step: float = 1e-5 # in s
|
||||
|
||||
abs_mode: bool = False
|
||||
|
||||
|
|
|
@ -51,15 +51,30 @@ class PIDController(Controller):
|
|||
gtm.z_throttle = 0
|
||||
|
||||
|
||||
class Dezimpots(Controller):
|
||||
class DummyController(Controller):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def __call__(self, gtm, *args, **kwargs):
|
||||
print("Call Me")
|
||||
|
||||
feed = self.feedrate
|
||||
dx, dy, dz = self.delta_units
|
||||
feed_x = feed * dx/(dx**2 + dy**2 + dz**2)
|
||||
feed_y = feed * dy/(dx**2 + dy**2 + dz**2)
|
||||
feed_z = feed * dz/(dz**2 + dy**2 + dz**2)
|
||||
|
||||
gtm.x_direction = 1 if gtm.delta_steps[0] > 0 else 0
|
||||
gtm.y_direction = 1 if gtm.delta_steps[1] > 0 else 0
|
||||
gtm.z_direction = 1 if gtm.delta_steps[2] > 0 else 0
|
||||
|
||||
gtm.throttle_x = floor(gtm.FAST_XY_FEEDRATE/feed_x)
|
||||
gtm.throttle_y = floor(gtm.FAST_XY_FEEDRATE/feed_y)
|
||||
gtm.throttle_z = floor(gtm.FAST_Z_FEEDRATE/feed_z)
|
||||
|
||||
gtm.throttle_x = 0 if gtm.throttle_x >= 65536 else gtm.throttle_x
|
||||
gtm.throttle_y = 0 if gtm.throttle_y >= 65536 else gtm.throttle_y
|
||||
gtm.throttle_z = 0 if gtm.throttle_z >= 65536 else gtm.throttle_z
|
||||
|
||||
# If we are close enough, we're good
|
||||
return (gtm.ctrl_step*(feed*1000./60) >= 2.*(dx**2+dy**2+dz**2)**.5):
|
||||
|
|
Loading…
Reference in a new issue