Skip to content

Commit

Permalink
generic_cartesian: Fixed typos in docs, minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
  • Loading branch information
dmbutyugin committed Feb 4, 2025
1 parent 4d83c2a commit 46571cf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
24 changes: 12 additions & 12 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The printer section controls high level printer settings.
[printer]
kinematics:
# The type of printer in use. This option may be one of: cartesian,
# corexy, corexz, hybrid_corexy, hybrid_corexz, generic_cartesia,
# corexy, corexz, hybrid_corexy, hybrid_corexz, generic_cartesian,
# rotary_delta, delta, deltesian, polar, winch, or none.
# This parameter must be specified.
max_velocity:
Expand Down Expand Up @@ -716,22 +716,22 @@ anchor_z:
### Generic Cartesian Kinematics

See [example-generic-cartesian.cfg](../config/example-generic-caretesian.cfg)
for an example generic caretesian kinematics config file.
for an example generic Cartesian kinematics config file.

This new kinematic class allows a user to define in a pretty flexible
This printer kinematic class allows a user to define in a pretty flexible
manner an arbitrary Cartesian-style kinematics. In principle, the regular
cartesian, corexy, hybrid_corexy can be defined this way too. However,
more importantly, various otherwise unsupported kinematics such as
inverted hybrid_corexy or corexyuv can be defined using this kinematic.

Notably, the declaration of a generic Cartesian kinematic deviates
significantly from the definition of other kinematc types. It follows
the following convention: a user defines a set of carriages with certain
range of motion that can move independently (they should move over the
Notably, the definition of a generic Cartesian kinematic deviates
significantly from the other kinematic types. It follows the following
convention: a user defines a set of carriages with certain range of motion
that can move independently from each other (they should move over the
Cartesian axes X, Y, and Z, hence the name of the kinematic) and
corresponding endstops that allow the firmware to determine the position
of carriages during homing, as well as a set of steppers that can move
these carriages. The `[printer]` section must specify the kinematic and
of carriages during homing, as well as a set of steppers that move those
carriages. The `[printer]` section must specify the kinematic and
other printer-level settings same as the regular Cartesian kinematic:
```
[printer]
Expand Down Expand Up @@ -807,7 +807,7 @@ affects the motion of the carriages. For example, `x+y` indicates that
the motion of the stepper in the positive direction by the distance `d`
moves the carriages `x` and `y` by the same distance `d` in the positive
direction, while `x-0.5*y` means the motion of the stepper in the positive
direction by the distance `d` moves the carraige `x` by the distance `d`
direction by the distance `d` moves the carriage `x` by the distance `d`
in the positive direction, but the carriage `y` will travel distance `d/2`
in the negative direction.

Expand Down Expand Up @@ -2394,7 +2394,7 @@ axis:
# error. If safe_distance is not provided, it will be inferred from
# position_min and position_max for the dual and primary carriages. If set
# to 0 (or safe_distance is unset and position_min and position_max are
# identical for the primary and dual carraiges), the carriages proximity
# identical for the primary and dual carriages), the carriages proximity
# checks will be disabled.
#step_pin:
#dir_pin:
Expand Down Expand Up @@ -2426,7 +2426,7 @@ primary_carriage:
# error. If safe_distance is not provided, it will be inferred from
# position_min and position_max for the dual and primary carriages. If set
# to 0 (or safe_distance is unset and position_min and position_max are
# identical for the primary and dual carraiges), the carriages proximity
# identical for the primary and dual carriages), the carriages proximity
# checks will be disabled.
endstop_pin:
#position_min:
Expand Down
12 changes: 6 additions & 6 deletions docs/G-Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ modes are supported only for `CARRIAGE=1`. When set to either of these
modes, carriage 1 will then track the subsequent moves of the carriage 0
and either copy relative movements of it (in `COPY` mode) or execute them
in the opposite (mirror) direction (in `MIRROR` mode). `AXIS` parameter is
supported if a user defined two dual carriages with `generic_cartesian`
kinematic. It can be omitted if the `MODE` is `PRIMARY`, in which case
the command changes the mode for both axes, but it must be provided for
`COPY` and `MIRROR` mode.
supported only if a user defined two dual carriages with `generic_cartesian`
kinematic. In this case `AXIS` parameter can be omitted if `MODE` is `PRIMARY`,
effectively changing the mode for both axes, but it must be specified for
`COPY` and `MIRROR` modes.

#### SAVE_DUAL_CARRIAGE_STATE
`SAVE_DUAL_CARRIAGE_STATE [NAME=<state_name>]`: Save the current positions
Expand Down Expand Up @@ -710,8 +710,8 @@ without any further delimiters, e.g. `0.5x+0.5z` or
`0.333333333333x-0.666666666667y`.

`SET_STEPPER_KINEMATICS` is an advanced tool, and the user is advised
to excercise an extreme caution using, since specifying incorrect
configuration may result in a physical damage to the printer.
to exercise an extreme caution using it, since specifying incorrect
configuration may physically damage the printer.

Note that `SET_STEPPER_KINEMATICS` performs certain internal validations
of the new printer kinematics after the change. Keep in mind that if it
Expand Down
1 change: 0 additions & 1 deletion klippy/extras/kinematic_stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def __init__(self, config, carriages):
raise config.error(
"'%s' must provide a valid 'kinematics' configuration" %
self.stepper.get_name())
# TODO: Add shortcuts for some typical optimized kinematics
self.stepper.setup_itersolve(
'generic_cartesian_stepper_alloc',
self.kin_coeffs[0], self.kin_coeffs[1], self.kin_coeffs[2])
Expand Down
4 changes: 2 additions & 2 deletions klippy/kinematics/generic_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def mat_eigen(mtm):
x2 = -(2. * a - b - c) * (2. * b - a - c) * (2. * c - a - b) \
+ 9. * ((2. * c - a - b) * d**2 + (2. * b - a - c) * f**2 \
+ (2. * a - b - c) * e**2) - 54. * d * e * f
phi = math.atan2(math.sqrt(4. * x1**3 - x2**2), x2)
sqrt_x1 = math.sqrt(x1)
phi = math.atan2(math.sqrt(max(4. * x1**3 - x2**2, 0.)), x2)
sqrt_x1 = math.sqrt(max(x1, 0.))
# Closed-form expressions for eigenvalues of a symmetric matrix
l = [li / 3. if abs(li) > 1e-8 else 0. for li in
[a + b + c - 2. * sqrt_x1 * math.cos(phi / 3.),
Expand Down

0 comments on commit 46571cf

Please sign in to comment.