Skip to content

Commit

Permalink
Merge pull request #46 from veerwang/pr-filterspin
Browse files Browse the repository at this point in the history
add support for Squid filter wheel
  • Loading branch information
hongquanli authored Dec 27, 2024
2 parents 8e732ee + 771e138 commit 48e1cef
Show file tree
Hide file tree
Showing 10 changed files with 713 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,36 @@ int32_t tmc4361A_read_encoder_vel(TMC4361ATypeDef *tmc4361A) {
int32_t tmc4361A_read_encoder_vel_filtered(TMC4361ATypeDef *tmc4361A) {
return tmc4361A_readInt(tmc4361A, TMC4361A_V_ENC_MEAN_RD);
}

/*
-----------------------------------------------------------------------------
DESCRIPTION: tmc4361A_write_encoder()
OPERATION: We set encode value to register when need
ARGUMENTS:
TMC4361ATypeDef *tmc4361A: Pointer to a struct containing motor driver info
int32_t value: encode value
RETURNS: None
INPUTS / OUTPUTS: The CS pin and SPI MISO and MOSI pins output, input, and output data respectively
LOCAL VARIABLES:
None
SHARED VARIABLES:
None
GLOBAL VARIABLES: None
DEPENDENCIES: tmc4316A.h
-----------------------------------------------------------------------------
*/
void tmc4361A_write_encoder(TMC4361ATypeDef *tmc4361A, int32_t value) {
tmc4361A_writeInt(tmc4361A, TMC4361A_ENC_POS, value);
}

/*
-----------------------------------------------------------------------------
DESCRIPTION: tmc4361A_read_deviation() reads the difference between XACTUAL and ENC_POS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ bool tmc4361A_read_deviation_flag(TMC4361ATypeDef *tmc4361A);
int32_t tmc4361A_read_encoder(TMC4361ATypeDef *tmc4361A, uint8_t n_avg_exp);
int32_t tmc4361A_read_encoder_vel(TMC4361ATypeDef *tmc4361A);
int32_t tmc4361A_read_encoder_vel_filtered(TMC4361ATypeDef *tmc4361A);
void tmc4361A_write_encoder(TMC4361ATypeDef *tmc4361A, int32_t value);
int32_t tmc4361A_read_deviation(TMC4361ATypeDef *tmc4361A);
int32_t tmc4361A_speed(TMC4361ATypeDef *tmc4361A);
int32_t tmc4361A_acceleration(TMC4361ATypeDef *tmc4361A);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
static const uint8_t x = 1;
static const uint8_t y = 0;
static const uint8_t z = 2;
static const uint8_t w = 3;

static const float R_sense_xy = 0.22;
static const float R_sense_z = 0.43;
static const float R_sense_w = 0.105;

// limit switch
static const bool flip_limit_switch_x = true;
Expand All @@ -17,30 +19,38 @@ static const bool flip_limit_switch_y = true;
static const int FULLSTEPS_PER_REV_X = 200;
static const int FULLSTEPS_PER_REV_Y = 200;
static const int FULLSTEPS_PER_REV_Z = 200;
static const int FULLSTEPS_PER_REV_W = 200;
static const int FULLSTEPS_PER_REV_THETA = 200;

float SCREW_PITCH_X_MM = 2.54;
float SCREW_PITCH_Y_MM = 2.54;
float SCREW_PITCH_Z_MM = 0.3;
float SCREW_PITCH_W_MM = 1;

int MICROSTEPPING_X = 256;
int MICROSTEPPING_Y = 256;
int MICROSTEPPING_Z = 256;
int MICROSTEPPING_W = 64;

static const float HOMING_VELOCITY_X = 0.8;
static const float HOMING_VELOCITY_Y = 0.8;
static const float HOMING_VELOCITY_Z = 0.5;
static const float HOMING_VELOCITY_W = 0.15 * SCREW_PITCH_W_MM;

long steps_per_mm_X = FULLSTEPS_PER_REV_X*MICROSTEPPING_X/SCREW_PITCH_X_MM;
long steps_per_mm_Y = FULLSTEPS_PER_REV_Y*MICROSTEPPING_Y/SCREW_PITCH_Y_MM;
long steps_per_mm_Z = FULLSTEPS_PER_REV_Z*MICROSTEPPING_Z/SCREW_PITCH_Z_MM;
long steps_per_mm_W = FULLSTEPS_PER_REV_W*MICROSTEPPING_W/SCREW_PITCH_W_MM;

float MAX_VELOCITY_X_mm = 50;
float MAX_VELOCITY_Y_mm = 50;
float MAX_VELOCITY_Z_mm = 2;
float MAX_VELOCITY_W_mm = 3.19 * SCREW_PITCH_W_MM;

float MAX_ACCELERATION_X_mm = 200;
float MAX_ACCELERATION_Y_mm = 200;
float MAX_ACCELERATION_Z_mm = 20;
float MAX_ACCELERATION_W_mm = 300 * SCREW_PITCH_W_MM;

static const long X_NEG_LIMIT_MM = -130;
static const long X_POS_LIMIT_MM = 130;
Expand All @@ -54,15 +64,18 @@ float X_MOTOR_RMS_CURRENT_mA = 1000;
float Y_MOTOR_RMS_CURRENT_mA = 1000;
// Ding's motion size 8 linear actuator
float Z_MOTOR_RMS_CURRENT_mA = 500;
float W_MOTOR_RMS_CURRENT_mA = 1900;

float X_MOTOR_I_HOLD = 0.25;
float Y_MOTOR_I_HOLD = 0.25;
float Z_MOTOR_I_HOLD = 0.5;
float W_MOTOR_I_HOLD = 0.5;

// encoder
bool X_use_encoder = false;
bool Y_use_encoder = false;
bool Z_use_encoder = false;
bool W_use_encoder = false;

// signs
int MOVEMENT_SIGN_X = 1; // not used for now
Expand Down
Loading

0 comments on commit 48e1cef

Please sign in to comment.