From 2d617fcec967b9571ace077c49095f67b3c5275f Mon Sep 17 00:00:00 2001 From: mpboyer Date: Mon, 13 Jan 2025 16:53:46 +0100 Subject: [PATCH] Hardware + Controller Classes --- GCode_Interpreterdc.py | 4 +++- controller.py | 16 ++++++++++++++++ hardware.py | 11 +++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 controller.py create mode 100644 hardware.py diff --git a/GCode_Interpreterdc.py b/GCode_Interpreterdc.py index 10d9423..2249890 100644 --- a/GCode_Interpreterdc.py +++ b/GCode_Interpreterdc.py @@ -1,8 +1,8 @@ import time -from collections import defaultdict from typing import * import numpy as np +import controller Point = NewType("point", List[float, float, float]) @@ -296,6 +296,7 @@ class GCodeToMotors: case 7: # Not canonical, but ellipses + pass case 20: self.x_units = self.X_STEPS_PER_INCH @@ -361,6 +362,7 @@ class GCodeToMotors: return + def has_command(key: str, instruction: str) -> bool: return key in instruction diff --git a/controller.py b/controller.py new file mode 100644 index 0000000..bc22a46 --- /dev/null +++ b/controller.py @@ -0,0 +1,16 @@ +from GCode_Interpreterdc import GCodeToMotors + +class Controller: + def __init__(self): + pass + + def __call__(self, gtm, *args, **kwargs): + assert isinstance(gtm, GCodeToMotors) + return None + + +class PIDController(Controller): + def __call__(self, gtm, *args, **kwargs): + return None + + diff --git a/hardware.py b/hardware.py new file mode 100644 index 0000000..d0e7841 --- /dev/null +++ b/hardware.py @@ -0,0 +1,11 @@ +from GCode_Interpreterdc import GCodeToMotors + +class Hardware: + def __init__(self): + pass + + def probe(self, gtm: GCodeToMotors): + return + + def realize(self, gtm: GCodeToMotors): + return \ No newline at end of file