Skip to content

Commit

Permalink
toolhead: cornering without limited acceleration
Browse files Browse the repository at this point in the history
Credits to @richfelker
  • Loading branch information
Piezoid committed Jun 2, 2023
1 parent dc87709 commit 76ba4be
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions klippy/toolhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, toolhead, start_pos, end_pos, speed):
self.start_pos = tuple(start_pos)
self.end_pos = tuple(end_pos)
self.accel = toolhead.max_accel
self.junction_deviation = toolhead.junction_deviation
self.equilateral_corner_v2 = toolhead.equilateral_corner_v2
self.timing_callbacks = []
velocity = min(speed, toolhead.max_velocity)
self.is_kinematic_move = True
Expand Down Expand Up @@ -82,8 +82,8 @@ def calc_junction(self, prev_move):
* prev_move.accel)
# Apply limits
self.max_start_v2 = min(
R_jd * self.junction_deviation * self.accel,
R_jd * prev_move.junction_deviation * prev_move.accel,
R_jd * self.equilateral_corner_v2,
R_jd * prev_move.equilateral_corner_v2,
move_centripetal_v2, prev_move_centripetal_v2,
extruder_v2, self.max_cruise_v2, prev_move.max_cruise_v2,
prev_move.max_start_v2 + prev_move.delta_v2)
Expand Down Expand Up @@ -218,7 +218,7 @@ def __init__(self, config):
self.max_accel_to_decel = self.requested_accel_to_decel
self.square_corner_velocity = config.getfloat(
'square_corner_velocity', 5., minval=0.)
self.junction_deviation = 0.
self.equilateral_corner_v2 = 0.
self._calc_junction_deviation()
# Print time tracking
self.buffer_time_low = config.getfloat(
Expand Down Expand Up @@ -547,7 +547,7 @@ def get_max_velocity(self):
return self.max_velocity, self.max_accel
def _calc_junction_deviation(self):
scv2 = self.square_corner_velocity**2
self.junction_deviation = scv2 * (math.sqrt(2.) - 1.) / self.max_accel
self.equilateral_corner_v2 = scv2 * (math.sqrt(2.) - 1.)
self.max_accel_to_decel = min(self.requested_accel_to_decel,
self.max_accel)
def cmd_G4(self, gcmd):
Expand Down

1 comment on commit 76ba4be

@MaxyMeanderings
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Piezoid I'm getting an error message when I implement this change in the toolhead.py.
Klipper reports: ERROR

Internal error during connect: 'void(*)(struct trapq *, double, double)' expects 3 arguments, got 2
Someone on the Klipper Forums was also having this same issue.
Any feedback on how to fix it?

Please sign in to comment.