delta: Rename get_position() to calc_position()

Calculating the cartesian position from the stepper positions can be
complex and cpu intensive, so rename it to calc_position() to be more
descriptive.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-06-22 12:27:37 -04:00
parent 20b404ecf5
commit 0216201cb6
8 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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,

View File

@ -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 }

View File

@ -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)

View File

@ -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: