mirror of
https://github.com/andreili/klipper.git
synced 2025-08-24 03:44:06 +02:00
manual_stepper: Support INSTANTANEOUS_CORNER_VELOCITY on gcode axes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
7201f41664
commit
64e01f03a2
@ -968,17 +968,20 @@ scheduled to run after the stepper move completes, however if a manual
|
|||||||
stepper move uses SYNC=0 then future G-Code movement commands may run
|
stepper move uses SYNC=0 then future G-Code movement commands may run
|
||||||
in parallel with the stepper movement.
|
in parallel with the stepper movement.
|
||||||
|
|
||||||
`MANUAL_STEPPER STEPPER=config_name GCODE_AXIS=[A-Z]`: If the
|
`MANUAL_STEPPER STEPPER=config_name GCODE_AXIS=[A-Z]
|
||||||
`GCODE_AXIS` parameter is specified then it configures the stepper
|
[INSTANTANEOUS_CORNER_VELOCITY=<velocity>]`: If the `GCODE_AXIS`
|
||||||
motor as an extra axis on `G1` move commands. For example, if one
|
parameter is specified then it configures the stepper motor as an
|
||||||
were to issue a `MANUAL_STEPPER ... GCODE_AXIS=R` command then one
|
extra axis on `G1` move commands. For example, if one were to issue a
|
||||||
could issue commands like `G1 X10 Y20 R30` to move the stepper motor.
|
`MANUAL_STEPPER ... GCODE_AXIS=R` command then one could issue
|
||||||
The resulting moves will occur synchronously with the associated
|
commands like `G1 X10 Y20 R30` to move the stepper motor. The
|
||||||
toolhead xyz movements. If the motor is associated with a
|
resulting moves will occur synchronously with the associated toolhead
|
||||||
`GCODE_AXIS` then one may no longer issue movements using the above
|
xyz movements. If the motor is associated with a `GCODE_AXIS` then
|
||||||
`MANUAL_STEPPER` command - one may unregister the stepper with a
|
one may no longer issue movements using the above `MANUAL_STEPPER`
|
||||||
`MANUAL_STEPPER ... GCODE_AXIS=` command to resume manual control of
|
command - one may unregister the stepper with a `MANUAL_STEPPER
|
||||||
the motor.
|
... GCODE_AXIS=` command to resume manual control of the motor. The
|
||||||
|
`INSTANTANEOUS_CORNER_VELOCITY` specifies the maximum instantaneous
|
||||||
|
velocity change (in mm/s) of the motor during the junction of two
|
||||||
|
moves (the default is 1mm/s).
|
||||||
|
|
||||||
### [mcp4018]
|
### [mcp4018]
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ class ManualStepper:
|
|||||||
self.rail.set_trapq(self.trapq)
|
self.rail.set_trapq(self.trapq)
|
||||||
# Registered with toolhead as an axtra axis
|
# Registered with toolhead as an axtra axis
|
||||||
self.axis_gcode_id = None
|
self.axis_gcode_id = None
|
||||||
|
self.instant_corner_v = 0.
|
||||||
# Register commands
|
# Register commands
|
||||||
stepper_name = config.get_name().split()[1]
|
stepper_name = config.get_name().split()[1]
|
||||||
gcode = self.printer.lookup_object('gcode')
|
gcode = self.printer.lookup_object('gcode')
|
||||||
@ -119,6 +120,8 @@ class ManualStepper:
|
|||||||
gcode_move = self.printer.lookup_object("gcode_move")
|
gcode_move = self.printer.lookup_object("gcode_move")
|
||||||
toolhead = self.printer.lookup_object('toolhead')
|
toolhead = self.printer.lookup_object('toolhead')
|
||||||
gcode_axis = gcmd.get('GCODE_AXIS').upper()
|
gcode_axis = gcmd.get('GCODE_AXIS').upper()
|
||||||
|
instant_corner_v = gcmd.get_float('INSTANTANEOUS_CORNER_VELOCITY', 1.,
|
||||||
|
minval=0.)
|
||||||
if self.axis_gcode_id is not None:
|
if self.axis_gcode_id is not None:
|
||||||
if gcode_axis:
|
if gcode_axis:
|
||||||
raise gcmd.error("Must unregister axis first")
|
raise gcmd.error("Must unregister axis first")
|
||||||
@ -137,6 +140,7 @@ class ManualStepper:
|
|||||||
if ea is not None and ea.get_axis_gcode_id() == gcode_axis:
|
if ea is not None and ea.get_axis_gcode_id() == gcode_axis:
|
||||||
raise gcmd.error("Axis '%s' already registered" % (gcode_axis,))
|
raise gcmd.error("Axis '%s' already registered" % (gcode_axis,))
|
||||||
self.axis_gcode_id = gcode_axis
|
self.axis_gcode_id = gcode_axis
|
||||||
|
self.instant_corner_v = instant_corner_v
|
||||||
toolhead.add_extra_axis(self, self.get_position()[0])
|
toolhead.add_extra_axis(self, self.get_position()[0])
|
||||||
toolhead.register_step_generator(self.rail.generate_steps)
|
toolhead.register_step_generator(self.rail.generate_steps)
|
||||||
def process_move(self, print_time, move, ea_index):
|
def process_move(self, print_time, move, ea_index):
|
||||||
@ -156,7 +160,9 @@ class ManualStepper:
|
|||||||
# XXX - support non-kinematic max accel/velocity
|
# XXX - support non-kinematic max accel/velocity
|
||||||
pass
|
pass
|
||||||
def calc_junction(self, prev_move, move, ea_index):
|
def calc_junction(self, prev_move, move, ea_index):
|
||||||
# XXX - support max instantaneous velocity change
|
diff_r = move.axes_r[ea_index] - prev_move.axes_r[ea_index]
|
||||||
|
if diff_r:
|
||||||
|
return (self.instant_corner_v / abs(diff_r))**2
|
||||||
return move.max_cruise_v2
|
return move.max_cruise_v2
|
||||||
def get_axis_gcode_id(self):
|
def get_axis_gcode_id(self):
|
||||||
return self.axis_gcode_id
|
return self.axis_gcode_id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user