Skip to content

Commit

Permalink
add cube high shooting preset and autos using it, change arm and wrist
Browse files Browse the repository at this point in the history
constants, fix charge station auto, add safety to arm and wrist
  • Loading branch information
ss0g committed Mar 6, 2023
1 parent 383f1c3 commit 35be8f6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/spartronics4915/frc2023/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public ArmMotorConstants(int MotorID, double PositionConversionFactor, boolean I
public static final ArmMotorConstants kPivotMotorConstants = new ArmMotorConstants(
15, //actual value 15
Math.PI * 2, false,
0.25, 0, 0, 0.04,
0.30, 0, 0, 0.05,// 0.25, ..., 0.04
Math.PI/8, 1, 0,
Rotation2d.fromDegrees(66), 10, false,
MotorType.kBrushless
Expand All @@ -374,7 +374,7 @@ public ArmMotorConstants(int MotorID, double PositionConversionFactor, boolean I
public static final ArmMotorConstants kWristMotorConstants = new ArmMotorConstants(
19,
Math.PI * 2, true,
0.3, 0, 0, 0.03,
0.4, 0, 0, 0.04,// 0.3, ..., 0.03
1, 1, 0, //maybe try lowering max velocity, maybe add limiter variables for smart motion
Rotation2d.fromDegrees(136),-1, true,
MotorType.kBrushed
Expand Down
28 changes: 27 additions & 1 deletion src/main/java/com/spartronics4915/frc2023/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ mArmCommands.new ReleasePiece(ArmState.FLOOR_POS),
new ChargeStationCommands.AutoChargeStationClimb()
)
),
mAutos.new Strategy(
"High cube, Balance",
(Pose2d initialPose) -> new SequentialCommandGroup(
mArmCommands.new ReleasePiece(ArmState.SHOOT_HIGH_CUBE),
mArmCommands.new SetArmLocalState(ArmState.TUCK_INTERMEDIATE),
new WaitCommand(1),
new ChargeStationCommands.AutoChargeStationClimb()
)
),
// mAutos.new Strategy(
// "Drop, Leave, Pick-up",
// (Pose2d initialPose) -> new SequentialCommandGroup(
Expand All @@ -175,7 +184,7 @@ mArmCommands.new ReleasePiece(ArmState.FLOOR_POS),
// )
// ),
mAutos.new Strategy(
"Drop, Leave, Pick-up",
"Drop, Leave, Pick-up (do not use)",
(Pose2d initialPose) -> new SequentialCommandGroup(
mArmCommands.new ReleasePiece(ArmState.FLOOR_POS),
mSwerveTrajectoryFollowerCommands.new FollowStaticTrajectory(
Expand Down Expand Up @@ -206,6 +215,12 @@ mAutos.new Strategy(
mArmCommands.new ReleasePiece(ArmState.FLOOR_POS)
)
),
mAutos.new Strategy(
"high cube, do nothing",
(Pose2d initialPose) -> new SequentialCommandGroup(
mArmCommands.new ReleasePiece(ArmState.SHOOT_HIGH_CUBE)
)
),
mAutos.new Strategy(
"place, leave community",
(Pose2d initialPose) -> new SequentialCommandGroup(
Expand All @@ -217,6 +232,17 @@ mArmCommands.new SetArmLocalState(ArmState.TUCK_INTERMEDIATE),
mSwerve.driveCommand(new ChassisSpeeds(), false, true)
)
),
mAutos.new Strategy(
"cube high, leave community",
(Pose2d initialPose) -> new SequentialCommandGroup(
mArmCommands.new ReleasePiece(ArmState.SHOOT_HIGH_CUBE),
mArmCommands.new SetArmLocalState(ArmState.TUCK_INTERMEDIATE),
new WaitCommand(1),
mSwerve.driveCommand(new ChassisSpeeds(-2, 0, 0), false, true),
new WaitCommand(2.5),
mSwerve.driveCommand(new ChassisSpeeds(), false, true)
)
),
mAutos.new Strategy(
"cube high (test)",
(Pose2d initialPose) -> new SequentialCommandGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public void execute() {
}

case GRIP_TO_PLATFORM: {
final double grip_to_platform_speed_m_s = -2. * 0.175;
final double grip_to_platform_target_roll_deg = 8;
final double grip_to_platform_speed_m_s = -2. * 0.1875;
final double grip_to_platform_target_roll_deg = 9;
final double grip_to_platform_time_allowed = 5;
if (mCurrStateTimer.hasElapsed(grip_to_platform_time_allowed)) {
mSwerve.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void setArmReference(Rotation2d ref) {
// This is designed to ignore unsafe arm positions.
if (Math.abs(ref.getDegrees()) > 100)
{
System.out.println("Unsafe arm position requested: " + ref);
System.out.println("Unsafe arm position requested (setArmReference): " + ref);
return;
}
mModeledPosition = getRawPosition();
Expand Down Expand Up @@ -134,8 +134,12 @@ public Rotation2d nativeToArm(Rotation2d nativeRotation) {

private void setNativeReference(Rotation2d ref) {

System.out.println("SetNativeReferenceCalled");
if (Math.abs(mCurrentReference.minus(ref).getDegrees()) > 120) {
System.out.println("setNativeReference illegal request:" + ref);
return;
}
mCurrentReference = ref;

mReferenceRadians = ref.getRadians();
mReferenceSet = true;
}
Expand Down

0 comments on commit 35be8f6

Please sign in to comment.