mirror of
git://soft.sys114.com/klipper
synced 2026-02-11 08:50:25 +09:00
kinematics: Add deltesian printers (#5743)
Initial push of the working deltesian kinematics after some successful tests. Signed-off-by: Fabrice GALLET <tircown@gmail.com>
This commit is contained in:
@@ -20,8 +20,8 @@ SOURCE_FILES = [
|
||||
'pyhelper.c', 'serialqueue.c', 'stepcompress.c', 'itersolve.c', 'trapq.c',
|
||||
'pollreactor.c', 'msgblock.c', 'trdispatch.c',
|
||||
'kin_cartesian.c', 'kin_corexy.c', 'kin_corexz.c', 'kin_delta.c',
|
||||
'kin_polar.c', 'kin_rotary_delta.c', 'kin_winch.c', 'kin_extruder.c',
|
||||
'kin_shaper.c',
|
||||
'kin_deltesian.c', 'kin_polar.c', 'kin_rotary_delta.c', 'kin_winch.c',
|
||||
'kin_extruder.c', 'kin_shaper.c',
|
||||
]
|
||||
DEST_LIB = "c_helper.so"
|
||||
OTHER_FILES = [
|
||||
@@ -117,6 +117,11 @@ defs_kin_delta = """
|
||||
, double tower_x, double tower_y);
|
||||
"""
|
||||
|
||||
defs_kin_deltesian = """
|
||||
struct stepper_kinematics *deltesian_stepper_alloc(double arm2
|
||||
, double arm_x);
|
||||
"""
|
||||
|
||||
defs_kin_polar = """
|
||||
struct stepper_kinematics *polar_stepper_alloc(char type);
|
||||
"""
|
||||
@@ -205,8 +210,8 @@ defs_all = [
|
||||
defs_pyhelper, defs_serialqueue, defs_std, defs_stepcompress,
|
||||
defs_itersolve, defs_trapq, defs_trdispatch,
|
||||
defs_kin_cartesian, defs_kin_corexy, defs_kin_corexz, defs_kin_delta,
|
||||
defs_kin_polar, defs_kin_rotary_delta, defs_kin_winch, defs_kin_extruder,
|
||||
defs_kin_shaper,
|
||||
defs_kin_deltesian, defs_kin_polar, defs_kin_rotary_delta, defs_kin_winch,
|
||||
defs_kin_extruder, defs_kin_shaper,
|
||||
]
|
||||
|
||||
# Update filenames to an absolute path
|
||||
|
||||
41
klippy/chelper/kin_deltesian.c
Normal file
41
klippy/chelper/kin_deltesian.c
Normal file
@@ -0,0 +1,41 @@
|
||||
// Deltesian kinematics stepper pulse time generation
|
||||
//
|
||||
// Copyright (C) 2022 Fabrice Gallet <tircown@gmail.com>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
#include <math.h> // sqrt
|
||||
#include <stddef.h> // offsetof
|
||||
#include <stdlib.h> // malloc
|
||||
#include <string.h> // memset
|
||||
#include "compiler.h" // __visible
|
||||
#include "itersolve.h" // struct stepper_kinematics
|
||||
#include "trapq.h" // move_get_coord
|
||||
|
||||
struct deltesian_stepper {
|
||||
struct stepper_kinematics sk;
|
||||
double arm2, arm_x;
|
||||
};
|
||||
|
||||
static double
|
||||
deltesian_stepper_calc_position(struct stepper_kinematics *sk, struct move *m
|
||||
, double move_time)
|
||||
{
|
||||
struct deltesian_stepper *ds = container_of(
|
||||
sk, struct deltesian_stepper, sk);
|
||||
struct coord c = move_get_coord(m, move_time);
|
||||
double dx = c.x - ds->arm_x;
|
||||
return sqrt(ds->arm2 - dx*dx) + c.z;
|
||||
}
|
||||
|
||||
struct stepper_kinematics * __visible
|
||||
deltesian_stepper_alloc(double arm2, double arm_x)
|
||||
{
|
||||
struct deltesian_stepper *ds = malloc(sizeof(*ds));
|
||||
memset(ds, 0, sizeof(*ds));
|
||||
ds->arm2 = arm2;
|
||||
ds->arm_x = arm_x;
|
||||
ds->sk.calc_position_cb = deltesian_stepper_calc_position;
|
||||
ds->sk.active_flags = AF_X | AF_Z;
|
||||
return &ds->sk;
|
||||
}
|
||||
Reference in New Issue
Block a user