motor.setNeutralMode(NeutralModeValue.Brake);
TalonFXConfiguration config = new TalonFXConfiguration();
- CurrentLimitsConfigs limitConfig = new CurrentLimitsConfigs();
- limitConfig.StatorCurrentLimit = 200;
- limitConfig.StatorCurrentLimitEnable = true;
-
- motor.getConfigurator().apply(limitConfig);
// to be frank I just took this from hood because I don't know good values yet
config.Slot0.kS = 0.1; // Static friction compensation (should be >0 if friction exists)
}
public double getPosition() {
- return motor.getPosition().getValueAsDouble() / gearRatio; // Gear ratio
+ return Units.rotationsToDegrees(motor.getPosition().getValueAsDouble()) / gearRatio; // Gear ratio
}
public boolean atSetPoint(){
//Tune this with rotating robot
double dV = TurretConstants.ROTATIONAL_VELOCITY_CONSTANT;
- motor.setControl(voltageRequest.withPosition(motorTargetRotations).withFeedForward(dV * robotRotVel));
+ //motor.setControl(voltageRequest.withPosition(motorTargetRotations).withFeedForward(dV * robotRotVel));
+ motor.setControl(voltageRequest.withPosition(motorTargetRotations));
+
+ System.out.println("Workingnnnnngnggdsfadsfsa");
}
}
velocity = Units.rotationsPerMinuteToRadiansPerSecond(motor.getVelocity().getValueAsDouble() * 60);
ligament2d.setAngle(position);
+
+ SmartDashboard.putNumber("Turret Position Degrees", getPosition());
}
public double getAppliedVoltage() {
public static double MAX_ANGLE = 180;
public static double MIN_ANGLE = -180;
- public static double MAX_VELOCITY = 0.1; // m/s
+ public static double MAX_VELOCITY = 1.0; // m/s
public static double MAX_ACCELERATION = 5; // m/s^2
public static double TURRET_WIDTH = Units.feetToMeters(1.0);