mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-09 14:55:09 -06:00
polar: Add initial support for multiple bed rotations
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
d9d94c858a
commit
e5f74a64ed
4 changed files with 59 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
// Polar kinematics stepper pulse time generation
|
||||
//
|
||||
// Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
|
||||
// Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
|
@ -24,8 +24,12 @@ polar_stepper_angle_calc_position(struct stepper_kinematics *sk, struct move *m
|
|||
{
|
||||
struct coord c = move_get_coord(m, move_time);
|
||||
// XXX - handle x==y==0
|
||||
// XXX - handle angle wrapping
|
||||
return atan2(c.y, c.x);
|
||||
double angle = atan2(c.y, c.x);
|
||||
if (angle - sk->commanded_pos > M_PI)
|
||||
angle -= 2. * M_PI;
|
||||
else if (angle - sk->commanded_pos < -M_PI)
|
||||
angle += 2. * M_PI;
|
||||
return angle;
|
||||
}
|
||||
|
||||
struct stepper_kinematics * __visible
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Code for handling the kinematics of polar robots
|
||||
#
|
||||
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
|
||||
# Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import logging, math
|
||||
|
@ -122,8 +122,15 @@ class PolarKinematics:
|
|||
axes_d = move.axes_d
|
||||
cmove = move.cmove
|
||||
if axes_d[0] or axes_d[1]:
|
||||
self.steppers[0].step_itersolve(cmove)
|
||||
self.rails[0].step_itersolve(cmove)
|
||||
stepper_bed = self.steppers[0]
|
||||
stepper_bed.step_itersolve(cmove)
|
||||
# Normalize the stepper_bed angle
|
||||
angle = stepper_bed.get_commanded_position()
|
||||
if angle < -math.pi:
|
||||
stepper_bed.set_commanded_position(angle + 2. * math.pi)
|
||||
elif angle > math.pi:
|
||||
stepper_bed.set_commanded_position(angle - 2. * math.pi)
|
||||
if axes_d[2]:
|
||||
self.rails[1].step_itersolve(cmove)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue