diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-06-05 14:43:16 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-06-05 18:05:45 -0400 |
commit | 38411fd2e7610eb8049645d4318bcec1f472218b (patch) | |
tree | 9dad586071cf44ffb7ce38cef1a9514ab6cfd157 | |
parent | b8094de129de17280f58d1042e6dcdd48f9eaef3 (diff) | |
download | kutter-38411fd2e7610eb8049645d4318bcec1f472218b.tar.gz kutter-38411fd2e7610eb8049645d4318bcec1f472218b.tar.xz kutter-38411fd2e7610eb8049645d4318bcec1f472218b.zip |
delta: Add support for specifying the angle each tower is at
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | config/example-delta.cfg | 4 | ||||
-rw-r--r-- | klippy/delta.py | 13 |
2 files changed, 11 insertions, 6 deletions
diff --git a/config/example-delta.cfg b/config/example-delta.cfg index f762d5a6..bde70cc6 100644 --- a/config/example-delta.cfg +++ b/config/example-delta.cfg @@ -18,6 +18,10 @@ step_distance: .01 endstop_pin: ^ar2 homing_speed: 50.0 position_endstop: 297.05 +#angle: +# This option specifies the angle (in degrees) that the tower is +# at. The default is 210 for stepper_a, 330 for stepper_b, and 90 +# for stepper_c. # The stepper_b section describes the stepper controlling the front # right tower (at 330 degrees). diff --git a/klippy/delta.py b/klippy/delta.py index 62074d7a..370b11e6 100644 --- a/klippy/delta.py +++ b/klippy/delta.py @@ -29,12 +29,13 @@ class DeltaKinematics: logging.info( "Delta max build height %.2fmm (radius tapered above %.2fmm)" % ( self.max_z, self.limit_z)) - sin = lambda angle: math.sin(math.radians(angle)) - cos = lambda angle: math.cos(math.radians(angle)) - self.towers = [ - (cos(210.)*radius, sin(210.)*radius), - (cos(330.)*radius, sin(330.)*radius), - (cos(90.)*radius, sin(90.)*radius)] + # Determine tower locations in cartesian space + angles = [config.getsection('stepper_a').getfloat('angle', 210.), + config.getsection('stepper_b').getfloat('angle', 330.), + config.getsection('stepper_c').getfloat('angle', 90.)] + self.towers = [(math.cos(math.radians(angle)) * radius, + math.sin(math.radians(angle)) * radius) + for angle in angles] # Find the point where an XY move could result in excessive # tower movement half_min_step_dist = min([s.step_dist for s in self.steppers]) * .5 |