# FRC 程式組 2022 賽季前一周清點項目
###### tags: `程式組公告`
## Drive train
### A 方案
目前機械組準備重做底盤,讓我們再繼續測試。Aaron 可以繼續準備 `MecanumControllerCommand`。
```java=
MecanumControllerCommand mecanumControllerCommand = new MecanumControllerCommand(
testTrajectory,
m_robotDrive::getPose,
DriveConstants.kFeedforward,
DriveConstants.kDriveKinematics,
// Position contollers
new PIDController(AutoConstants.kPXController, 0.2, 0.3),
new PIDController(AutoConstants.kPYController, 0.2, 0.3),
// new PIDController(AutoConstants.kPXController, 0.5, 0.35),
// new PIDController(AutoConstants.kPYController, 0.5, 0.35),
new ProfiledPIDController(
AutoConstants.kPThetaController, 0, 0, AutoConstants.kThetaControllerConstraints),
// Needed for normalizing wheel speeds
AutoConstants.kMaxSpeedMetersPerSecond,
// Velocity PID's
new PIDController(DriveConstants.kPFrontLeftVel, 0, 0),
new PIDController(DriveConstants.kPRearLeftVel, 0, 0),
new PIDController(DriveConstants.kPFrontRightVel, 0, 0),
new PIDController(DriveConstants.kPRearRightVel, 0, 0),
m_robotDrive::getCurrentWheelSpeeds,
m_robotDrive::setDriveMotorControllersVolts, // Consumer for the output motor voltages
m_robotDrive);
// Reset odometry to the starting pose of the trajectory.
m_robotDrive.resetOdometry(testTrajectory.getInitialPose());
// Run path following command, then stop at the end.
return mecanumControllerCommand.andThen(() -> m_robotDrive.drive(0, 0, 0, false));
```
### B 方案
如果還是真的 Aaron 和 Albert 好像說可以用 `Ramsete Controller`,但在轉彎好像不順吧 ??
### C 方案
最後的方案就是用 Encoder 拿到的距離和 Gyro 測到的角度去實測
```java=
public static final int kEncoderCPR = 2048;
public static final double kWheelDiameterMeters = 0.1524;
public static final double kWheelCircumference = kWheelDiameterMeters * Math.PI;
public static final double kGearRatio = (50 / 14) * (48 / 16);
public static final double kEncoderDistancePerPulse = kWheelCircumference / (double) kEncoderCPR / kGearRatio / Math.sqrt(2) * 10;
```
```java=
motorFL.getSelectedSensorVelocity() * DriveConstants.kEncoderDistancePerPulse
```
## Shooter
我自己是覺得兩種方法都要做
中科去年比南科的時候就好像是某個自動的部分爆掉,結果整個下去,所以都要試
可以的話當然是 A 方案優先
### A 方案
[FRC 7130 Robot Calculator](https://www.desmos.com/calculator/sxpmn9dotp?lang=zh-TW)
用數學和各種原理
什麼空氣阻力?? 重力加速度??
裡面的所有單位都是 feet
### B 方案
最原始的方式
慢慢測
```
if(某一段距離){
motor.set(某個數字)
}else if(某一段距離){
motor.set(某個數字)
}else if(某一段距離){
motor.set(某個數字)
}else if(某一段距離){
motor.set(某個數字)
}
```
## Climber
機械那邊本來是要用 cancoder,但我們數量似乎不夠,所以應該會上限位開關。
就這樣