-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
author Brandon Nance <[email protected]> 1704668106 -0500 committer Brandon Nance <[email protected]> 1704668106 -0500 parent 64fff4e author Brandon Nance <[email protected]> 1704668106 -0500 committer Brandon Nance <[email protected]> 1704668106 -0500 parent 64fff4e author Brandon Nance <[email protected]> 1704668106 -0500 committer Brandon Nance <[email protected]> 1704668106 -0500 add PolarXZ kinematics
- Loading branch information
Showing
20 changed files
with
2,591 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# This file is an example config file for polar style printers. One | ||
# may copy and edit this file to configure a new polar printer. | ||
|
||
# POLAR KINEMATICS ARE A WORK IN PROGRESS. Moves around the 0, 0 | ||
# position are known to not work properly. | ||
|
||
# See docs/Config_Reference.md for a description of parameters. | ||
|
||
[stepper_bed] | ||
step_pin: PF0 | ||
dir_pin: PF1 | ||
enable_pin: !PD7 | ||
microsteps: 16 | ||
gear_ratio: 80:16 | ||
|
||
[stepper_x] | ||
step_pin: PF6 | ||
dir_pin: PF7 | ||
enable_pin: !PF2 | ||
microsteps: 16 | ||
rotation_distance: 40 | ||
endstop_pin: ^PJ1 | ||
position_endstop: 300 | ||
position_max: 300 | ||
homing_speed: 50 | ||
|
||
[stepper_z] | ||
step_pin: PL3 | ||
dir_pin: PL1 | ||
enable_pin: !PK0 | ||
microsteps: 16 | ||
rotation_distance: 8 | ||
endstop_pin: ^PD3 | ||
position_endstop: 0.5 | ||
position_max: 200 | ||
|
||
[extruder] | ||
step_pin: PA4 | ||
dir_pin: PA6 | ||
enable_pin: !PA2 | ||
microsteps: 16 | ||
rotation_distance: 33.500 | ||
nozzle_diameter: 0.400 | ||
filament_diameter: 1.750 | ||
heater_pin: PB4 | ||
sensor_type: ATC Semitec 104GT-2 | ||
sensor_pin: PK5 | ||
control: pid | ||
pid_Kp: 22.2 | ||
pid_Ki: 1.08 | ||
pid_Kd: 114 | ||
min_temp: 0 | ||
max_temp: 250 | ||
|
||
[heater_bed] | ||
heater_pin: PH5 | ||
sensor_type: EPCOS 100K B57560G104F | ||
sensor_pin: PK6 | ||
control: watermark | ||
min_temp: 0 | ||
max_temp: 130 | ||
|
||
[fan] | ||
pin: PH6 | ||
|
||
[mcu] | ||
serial: /dev/ttyACM0 | ||
|
||
[printer] | ||
kinematics: polarxz | ||
max_velocity: 300 | ||
max_accel: 3000 | ||
max_z_velocity: 25 | ||
max_z_accel: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <math.h> // sqrt | ||
#include <stdlib.h> // malloc | ||
#include <string.h> // memset | ||
#include "compiler.h" // __visible | ||
#include "itersolve.h" // struct stepper_kinematics | ||
#include "trapq.h" // move_get_coord | ||
#include "pyhelper.h" // errorf | ||
|
||
static double | ||
polarbed_stepper_angle_calc_position(struct stepper_kinematics *sk, struct move *m, double move_time) | ||
|
||
{ | ||
struct coord c = move_get_coord(m, move_time); | ||
// XXX - handle x==y==0 | ||
if (c.x == 0 && c.y == 0) | ||
errorf("polarbed_stepper_angle_calc_position: x==y==0"); | ||
|
||
double angle = atan2(c.y, c.x); | ||
|
||
errorf("polarbed_stepper_angle_calc_position: x=%f y=%f angle=%f", c.x, c.y, angle * 180.0 / 3.14159); | ||
|
||
return angle; | ||
} | ||
|
||
struct stepper_kinematics *__visible | ||
polarbed_stepper_alloc(char type) | ||
{ | ||
struct stepper_kinematics *sk = malloc(sizeof(*sk)); | ||
memset(sk, 0, sizeof(*sk)); | ||
sk->calc_position_cb = polarbed_stepper_angle_calc_position; | ||
sk->active_flags = AF_X | AF_Y; | ||
|
||
return sk; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include <math.h> // sqrt | ||
#include <stdlib.h> // malloc | ||
#include <string.h> // memset | ||
#include "compiler.h" // __visible | ||
#include "itersolve.h" // struct stepper_kinematics | ||
#include "trapq.h" // move_get_coord | ||
|
||
static double | ||
polarxz_stepper_angle_calc_position(struct stepper_kinematics *sk, struct move *m, double move_time) | ||
{ | ||
struct coord c = move_get_coord(m, move_time); | ||
// XXX - handle x==y==0 | ||
if (c.x == 0 && c.y == 0) | ||
return 0; | ||
double angle = atan2(c.y, c.x); | ||
if (angle - sk->commanded_pos > M_PI) | ||
angle -= 2.f * M_PI; | ||
else if (angle - sk->commanded_pos < -M_PI) | ||
angle += 2.f * M_PI; | ||
angle = round(angle * 1000000) / 1000000; | ||
|
||
return angle; | ||
} | ||
|
||
static void | ||
polarxz_stepper_angle_post_fixup(struct stepper_kinematics *sk) | ||
{ | ||
// Normalize the stepper_bed angle | ||
if (sk->commanded_pos < -M_PI) | ||
sk->commanded_pos += 2 * M_PI; | ||
else if (sk->commanded_pos > M_PI) | ||
sk->commanded_pos -= 2 * M_PI; | ||
} | ||
|
||
static double | ||
polarxz_stepper_plus_calc_position(struct stepper_kinematics *sk, struct move *m, double move_time) | ||
{ | ||
struct coord c = move_get_coord(m, move_time); | ||
float pos = (sqrt(c.x * c.x + c.y * c.y)) + c.z; | ||
pos = round(pos * 1000000) / 1000000; | ||
return pos; | ||
} | ||
|
||
static double | ||
polarxz_stepper_minus_calc_position(struct stepper_kinematics *sk, struct move *m, double move_time) | ||
{ | ||
struct coord c = move_get_coord(m, move_time); | ||
float pos = (sqrt(c.x * c.x + c.y * c.y)) - c.z; | ||
pos = round(pos * 1000000) / 1000000; | ||
return pos; | ||
} | ||
|
||
struct stepper_kinematics *__visible | ||
polarxz_stepper_alloc(char type) | ||
{ | ||
struct stepper_kinematics *sk = malloc(sizeof(*sk)); | ||
memset(sk, 0, sizeof(*sk)); | ||
if (type == '+') | ||
{ | ||
sk->calc_position_cb = polarxz_stepper_plus_calc_position; | ||
sk->active_flags = AF_X | AF_Y | AF_Z; | ||
} | ||
else if (type == '-') | ||
{ | ||
sk->calc_position_cb = polarxz_stepper_minus_calc_position; | ||
sk->active_flags = AF_X | AF_Y | AF_Z; | ||
} | ||
else if (type == 'a') | ||
{ | ||
sk->calc_position_cb = polarxz_stepper_angle_calc_position; | ||
sk->post_cb = polarxz_stepper_angle_post_fixup; | ||
sk->active_flags = AF_X | AF_Y; | ||
} | ||
|
||
return sk; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.