From 7ae03335737a6f19fefead5c53607228c8484f14 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 19 Sep 2024 10:06:17 +0800 Subject: [PATCH] add A8kPipetteCtrlModule --- app.db | Bin 188416 -> 188416 bytes .../java/a8k/hardware/A8kPipetteCtrlModule.java | 158 +++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 src/main/java/a8k/hardware/A8kPipetteCtrlModule.java diff --git a/app.db b/app.db index aa5307bd32aeaebdc3561a05b5b33e1dbfe5c788..0c7dc3f39a5a5c6370674be7b500bfcd442348d6 100644 GIT binary patch delta 613 zcma)&y-H+35JvBvA8{PUYwm)(jG#$jcXfAlHzo`F3==L)|J6$f&KPK{Pof}V>SOGi z7-+D4M=;b03Mx2<56=2!x_+779=6AKKmN4GSIg^V`?MTfT&`H4V;>kY76ZDl2ba-; z&dDJX3-5UDrI*ZNJYF2mb|q49loYV>1X^hgk!=LasfZ#(3NFo^WnGQY#xOx4DJ+1- zYS20$L~Bf)RI8+mP?l_-Gbin(7;coJr6rRR2tlzbNZ{GmkE}url5#9_N6e1I;KPW~ zq9Oy5qyn9EfS5!5M9$t6g^F$6sD>2n#z2Mf9BuKCB0JDldhpf|$dE-O7YrLy6^Bmk zHBGbAO`A@4|GK~3O?Tf-AAkLP-Cvy!7wt9?cY1J}cH+R%ep3k0-uJhUb>S2|?t$Me2jje@om8b!Au%O8^cqJ=P zc7((l zjg|~ZY(S$;i?kCUeT+z@4zU)gBN0;MJE9h(FUhA#J|dbJ=*f_i8D a<+%0opO$IzksYSnjIX|q-v_U~?~5Pt%a!v0 diff --git a/src/main/java/a8k/hardware/A8kPipetteCtrlModule.java b/src/main/java/a8k/hardware/A8kPipetteCtrlModule.java new file mode 100644 index 0000000..ce8d458 --- /dev/null +++ b/src/main/java/a8k/hardware/A8kPipetteCtrlModule.java @@ -0,0 +1,158 @@ +package a8k.hardware; + +import a8k.hardware.type.a8kcanprotocol.CmdId; +import a8k.hardware.type.a8kcanprotocol.MId; +import a8k.type.HardwareException; +import jakarta.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class A8kPipetteCtrlModule { + + @Resource + A8kCanBusService canBusService; + + final Integer overtime = 10000; + /* + virtual int32_t pipette_zmotor_enable(int32_t enable); + virtual int32_t pipette_zmotor_move_zero(); + virtual int32_t pipette_zmotor_move_to_zero_point_quick(); + virtual int32_t pipette_zmotor_measure_distance(); + virtual int32_t pipette_zmotor_read_measure_distance_result(int32_t *result0); + virtual int32_t pipette_zmotor_move_by(int32_t distance); + virtual int32_t pipette_zmotor_move_to(int32_t position); + + virtual int32_t pipette_init_device(); + virtual int32_t pipette_put_tip(); + virtual int32_t pipette_lld_prepare(); + virtual int32_t pipette_lld(int32_t lldtype, int32_t zdpos, int32_t c_threshold, int32_t p_threshold); + virtual int32_t pipette_aspirate_prepare(); + virtual int32_t pipette_aspirate_set_llf_velocity(int32_t llf_zm_rpm); + virtual int32_t pipette_aspirate_set_operation_verifi_p_thre(int32_t p_thre); + virtual int32_t pipette_aspirate_set_operation_verifi_eigen_time(int32_t eigen_time); + virtual int32_t pipette_aspirate_set_operation_verifi_tolerance(int32_t tolerance); + virtual int32_t pipette_aspirate(int32_t ul); + virtual int32_t pipette_aspirate_and_verify(int32_t ul); + virtual int32_t pipette_shake_up(int32_t ul, int32_t times); + virtual int32_t pipette_aspirate_infer_pressure(int32_t ul); + virtual int32_t pipette_aspirate_infer_eigen_time(int32_t ul); + virtual int32_t pipette_get_aspirate_infer_pressure_result(int32_t *result); + virtual int32_t pipette_get_aspirate_infer_eigen_time_result(int32_t *result); + + virtual int32_t pipette_get_sensor_sample_data(int32_t index, int32_t *motor_pos, int32_t *cval, int32_t *pval); + virtual int32_t pipette_get_sensor_sample_data_num(int32_t *num); + virtual int32_t pipette_zmotor_read_zero_point_state(int32_t *state); + virtual int32_t pipette_zmotor_read_dev_status_cache(int32_t *devStatus); + */ + + + public void zMotorEnable(int enable) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_enable.toInt(), enable); + } + + public void zMotorMoveZeroBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_move_zero.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void zMotorMoveToZeroPointQuickBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_move_to_zero_point_quick.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void zMotorMoveByBlock(int distance) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_move_by.toInt(), distance); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void zMotorMoveToBlock(int position) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_move_to.toInt(), position); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + + public void initDeviceBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_init_device.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void putTipBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_put_tip.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void lldPrepareBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_lld_prepare.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + + public void lldBlock(int lldtype, int zdpos, int c_threshold, int p_threshold) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_lld.toInt(), lldtype, zdpos, c_threshold, p_threshold); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + + public void aspiratePrepareBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_prepare.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void aspirateSetLlfVelocity(int llf_zm_rpm) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_set_llf_velocity.toInt(), llf_zm_rpm); + } + + public void aspirateSetOperationVerifPThre(int p_thre) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_set_operation_verifi_p_thre.toInt(), p_thre); + } + + public void aspirateSetOperationVerifEigenTime(int eigen_time) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_set_operation_verifi_eigen_time.toInt(), eigen_time); + } + + public void aspirateSetOperationVerifTolerance(int tolerance) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_set_operation_verifi_tolerance.toInt(), tolerance); + } + + public void aspirateBlock(int ul) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate.toInt(), ul); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void aspirateAndVerifyBlock(int ul) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_and_verify.toInt(), ul); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void shakeUpBlock(int ul, int times) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_shake_up.toInt(), ul, times); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void aspirateInferPressureBlock(int ul) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_infer_pressure.toInt(), ul); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void aspirateInferEigenTimeBlock(int ul) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_infer_eigen_time.toInt(), ul); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void getAspirateInferPressureResult(int[] result) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_get_aspirate_infer_pressure_result.toInt()); + } + + public void getAspirateInferEigenTimeResultBlock(int[] result) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_get_aspirate_infer_eigen_time_result.toInt()); + } + + public void getSensorSampleData(int index, int[] motor_pos, int[] cval, int[] pval) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_get_sensor_sample_data.toInt(), index); + } + + public void getSensorSampleDataNum(int[] num) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_get_sensor_sample_data_num.toInt()); + } +}