|
|
@ -33,10 +33,7 @@ |
|
|
|
#include "planner.h" |
|
|
|
|
|
|
|
#if ENABLED(AXEL_TPARA) |
|
|
|
// For homing, as in delta
|
|
|
|
#include "planner.h" |
|
|
|
#include "endstops.h" |
|
|
|
#include "../lcd/marlinui.h" |
|
|
|
#include "../MarlinCore.h" |
|
|
|
#endif |
|
|
|
|
|
|
@ -46,30 +43,35 @@ void scara_set_axis_is_at_home(const AxisEnum axis) { |
|
|
|
if (axis == Z_AXIS) |
|
|
|
current_position.z = Z_HOME_POS; |
|
|
|
else { |
|
|
|
xyz_pos_t homeposition; |
|
|
|
LOOP_XYZ(i) homeposition[i] = base_home_pos((AxisEnum)i); |
|
|
|
#if ENABLED(MORGAN_SCARA) |
|
|
|
// MORGAN_SCARA uses arm angles for AB home position
|
|
|
|
ab_float_t homeposition = { SCARA_OFFSET_THETA1, SCARA_OFFSET_THETA2 }; |
|
|
|
//DEBUG_ECHOLNPAIR("homeposition A:", homeposition.a, " B:", homeposition.b);
|
|
|
|
inverse_kinematics(homeposition); |
|
|
|
forward_kinematics_SCARA(delta.a, delta.b); |
|
|
|
current_position[axis] = cartes[axis]; |
|
|
|
#elif ENABLED(MP_SCARA) |
|
|
|
// MP_SCARA uses a Cartesian XY home position
|
|
|
|
xyz_pos_t homeposition = { X_HOME_POS, Y_HOME_POS, Z_HOME_POS }; |
|
|
|
//DEBUG_ECHOPGM("homeposition");
|
|
|
|
//DEBUG_ECHOLNPAIR_P(SP_X_LBL, homeposition.x, SP_Y_LBL, homeposition.y);
|
|
|
|
delta.a = SCARA_OFFSET_THETA1; |
|
|
|
delta.b = SCARA_OFFSET_THETA2; |
|
|
|
forward_kinematics_SCARA(delta.a, delta.b); |
|
|
|
current_position[axis] = cartes[axis]; |
|
|
|
#elif ENABLED(AXEL_TPARA) |
|
|
|
xyz_pos_t homeposition = { X_HOME_POS, Y_HOME_POS, Z_HOME_POS }; |
|
|
|
//DEBUG_ECHOPGM("homeposition");
|
|
|
|
//DEBUG_ECHOLNPAIR_P(SP_X_LBL, homeposition.x, SP_Y_LBL, homeposition.y, SP_Z_LBL, homeposition.z);
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(MORGAN_SCARA) |
|
|
|
delta = homeposition; |
|
|
|
#else |
|
|
|
inverse_kinematics(homeposition); |
|
|
|
forward_kinematics_TPARA(delta.a, delta.b, delta.c); |
|
|
|
current_position[axis] = cartes[axis]; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if EITHER(MORGAN_SCARA, MP_SCARA) |
|
|
|
forward_kinematics(delta.a, delta.b); |
|
|
|
#elif ENABLED(AXEL_TPARA) |
|
|
|
forward_kinematics(delta.a, delta.b, delta.c); |
|
|
|
#endif |
|
|
|
|
|
|
|
current_position[axis] = cartes[axis]; |
|
|
|
|
|
|
|
//DEBUG_ECHOPGM("Cartesian");
|
|
|
|
//DEBUG_ECHOLNPAIR_P(SP_X_LBL, current_position.x, SP_Y_LBL, current_position.y);
|
|
|
|
update_software_endstops(axis); |
|
|
@ -85,7 +87,7 @@ void scara_set_axis_is_at_home(const AxisEnum axis) { |
|
|
|
* Maths and first version by QHARLEY. |
|
|
|
* Integrated into Marlin and slightly restructured by Joachim Cerny. |
|
|
|
*/ |
|
|
|
void forward_kinematics_SCARA(const float &a, const float &b) { |
|
|
|
void forward_kinematics(const float &a, const float &b) { |
|
|
|
const float a_sin = sin(RADIANS(a)) * L1, |
|
|
|
a_cos = cos(RADIANS(a)) * L1, |
|
|
|
b_sin = sin(RADIANS(b + TERN0(MP_SCARA, a))) * L2, |
|
|
@ -174,7 +176,7 @@ void scara_set_axis_is_at_home(const AxisEnum axis) { |
|
|
|
static constexpr xyz_pos_t robot_offset = { TPARA_OFFSET_X, TPARA_OFFSET_Y, TPARA_OFFSET_Z }; |
|
|
|
|
|
|
|
// Convert ABC inputs in degrees to XYZ outputs in mm
|
|
|
|
void forward_kinematics_TPARA(const float &a, const float &b, const float &c) { |
|
|
|
void forward_kinematics(const float &a, const float &b, const float &c) { |
|
|
|
const float w = c - b, |
|
|
|
r = L1 * cos(RADIANS(b)) + L2 * sin(RADIANS(w - (90 - b))), |
|
|
|
x = r * cos(RADIANS(a)), |
|
|
@ -227,7 +229,6 @@ void scara_set_axis_is_at_home(const AxisEnum axis) { |
|
|
|
homeaxis(C_AXIS); |
|
|
|
homeaxis(B_AXIS); |
|
|
|
|
|
|
|
|
|
|
|
// Set all carriages to their home positions
|
|
|
|
// Do this here all at once for Delta, because
|
|
|
|
// XYZ isn't ABC. Applying this per-tower would
|
|
|
|