Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

323 development of rotary delta kinematics for esp32fr #331

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
38fc620
Linear delta renaming and initial delta robot code
Paciente8159 Nov 1, 2022
72a2898
added delta settings to protocol
Paciente8159 Nov 1, 2022
22d23ba
fixed delta kinematics
Paciente8159 Nov 6, 2022
4eed0d1
Merge branch 'master' into 323-development-of-rotary-delta-kinematics…
Paciente8159 Nov 7, 2022
be5796a
Merge branch 'master' into 323-development-of-rotary-delta-kinematics…
Paciente8159 Nov 7, 2022
c8a2fc9
calculate delta motion limits
Paciente8159 Nov 7, 2022
bbb41fa
Added homing angle for delta robot
Paciente8159 Nov 8, 2022
39cb61d
added z homing offset to origin
Paciente8159 Nov 8, 2022
c332ab5
updated coordinate system to delta homing z offset
Paciente8159 Nov 8, 2022
e417118
fixed compilation warnings
Paciente8159 Nov 8, 2022
dd3e073
modified homing according to Z axis max distances
Paciente8159 Nov 9, 2022
8e8f53b
modified motion control feed calculations
Paciente8159 Nov 9, 2022
839632c
delta kinematics homing fixed
Paciente8159 Nov 9, 2022
e348b8d
feed conversion factor to non linear kinematics
Paciente8159 Nov 10, 2022
5699427
Update cnc_config.h
Paciente8159 Nov 10, 2022
b64cf8d
Merge pull request #329 from Paciente8159/modified-feed-calculations
Paciente8159 Nov 10, 2022
8e0872e
fixed compilation errors
Paciente8159 Nov 10, 2022
56d2f4a
optimized motion core
Paciente8159 Nov 10, 2022
3411c8c
fixed feed calculations
Paciente8159 Nov 10, 2022
fd17c68
fixed acceleration and itp with s-curve
Paciente8159 Nov 10, 2022
b09fe46
code cleanup and compilation fixes
Paciente8159 Nov 10, 2022
70e219a
code cleanup
Paciente8159 Nov 10, 2022
1dfbbc4
fixed sub segmentation
Paciente8159 Nov 10, 2022
30d8b3a
Merge pull request #330 from Paciente8159/optimize-motion-core
Paciente8159 Nov 10, 2022
7e2a30e
delta SET_ORIGIN_AT_HOME_POS compliant
Paciente8159 Nov 11, 2022
3b1b8af
adjust rapid feed to laser PPI settings
Paciente8159 Nov 11, 2022
9e39016
Update README.md
Paciente8159 Nov 11, 2022
af0fbba
optimized LASER_PPI calcs in parsing
Paciente8159 Nov 23, 2022
7326986
Update README.md
Paciente8159 Nov 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ NOTES:

µCNC with a configuration similar to Grbl is be able to keep up to 30KHz step rate for a 3 axis machine on an Arduino Uno at 16Mhz. (the stated rate depends on the length of the segments too, since many short length segments don't allow full speed to be achieved). For this specific type of use (like in laser engraving) a 16-bit version of stepping algorithm is possible pushing the theoretical step rate limit to 40KHz on a single UNO board.

### Current µCNC supported hardware
### µCNC current supported hardware

µCNC initial development was done both around Arduino UNO board just like GRBL. But µCNC can also be installed in other AVR boards like Arduino Mega (for Ramps), or similar boards (like Rambo). Other MCU's have and will be integrated in µCNC:

Expand All @@ -173,6 +173,16 @@ It can run on:
- NXP LPC1768 - v1.5.x (eeprom emulation and analog still being developed)
- Windows PC (used for simulation/debugging only - ISR on Windows doesn't allow to use it as a real alternative)

### µCNC current supported kinematics

µCNC is designed to be support both linear and non-linear kinematics and can be extended to support other types of kinematics.
Currently µCNC supports the following kinematics:

- Cartesian
- CoreXY
- Linear delta robot
- Rotary delta robot

### µCNC roadmap

A couple of changes were introduced with version 1.2.0 of µCNC to prepare for future and easier expansions.
Expand Down
28 changes: 24 additions & 4 deletions makefiles/virtual/uCNC.dev
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=1
CompilerSettings=000000e0a0000000001000000
UnitCount=70
UnitCount=73

[VersionInfo]
Major=1
Expand Down Expand Up @@ -511,7 +511,7 @@ OverrideBuildCmd=0
BuildCmd=

[Unit47]
FileName=..\..\uCNC\src\hal\kinematics\kinematic_delta.c
FileName=..\..\uCNC\src\hal\kinematics\kinematic_linear_delta.c
CompileCpp=0
Folder=
Compile=1
Expand Down Expand Up @@ -571,7 +571,7 @@ OverrideBuildCmd=0
BuildCmd=

[Unit48]
FileName=..\..\uCNC\src\hal\kinematics\kinematic_delta.h
FileName=..\..\uCNC\src\hal\kinematics\kinematic_linear_delta.h
CompileCpp=0
Folder=
Compile=1
Expand Down Expand Up @@ -751,7 +751,27 @@ OverrideBuildCmd=0
BuildCmd=

[Unit71]
FileName=..\..\uCNC\src\hal\tools\tools\laser_ppi.c
FileName=..\..\uCNC\src\hal\kinematics\kinematic_delta.c
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

[Unit72]
FileName=..\..\uCNC\src\hal\kinematics\kinematic_delta.h
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

[Unit73]
FileName=..\..\uCNC\src\utils.h
CompileCpp=0
Folder=
Compile=1
Expand Down
2 changes: 1 addition & 1 deletion uCNC/src/cnc_hal_config_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ typedef uint16_t step_t;
#endif
#endif

#if (KINEMATIC == KINEMATIC_DELTA)
#if (defined(KINEMATICS_MOTION_BY_SEGMENTS))
#ifdef ENABLE_DUAL_DRIVE_AXIS
#error "Delta does not support dual drive axis"
#endif
Expand Down
66 changes: 25 additions & 41 deletions uCNC/src/core/interpolator.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static uint8_t prev_dss;
static int16_t prev_spindle;
// pointer to the segment being executed
static itp_segment_t *itp_rt_sgm;
#if (defined(ENABLE_DUAL_DRIVE_AXIS) || (KINEMATIC == KINEMATIC_DELTA))
#if (defined(ENABLE_DUAL_DRIVE_AXIS) || defined(IS_DELTA_KINEMATICS))
static volatile uint8_t itp_step_lock;
#endif

Expand Down Expand Up @@ -218,7 +218,7 @@ void itp_init(void)
memset(itp_blk_data, 0, sizeof(itp_blk_data));
memset(itp_sgm_data, 0, sizeof(itp_sgm_data));
itp_rt_sgm = NULL;
#if (defined(ENABLE_DUAL_DRIVE_AXIS) || (KINEMATIC == KINEMATIC_DELTA))
#if (defined(ENABLE_DUAL_DRIVE_AXIS) || defined(IS_DELTA_KINEMATICS))
itp_step_lock = 0;
#endif
#endif
Expand Down Expand Up @@ -280,7 +280,7 @@ void itp_run(void)

// overwrites previous values
#ifdef ENABLE_BACKLASH_COMPENSATION
itp_blk_data[itp_blk_data_write].backlash_comp = itp_cur_plan_block->backlash_comp;
itp_blk_data[itp_blk_data_write].backlash_comp = itp_cur_plan_block->planner_flags.bit.backlash_comp;
#endif

itp_blk_data[itp_blk_data_write].dirbits = itp_cur_plan_block->dirbits;
Expand All @@ -292,11 +292,10 @@ void itp_run(void)
itp_blk_data[itp_blk_data_write].dirbits |= CHECKFLAG(itp_blk_data[itp_blk_data_write].dirbits, STEP_DUAL1) ? STEP_DUAL1_MASK : 0;
#endif
#endif
itp_blk_data[itp_blk_data_write].total_steps = itp_cur_plan_block->total_steps << 1;
step_t total_steps = itp_cur_plan_block->steps[itp_cur_plan_block->main_stepper];
itp_blk_data[itp_blk_data_write].total_steps = total_steps << 1;

float total_step_inv = 1.0f / (float)itp_cur_plan_block->total_steps;
feed_convert = 60.f / (float)g_settings.step_per_mm[itp_cur_plan_block->main_stepper];
float sqr_step_speed = 0;
feed_convert = itp_cur_plan_block->feed_conversion;

#ifdef STEP_ISR_SKIP_IDLE
itp_blk_data[itp_blk_data_write].idle_axis = 0;
Expand All @@ -306,8 +305,7 @@ void itp_run(void)
#endif
for (uint8_t i = 0; i < STEPPER_COUNT; i++)
{
sqr_step_speed += fast_flt_pow2((float)itp_cur_plan_block->steps[i]);
itp_blk_data[itp_blk_data_write].errors[i] = itp_cur_plan_block->total_steps;
itp_blk_data[itp_blk_data_write].errors[i] = total_steps;
itp_blk_data[itp_blk_data_write].steps[i] = itp_cur_plan_block->steps[i] << 1;
#ifdef STEP_ISR_SKIP_IDLE
if (!itp_cur_plan_block->steps[i])
Expand All @@ -317,14 +315,11 @@ void itp_run(void)
#endif
}

sqr_step_speed *= fast_flt_pow2(total_step_inv);
feed_convert *= fast_flt_sqrt(sqr_step_speed);

// flags block for recalculation of speeds
itp_needs_update = true;
}

uint32_t remaining_steps = itp_cur_plan_block->total_steps;
uint32_t remaining_steps = itp_cur_plan_block->steps[itp_cur_plan_block->main_stepper];

sgm = &itp_sgm_data[itp_sgm_data_write];

Expand Down Expand Up @@ -509,7 +504,7 @@ void itp_run(void)
}

// computes how many steps it will perform at this speed and frame window
segm_steps = (uint16_t)roundf(partial_distance);
segm_steps = (uint16_t)lroundf(partial_distance);
} while (segm_steps == 0);

avg_speed = fast_flt_div2(current_speed + initial_speed);
Expand Down Expand Up @@ -620,9 +615,9 @@ void itp_run(void)
}

itp_cur_plan_block->entry_feed_sqr = fast_flt_pow2(current_speed);
itp_cur_plan_block->total_steps = remaining_steps;
itp_cur_plan_block->steps[itp_cur_plan_block->main_stepper] = remaining_steps;

if (itp_cur_plan_block->total_steps == 0)
if (remaining_steps == 0)
{
itp_blk_buffer_write();
itp_cur_plan_block = NULL;
Expand Down Expand Up @@ -694,7 +689,7 @@ void itp_run(void)

// overwrites previous values
#ifdef ENABLE_BACKLASH_COMPENSATION
itp_blk_data[itp_blk_data_write].backlash_comp = itp_cur_plan_block->flags_u.flags_t.backlash_comp;
itp_blk_data[itp_blk_data_write].backlash_comp = itp_cur_plan_block->planner_flags.bit.backlash_comp;
#endif
itp_blk_data[itp_blk_data_write].dirbits = itp_cur_plan_block->dirbits;
#ifdef ENABLE_DUAL_DRIVE_AXIS
Expand All @@ -705,11 +700,10 @@ void itp_run(void)
itp_blk_data[itp_blk_data_write].dirbits |= CHECKFLAG(itp_blk_data[itp_blk_data_write].dirbits, STEP_DUAL1) ? STEP_DUAL1_MASK : 0;
#endif
#endif
itp_blk_data[itp_blk_data_write].total_steps = itp_cur_plan_block->total_steps << 1;
step_t total_steps = itp_cur_plan_block->steps[itp_cur_plan_block->main_stepper];
itp_blk_data[itp_blk_data_write].total_steps = total_steps << 1;

float total_step_inv = 1.0f / (float)itp_cur_plan_block->total_steps;
feed_convert = 60.f / (float)g_settings.step_per_mm[itp_cur_plan_block->main_stepper];
float sqr_step_speed = 0;
feed_convert = itp_cur_plan_block->feed_conversion;

#ifdef STEP_ISR_SKIP_IDLE
itp_blk_data[itp_blk_data_write].idle_axis = 0;
Expand All @@ -719,12 +713,7 @@ void itp_run(void)
#endif
for (uint8_t i = 0; i < STEPPER_COUNT; i++)
{
#ifdef ENABLE_LASER_PPI
sqr_step_speed += (i != (STEPPER_COUNT - 1)) ? (fast_flt_pow2((float)itp_cur_plan_block->steps[i])) : 0;
#else
sqr_step_speed += fast_flt_pow2((float)itp_cur_plan_block->steps[i]);
#endif
itp_blk_data[itp_blk_data_write].errors[i] = itp_cur_plan_block->total_steps;
itp_blk_data[itp_blk_data_write].errors[i] = total_steps;
itp_blk_data[itp_blk_data_write].steps[i] = itp_cur_plan_block->steps[i] << 1;
#ifdef STEP_ISR_SKIP_IDLE
if (!itp_cur_plan_block->steps[i])
Expand All @@ -734,9 +723,6 @@ void itp_run(void)
#endif
}

sqr_step_speed *= fast_flt_pow2(total_step_inv);
feed_convert *= fast_flt_sqrt(sqr_step_speed);

// flags block for recalculation of speeds
itp_needs_update = true;
// in every new block speed update is needed
Expand All @@ -746,7 +732,7 @@ void itp_run(void)
half_speed_change = fast_flt_div2(half_speed_change);
}

uint32_t remaining_steps = itp_cur_plan_block->total_steps;
uint32_t remaining_steps = itp_cur_plan_block->steps[itp_cur_plan_block->main_stepper];

sgm = &itp_sgm_data[itp_sgm_data_write];

Expand Down Expand Up @@ -969,9 +955,9 @@ void itp_run(void)
itp_cur_plan_block->entry_feed_sqr = junction_speed_sqr;
}

itp_cur_plan_block->total_steps = remaining_steps;
itp_cur_plan_block->steps[itp_cur_plan_block->main_stepper] = remaining_steps;

if (itp_cur_plan_block->total_steps == 0)
if (remaining_steps == 0)
{
itp_blk_buffer_write();
itp_cur_plan_block = NULL;
Expand Down Expand Up @@ -1078,16 +1064,14 @@ int32_t itp_get_rt_position_index(int8_t index)

void itp_reset_rt_position(float *origin)
{
if (g_settings.homing_enabled)
{
kinematics_apply_inverse(origin, itp_rt_step_pos);
}
else
if (!g_settings.homing_enabled)
{
memset(itp_rt_step_pos, 0, sizeof(itp_rt_step_pos));
memset(origin, 0, (sizeof(float) * AXIS_COUNT));
}

// sync origin and steppers position
kinematics_apply_inverse(origin, itp_rt_step_pos);

#if STEPPERS_ENCODERS_MASK != 0
encoders_itp_reset_rt_position(origin);
#endif
Expand Down Expand Up @@ -1136,7 +1120,7 @@ void itp_sync_spindle(void)
#endif
}

#if (defined(ENABLE_DUAL_DRIVE_AXIS) || (KINEMATIC == KINEMATIC_DELTA))
#if (defined(ENABLE_DUAL_DRIVE_AXIS) || defined(IS_DELTA_KINEMATICS))
void itp_lock_stepper(uint8_t lockmask)
{
itp_step_lock = lockmask;
Expand Down Expand Up @@ -1619,7 +1603,7 @@ MCU_CALLBACK void mcu_step_cb(void)
mcu_disable_global_isr(); // lock isr before clearin busy flag
itp_busy = false;

#if (defined(ENABLE_DUAL_DRIVE_AXIS) || (KINEMATIC == KINEMATIC_DELTA))
#if (defined(ENABLE_DUAL_DRIVE_AXIS) || defined(IS_DELTA_KINEMATICS))
stepbits &= ~itp_step_lock;
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion uCNC/src/core/interpolator.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern "C"
float itp_get_rt_feed(void);
uint8_t itp_sync(void);
void itp_sync_spindle(void);
#if (defined(ENABLE_DUAL_DRIVE_AXIS) || (KINEMATIC == KINEMATIC_DELTA))
#if (defined(ENABLE_DUAL_DRIVE_AXIS) || defined(KINEMATICS_MOTION_BY_SEGMENTS))
void itp_lock_stepper(uint8_t lockmask);
#endif
#ifdef GCODE_PROCESS_LINE_NUMBERS
Expand Down
6 changes: 3 additions & 3 deletions uCNC/src/core/io_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ MCU_IO_CALLBACK void mcu_limits_changed_cb(void)
#endif
if (limit_combined)
{
#if (defined(DUAL_DRIVE0_ENABLE_SELFSQUARING) || defined(DUAL_DRIVE1_ENABLE_SELFSQUARING) || (KINEMATIC == KINEMATIC_DELTA))
#if (defined(DUAL_DRIVE0_ENABLE_SELFSQUARING) || defined(DUAL_DRIVE1_ENABLE_SELFSQUARING) || defined(IS_DELTA_KINEMATICS))
if (cnc_get_exec_state((EXEC_RUN | EXEC_HOMING)) == (EXEC_RUN | EXEC_HOMING) && (io_lock_limits_mask & limit_combined))
{
// if homing and dual drive axis are enabled
Expand All @@ -137,7 +137,7 @@ MCU_IO_CALLBACK void mcu_limits_changed_cb(void)
}
}
#endif
#if (KINEMATIC == KINEMATIC_DELTA)
#if (defined(IS_DELTA_KINEMATICS))
if ((limit_combined & LIMITS_DELTA_MASK))
{
if (limit_combined != LIMITS_DELTA_MASK)
Expand All @@ -154,7 +154,7 @@ MCU_IO_CALLBACK void mcu_limits_changed_cb(void)
}
#endif

#if (defined(DUAL_DRIVE0_ENABLE_SELFSQUARING) || defined(DUAL_DRIVE1_ENABLE_SELFSQUARING) || (KINEMATIC == KINEMATIC_DELTA))
#if (defined(DUAL_DRIVE0_ENABLE_SELFSQUARING) || defined(DUAL_DRIVE1_ENABLE_SELFSQUARING) || defined(IS_DELTA_KINEMATICS))
itp_lock_stepper(0); // unlocks axis
#endif
itp_stop();
Expand Down
Loading