diff --git a/docs/Code_Overview.md b/docs/Code_Overview.md index c038f49d..1bb883f4 100644 --- a/docs/Code_Overview.md +++ b/docs/Code_Overview.md @@ -322,10 +322,10 @@ Useful steps: 4. Implement the `set_position()` method in the python code. This also calculates the desired stepper positions given a cartesian coordinate. -5. Implement the `get_position()` method in the new kinematics - class. This method is the inverse of set_position(). It does not - need to be efficient as it is typically only called during homing - and probing operations. +5. Implement the `calc_position()` method in the new kinematics class. + This method is the inverse of set_position(). It does not need to + be efficient as it is typically only called during homing and + probing operations. 6. Implement the `move()` method. This method generally invokes the iterative solver for each stepper. 7. Other methods. The `home()`, `check_move()`, and other methods diff --git a/klippy/cartesian.py b/klippy/cartesian.py index 4afbdc33..7fc1419e 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -51,7 +51,7 @@ class CartKinematics: if flags == "Z": return [self.rails[2]] return list(self.rails) - def get_position(self): + def calc_position(self): return [rail.get_commanded_position() for rail in self.rails] def set_position(self, newpos, homing_axes): for i in StepList: @@ -161,7 +161,7 @@ class CartKinematics: dc_axis = self.dual_carriage_axis self.rails[dc_axis] = dc_rail extruder_pos = toolhead.get_position()[3] - toolhead.set_position(self.get_position() + [extruder_pos]) + toolhead.set_position(self.calc_position() + [extruder_pos]) if self.limits[dc_axis][0] <= self.limits[dc_axis][1]: self.limits[dc_axis] = dc_rail.get_range() self.need_motor_enable = True diff --git a/klippy/corexy.py b/klippy/corexy.py index a2b99248..773b46d6 100644 --- a/klippy/corexy.py +++ b/klippy/corexy.py @@ -42,7 +42,7 @@ class CoreXYKinematics: if flags == "Z": return [self.rails[2]] return list(self.rails) - def get_position(self): + def calc_position(self): pos = [rail.get_commanded_position() for rail in self.rails] return [0.5 * (pos[0] + pos[1]), 0.5 * (pos[0] - pos[1]), pos[2]] def set_position(self, newpos, homing_axes): diff --git a/klippy/delta.py b/klippy/delta.py index e458e301..efcfe7a5 100644 --- a/klippy/delta.py +++ b/klippy/delta.py @@ -93,7 +93,7 @@ class DeltaKinematics: for i in StepList] def _actuator_to_cartesian(self, pos): return actuator_to_cartesian(self.towers, self.arm2, pos) - def get_position(self): + def calc_position(self): spos = [rail.get_commanded_position() for rail in self.rails] return self._actuator_to_cartesian(spos) def set_position(self, newpos, homing_axes): diff --git a/klippy/extras/bed_tilt.py b/klippy/extras/bed_tilt.py index d043f508..ae8772aa 100644 --- a/klippy/extras/bed_tilt.py +++ b/klippy/extras/bed_tilt.py @@ -50,7 +50,7 @@ class BedTiltCalibrate: self.probe_helper.start_probe() def get_position(self): kin = self.printer.lookup_object('toolhead').get_kinematics() - return kin.get_position() + return kin.calc_position() def finalize(self, z_offset, positions): logging.info("Calculating bed_tilt with: %s", positions) params = { 'x_adjust': self.bedtilt.x_adjust, diff --git a/klippy/extras/z_tilt.py b/klippy/extras/z_tilt.py index df0a363e..df630241 100644 --- a/klippy/extras/z_tilt.py +++ b/klippy/extras/z_tilt.py @@ -46,7 +46,7 @@ class ZTilt: self.probe_helper.start_probe() def get_position(self): kin = self.printer.lookup_object('toolhead').get_kinematics() - return kin.get_position() + return kin.calc_position() def finalize(self, z_offset, positions): logging.info("Calculating bed tilt with: %s", positions) params = { 'x_adjust': 0., 'y_adjust': 0., 'z_adjust': z_offset } diff --git a/klippy/gcode.py b/klippy/gcode.py index 68997521..5e6bcecc 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -605,7 +605,7 @@ class GCodeParser: ["%s:%.6f" % (s.get_name(), s.get_commanded_position()) for s in steppers]) kinematic_pos = " ".join(["%s:%.6f" % (a, v) - for a, v in zip("XYZE", kin.get_position())]) + for a, v in zip("XYZE", kin.calc_position())]) toolhead_pos = " ".join(["%s:%.6f" % (a, v) for a, v in zip( "XYZE", self.toolhead.get_position())]) gcode_pos = " ".join(["%s:%.6f" % (a, v) diff --git a/klippy/homing.py b/klippy/homing.py index 77a8e379..0fc09cec 100644 --- a/klippy/homing.py +++ b/klippy/homing.py @@ -67,7 +67,7 @@ class Homing: error = "Failed to home %s: %s" % (name, str(e)) if probe_pos: self.set_homed_position( - list(self.toolhead.get_kinematics().get_position()) + [None]) + list(self.toolhead.get_kinematics().calc_position()) + [None]) else: self.toolhead.set_position(movepos) for mcu_endstop, name in endstops: