diff --git a/sdk b/sdk index 599ae6d..42fbbd4 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 599ae6d11aaf71a05f8cc2436a230b2e880d43d0 +Subproject commit 42fbbd4c7b2d17d07d3bc5cb3f603d1466318293 diff --git a/usrc/subboards/subboard30_shake_module/pri_board.h b/usrc/subboards/subboard30_shake_module/pri_board.h index 57b7136..72c52d9 100644 --- a/usrc/subboards/subboard30_shake_module/pri_board.h +++ b/usrc/subboards/subboard30_shake_module/pri_board.h @@ -1,21 +1,80 @@ #pragma once #define TMC_MOTOR_SPI hspi1 -// JL_CSN +/*********************************************************************************************************************** + * 试管夹爪电机 * + ***********************************************************************************************************************/ #define MOTOR1_CSN PA4 #define MOTOR1_ENN PE3 #define MOTOR1_SPI_MODE_SELECT PinNull #define MOTOR1_REFL PD13 -#define MOTOR1_REFR PD14 -// SL_CSN +#define MOTOR1_REFR PinNull + +#define MOTOR1_MOTOR_SHAFT true +#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE 15 +#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 1 +#define MOTOR1_STEPMOTOR_IHOLD 2 +#define MOTOR1_STEPMOTOR_IRUN 8 +#define MOTOR1_STEPMOTOR_IHOLDDELAY 100 +#define MOTOR1_STEPMOTOR_IGLOBALSCALER 1 +#define MOTOR1_MOTOR_DEFAULT_ACC 300 +#define MOTOR1_MOTOR_DEFAULT_DEC 300 +#define MOTOR1_MOTOR_DEFAULT_VELOCITY 150 +#define MOTOR1_MIN_D 0 +#define MOTOR1_MAX_D 0 +#define MOTOR1_MOTOR_RUN_TO_ZERO_SPEED 100 +#define MOTOR1_MOTOR_RUN_TO_ZERO_DEC 300 +#define MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED 80 +#define MOTOR1_MOTOR_LOOK_ZERO_EDGE_DEC 500 + +/*********************************************************************************************************************** + * 升降电机 * + ***********************************************************************************************************************/ #define MOTOR2_CSN PA8 #define MOTOR2_ENN PE6 #define MOTOR2_SPI_MODE_SELECT PinNull #define MOTOR2_REFL PD11 -#define MOTOR2_REFR PD12 -// CL_CSN +#define MOTOR2_REFR PinNull + +#define MOTOR2_MOTOR_SHAFT true +#define MOTOR2_MOTOR_ONE_CIRCLE_PULSE 200 // 20mm 单位0.1mm +#define MOTOR2_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 1 +#define MOTOR2_STEPMOTOR_IHOLD 2 +#define MOTOR2_STEPMOTOR_IRUN 8 +#define MOTOR2_STEPMOTOR_IHOLDDELAY 100 +#define MOTOR2_STEPMOTOR_IGLOBALSCALER 1 +#define MOTOR2_MOTOR_DEFAULT_ACC 300 +#define MOTOR2_MOTOR_DEFAULT_DEC 300 +#define MOTOR2_MOTOR_DEFAULT_VELOCITY 150 +#define MOTOR2_MIN_D 0 +#define MOTOR2_MAX_D 0 +#define MOTOR2_MOTOR_RUN_TO_ZERO_SPEED 100 +#define MOTOR2_MOTOR_RUN_TO_ZERO_DEC 300 +#define MOTOR2_MOTOR_LOOK_ZERO_EDGE_SPEED 80 +#define MOTOR2_MOTOR_LOOK_ZERO_EDGE_DEC 500 + +/*********************************************************************************************************************** + * 摇匀电机 * + ***********************************************************************************************************************/ #define MOTOR3_CSN PA15 #define MOTOR3_ENN PE7 #define MOTOR3_SPI_MODE_SELECT PinNull -#define MOTOR3_REFL PD9 -#define MOTOR3_REFR PD10 \ No newline at end of file +#define MOTOR3_REFL PD6 +#define MOTOR3_REFR PinNull + +#define MOTOR3_MOTOR_SHAFT true +#define MOTOR3_MOTOR_ONE_CIRCLE_PULSE 120 // 360转一圈 +#define MOTOR3_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 1 +#define MOTOR3_STEPMOTOR_IHOLD 2 +#define MOTOR3_STEPMOTOR_IRUN 18 +#define MOTOR3_STEPMOTOR_IHOLDDELAY 100 +#define MOTOR3_STEPMOTOR_IGLOBALSCALER 1 +#define MOTOR3_MOTOR_DEFAULT_ACC 300 +#define MOTOR3_MOTOR_DEFAULT_DEC 300 +#define MOTOR3_MOTOR_DEFAULT_VELOCITY 150 +#define MOTOR3_MIN_D 0 +#define MOTOR3_MAX_D 0 +#define MOTOR3_MOTOR_RUN_TO_ZERO_SPEED 50 +#define MOTOR3_MOTOR_RUN_TO_ZERO_DEC 300 +#define MOTOR3_MOTOR_LOOK_ZERO_EDGE_SPEED 50 +#define MOTOR3_MOTOR_LOOK_ZERO_EDGE_DEC 500 diff --git a/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp b/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp index 7332ebd..51d6140 100644 --- a/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp +++ b/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp @@ -72,7 +72,23 @@ void Subboard30ShakeModule::initialize() { StepMotorCtrlModule::config_t stepcfg = {0}; StepMotorCtrlModule::create_default_cfg(stepcfg); - stepcfg.stepmotor_irun = 15; + + stepcfg.motor_shaft = MOTOR1_MOTOR_SHAFT; + stepcfg.motor_one_circle_pulse = MOTOR1_MOTOR_ONE_CIRCLE_PULSE; + stepcfg.motor_one_circle_pulse_denominator = MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR; + stepcfg.stepmotor_ihold = MOTOR1_STEPMOTOR_IHOLD; + stepcfg.stepmotor_irun = MOTOR1_STEPMOTOR_IRUN; + stepcfg.stepmotor_iholddelay = MOTOR1_STEPMOTOR_IHOLDDELAY; + stepcfg.stepmotor_iglobalscaler = MOTOR1_STEPMOTOR_IGLOBALSCALER; + stepcfg.motor_default_acc = MOTOR1_MOTOR_DEFAULT_ACC; + stepcfg.motor_default_dec = MOTOR1_MOTOR_DEFAULT_DEC; + stepcfg.motor_default_velocity = MOTOR1_MOTOR_DEFAULT_VELOCITY; + stepcfg.min_d = MOTOR1_MIN_D; + stepcfg.max_d = MOTOR1_MAX_D; + stepcfg.motor_run_to_zero_speed = MOTOR1_MOTOR_RUN_TO_ZERO_SPEED; + stepcfg.motor_run_to_zero_dec = MOTOR1_MOTOR_RUN_TO_ZERO_DEC; + stepcfg.motor_look_zero_edge_speed = MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED; + stepcfg.motor_look_zero_edge_dec = MOTOR1_MOTOR_LOOK_ZERO_EDGE_DEC; module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg); GService::inst()->getZCanProtocolParser()->registerModule(&module); @@ -102,7 +118,23 @@ void Subboard30ShakeModule::initialize() { StepMotorCtrlModule::config_t stepcfg = {0}; StepMotorCtrlModule::create_default_cfg(stepcfg); - stepcfg.stepmotor_irun = 15; + + stepcfg.motor_shaft = MOTOR2_MOTOR_SHAFT; + stepcfg.motor_one_circle_pulse = MOTOR2_MOTOR_ONE_CIRCLE_PULSE; + stepcfg.motor_one_circle_pulse_denominator = MOTOR2_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR; + stepcfg.stepmotor_ihold = MOTOR2_STEPMOTOR_IHOLD; + stepcfg.stepmotor_irun = MOTOR2_STEPMOTOR_IRUN; + stepcfg.stepmotor_iholddelay = MOTOR2_STEPMOTOR_IHOLDDELAY; + stepcfg.stepmotor_iglobalscaler = MOTOR2_STEPMOTOR_IGLOBALSCALER; + stepcfg.motor_default_acc = MOTOR2_MOTOR_DEFAULT_ACC; + stepcfg.motor_default_dec = MOTOR2_MOTOR_DEFAULT_DEC; + stepcfg.motor_default_velocity = MOTOR2_MOTOR_DEFAULT_VELOCITY; + stepcfg.min_d = MOTOR2_MIN_D; + stepcfg.max_d = MOTOR2_MAX_D; + stepcfg.motor_run_to_zero_speed = MOTOR2_MOTOR_RUN_TO_ZERO_SPEED; + stepcfg.motor_run_to_zero_dec = MOTOR2_MOTOR_RUN_TO_ZERO_DEC; + stepcfg.motor_look_zero_edge_speed = MOTOR2_MOTOR_LOOK_ZERO_EDGE_SPEED; + stepcfg.motor_look_zero_edge_dec = MOTOR2_MOTOR_LOOK_ZERO_EDGE_DEC; module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg); GService::inst()->getZCanProtocolParser()->registerModule(&module); @@ -131,7 +163,23 @@ void Subboard30ShakeModule::initialize() { StepMotorCtrlModule::config_t stepcfg = {0}; StepMotorCtrlModule::create_default_cfg(stepcfg); - stepcfg.stepmotor_irun = 15; + + stepcfg.motor_shaft = MOTOR3_MOTOR_SHAFT; + stepcfg.motor_one_circle_pulse = MOTOR3_MOTOR_ONE_CIRCLE_PULSE; + stepcfg.motor_one_circle_pulse_denominator = MOTOR3_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR; + stepcfg.stepmotor_ihold = MOTOR3_STEPMOTOR_IHOLD; + stepcfg.stepmotor_irun = MOTOR3_STEPMOTOR_IRUN; + stepcfg.stepmotor_iholddelay = MOTOR3_STEPMOTOR_IHOLDDELAY; + stepcfg.stepmotor_iglobalscaler = MOTOR3_STEPMOTOR_IGLOBALSCALER; + stepcfg.motor_default_acc = MOTOR3_MOTOR_DEFAULT_ACC; + stepcfg.motor_default_dec = MOTOR3_MOTOR_DEFAULT_DEC; + stepcfg.motor_default_velocity = MOTOR3_MOTOR_DEFAULT_VELOCITY; + stepcfg.min_d = MOTOR3_MIN_D; + stepcfg.max_d = MOTOR3_MAX_D; + stepcfg.motor_run_to_zero_speed = MOTOR3_MOTOR_RUN_TO_ZERO_SPEED; + stepcfg.motor_run_to_zero_dec = MOTOR3_MOTOR_RUN_TO_ZERO_DEC; + stepcfg.motor_look_zero_edge_speed = MOTOR3_MOTOR_LOOK_ZERO_EDGE_SPEED; + stepcfg.motor_look_zero_edge_dec = MOTOR3_MOTOR_LOOK_ZERO_EDGE_DEC; module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg); GService::inst()->getZCanProtocolParser()->registerModule(&module); @@ -167,7 +215,6 @@ void Subboard30ShakeModule::initialize() { feiteservomotor_bus.regServo(subidInBus, feite::ksts5420m_c001); - module.create_default_config(cfg); module.initialize(getmoduleId(subid), &feiteservomotor_bus, subidInBus, &cfg); GService::inst()->getZCanProtocolParser()->registerModule(&module);