package com.iflytop.gd.hardware.constants; import com.iflytop.gd.hardware.drivers.MiniServoDriver.MiniServoMId; import org.springframework.util.Assert; import java.util.Map; public class MiniServoConstant { static public final Integer actionOvertime = 10000; static class MiniServoFixPosConfig { public Integer zeroPos; public Integer refPos; } static Map map = Map.of( // //摇匀模组Y轴 // MiniServoMId.ShakeModGripperYSV, new MiniServoFixPosConfig() {{ // zeroPos = 110; // refPos = 100;//Y轴最外侧的位置 // }}, // //摇匀模组夹爪 // MiniServoMId.ShakeModGripperSV, new MiniServoFixPosConfig() {{ // zeroPos = 1600; // refPos = 1800;//完全张开的位置 // }}, // //试管架夹紧 // MiniServoMId.ShakeModTubeScanerClampingSV, new MiniServoFixPosConfig() {{ // zeroPos = 1800; // refPos = 1800;//水平位置 // }}, // //试管顶升舵机 // MiniServoMId.ShakeModLiftingSV, new MiniServoFixPosConfig() {{ // zeroPos = 644;//底部 644/3000 = 220/1024 // refPos = 644;//底部 // }} ); static public Integer getZeroPos(MiniServoMId mid) { var config = map.get(mid); Assert.notNull(config, "getZeroPos fail"); return config.zeroPos; } static public Integer getRefPos(MiniServoMId mid) { var config = map.get(mid); Assert.notNull(config, "getRefPos fail"); return config.refPos; } }