FA-FO hardware changes
This commit is contained in:
parent
63d960f8a5
commit
40deb27652
3 changed files with 21 additions and 18 deletions
|
|
@ -27,7 +27,7 @@ constexpr float ENCODER_ANGLE_TO_ROTOR_ANGLE = (ENCODER_MAGNET_PITCH*2.0f) /
|
||||||
|
|
||||||
// enables error checking for encoders (slow) - useful for debugging
|
// enables error checking for encoders (slow) - useful for debugging
|
||||||
// Note: some chips seem to return always a crc of 0 producing massiv false errors
|
// Note: some chips seem to return always a crc of 0 producing massiv false errors
|
||||||
constexpr bool ENABLE_ENCODER_CRC = false;
|
constexpr bool ENABLE_ENCODER_CRC = true;
|
||||||
|
|
||||||
//--- HOMING ------------------------------------------------------------------
|
//--- HOMING ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ constexpr float HOMING_CURRENT = 0.15f; // range 0..1
|
||||||
//--- CALIBRATION -------------------------------------------------------------
|
//--- CALIBRATION -------------------------------------------------------------
|
||||||
|
|
||||||
// degrees from home position
|
// degrees from home position
|
||||||
constexpr float CALIBRATION_RANGE = 83;
|
constexpr float CALIBRATION_RANGE = 83;
|
||||||
|
|
||||||
// velocity of the magnetic field during calibration (lower is more accurate)
|
// velocity of the magnetic field during calibration (lower is more accurate)
|
||||||
constexpr float CALIBRATION_FIELD_VELOCITY = 20.0f;
|
constexpr float CALIBRATION_FIELD_VELOCITY = 20.0f;
|
||||||
|
|
@ -70,7 +70,7 @@ constexpr float VEL_KI = 90.0f;
|
||||||
|
|
||||||
#define JOINT_READY_OVERRIDE
|
#define JOINT_READY_OVERRIDE
|
||||||
|
|
||||||
// #define SINGLE_AXIS_BOARD
|
#define SINGLE_AXIS_BOARD
|
||||||
#ifndef SINGLE_AXIS_BOARD
|
#ifndef SINGLE_AXIS_BOARD
|
||||||
// Pins for 3Axis Board
|
// Pins for 3Axis Board
|
||||||
// #define PIN_BUILTIN_LED 23 // RP2040 pico clone
|
// #define PIN_BUILTIN_LED 23 // RP2040 pico clone
|
||||||
|
|
@ -87,18 +87,18 @@ constexpr float VEL_KI = 90.0f;
|
||||||
#define PIN_M2_PWM_B_POS 10
|
#define PIN_M2_PWM_B_POS 10
|
||||||
#define PIN_M2_PWM_B_NEG 11
|
#define PIN_M2_PWM_B_NEG 11
|
||||||
|
|
||||||
#define PIN_M3_PWM_A_POS 5
|
#define PIN_M3_PWM_A_POS 20
|
||||||
#define PIN_M3_PWM_A_NEG 4
|
#define PIN_M3_PWM_A_NEG 21
|
||||||
#define PIN_M3_PWM_B_POS 6
|
#define PIN_M3_PWM_B_POS 22
|
||||||
#define PIN_M3_PWM_B_NEG 7
|
#define PIN_M3_PWM_B_NEG 7
|
||||||
|
|
||||||
|
|
||||||
#define PIN_MOTOR_EN 18
|
#define PIN_MOTOR_EN 18
|
||||||
#define PIN_MOTOR_PWMAB 19
|
#define PIN_MOTOR_PWMAB 19
|
||||||
|
|
||||||
#define PIN_ENCODER1_CS 20
|
#define PIN_ENCODER1_CS 4
|
||||||
#define PIN_ENCODER2_CS 21
|
#define PIN_ENCODER2_CS 5
|
||||||
#define PIN_ENCODER3_CS 22
|
#define PIN_ENCODER3_CS 6
|
||||||
#define PIN_ENCODER_SCK 2
|
#define PIN_ENCODER_SCK 2
|
||||||
#define PIN_ENCODER_MISO 0
|
#define PIN_ENCODER_MISO 0
|
||||||
#define PIN_ENCODER_MOSI 3
|
#define PIN_ENCODER_MOSI 3
|
||||||
|
|
@ -121,19 +121,22 @@ constexpr float VEL_KI = 90.0f;
|
||||||
#define PIN_M2_PWM_B_POS 10
|
#define PIN_M2_PWM_B_POS 10
|
||||||
#define PIN_M2_PWM_B_NEG 11
|
#define PIN_M2_PWM_B_NEG 11
|
||||||
|
|
||||||
#define PIN_M3_PWM_A_POS 5
|
#define PIN_M3_PWM_A_POS 20
|
||||||
#define PIN_M3_PWM_A_NEG 4
|
#define PIN_M3_PWM_A_NEG 21
|
||||||
#define PIN_M3_PWM_B_POS 6
|
#define PIN_M3_PWM_B_POS 22
|
||||||
#define PIN_M3_PWM_B_NEG 7
|
#define PIN_M3_PWM_B_NEG 7
|
||||||
|
|
||||||
|
|
||||||
#define PIN_MOTOR_EN 18
|
#define PIN_MOTOR_EN 18
|
||||||
#define PIN_MOTOR_PWMAB 19
|
#define PIN_MOTOR_PWMAB 19
|
||||||
|
|
||||||
#define PIN_ENCODER1_CS 20
|
#define PIN_ENCODER1_CS 4
|
||||||
#define PIN_ENCODER2_CS 21
|
#define PIN_ENCODER2_CS 5
|
||||||
#define PIN_ENCODER3_CS 22
|
#define PIN_ENCODER3_CS 6
|
||||||
#define PIN_ENCODER_SCK 2
|
#define PIN_ENCODER_SCK 2
|
||||||
#define PIN_ENCODER_MISO 0
|
#define PIN_ENCODER_MISO 0
|
||||||
#define PIN_ENCODER_MOSI 3
|
#define PIN_ENCODER_MOSI 3
|
||||||
#endif
|
|
||||||
|
#define PIN_TOOL1 16
|
||||||
|
#define PIN_TOOL2 17
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ bool RobotJoint::calibrate(bool print_measurements) {
|
||||||
bool homing_ok = homing_controller.run_blocking(servo_controller, -HOMING_VELOCITY,
|
bool homing_ok = homing_controller.run_blocking(servo_controller, -HOMING_VELOCITY,
|
||||||
360.0f*DEG_TO_RAD, HOMING_CURRENT,
|
360.0f*DEG_TO_RAD, HOMING_CURRENT,
|
||||||
ENCODER_ANGLE_TO_ROTOR_ANGLE,
|
ENCODER_ANGLE_TO_ROTOR_ANGLE,
|
||||||
0.0f);
|
17.5f*DEG_TO_RAD);
|
||||||
if(homing_ok == false) {
|
if(homing_ok == false) {
|
||||||
LOG_ERROR("Joint-%i: Calibration failed due to unsuccessful homing sequence", joint_idx);
|
LOG_ERROR("Joint-%i: Calibration failed due to unsuccessful homing sequence", joint_idx);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ bool measure_calibration_data(
|
||||||
if(encoder.get_status() & MT6835_STATUS_WEAKFIELD)
|
if(encoder.get_status() & MT6835_STATUS_WEAKFIELD)
|
||||||
weak_field_measurements++;
|
weak_field_measurements++;
|
||||||
|
|
||||||
if(print_measurements)
|
if(true)
|
||||||
LOG_RAW("%15.10f, %15.10f, %f", motor_pos, field_angle, encoder_angle_raw);
|
LOG_RAW("%15.10f, %15.10f, %f", motor_pos, field_angle, encoder_angle_raw);
|
||||||
|
|
||||||
encoder_angle_and_motor_pos.push_back({encoder_angle_raw, motor_pos});
|
encoder_angle_and_motor_pos.push_back({encoder_angle_raw, motor_pos});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue