generated from SciBorgs/Hydrogen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed a sim issue. pid is WAY out of tune though
- Loading branch information
Showing
8 changed files
with
142 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 25 additions & 13 deletions
38
src/main/java/org/sciborgs1155/robot/arm/ArmConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,52 @@ | ||
package org.sciborgs1155.robot.arm; | ||
|
||
import static edu.wpi.first.units.Units.Centimeters; | ||
import static edu.wpi.first.units.Units.Degrees; | ||
import static edu.wpi.first.units.Units.Radians; | ||
import static edu.wpi.first.units.Units.RadiansPerSecond; | ||
import static edu.wpi.first.units.Units.RadiansPerSecondPerSecond; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.math.system.plant.DCMotor; | ||
import edu.wpi.first.units.measure.Angle; | ||
import edu.wpi.first.units.measure.AngularAcceleration; | ||
import edu.wpi.first.units.measure.AngularVelocity; | ||
import edu.wpi.first.units.measure.Distance; | ||
|
||
/** Constants for the {@link Arm} subsystem. */ | ||
public class ArmConstants { | ||
// TODO: not tuned (at all) | ||
public static final double kP = 1; | ||
public static final double kP = 10; | ||
public static final double kI = 0; | ||
public static final double kD = 0.01; | ||
public static final double kD = 0.1; | ||
|
||
public static final double kS = 1; | ||
public static final double kS = 0; | ||
public static final double kV = 0; | ||
public static final double kA = 0.01; | ||
public static final double kG = 0.01; | ||
public static final double kA = 0; | ||
public static final double kG = 0; | ||
|
||
// TODO: figure these out | ||
public static final Rotation2d INTAKE_ANGLE = Rotation2d.fromRadians(0); | ||
public static final Rotation2d OUTTAKE_ANGLE = Rotation2d.fromRadians(0); | ||
public static final Rotation2d STARTING_ANGLE = Rotation2d.fromRadians(0); | ||
public static final Angle INTAKE_ANGLE = Radians.of(-Math.PI / 4); | ||
public static final Angle OUTTAKE_ANGLE = Radians.of(Math.PI * 3 / 4); | ||
public static final Angle STARTING_ANGLE = Radians.of(Math.PI / 2); | ||
public static final Angle DEFAULT_ANGLE = Radians.of(Math.PI * 5 / 8); | ||
public static final Angle CLIMB_INTAKE_ANGLE = Radians.of(0); | ||
public static final Angle CLIMB_FINAL_ANGLE = Radians.of(Math.PI * 3 / 4); | ||
|
||
// TODO: and these... | ||
public static final DCMotor GEARBOX = DCMotor.getNEO(1); | ||
public static final DCMotor GEARBOX = DCMotor.getKrakenX60(2); | ||
public static final double GEARING = 8.21; | ||
public static final double MOI = 1; | ||
public static final double MOI = 0.7765; | ||
|
||
public static final Distance ARM_LENGTH = Centimeters.of(10); | ||
|
||
/** Fully extended. */ | ||
public static final Angle MIN_ANGLE = Radians.of(0.5); | ||
public static final Angle MIN_ANGLE = Radians.of(-Math.PI / 4 - 0.2); | ||
|
||
/** Fully retracted. */ | ||
public static final Angle MAX_ANGLE = Radians.of(3); | ||
public static final Angle MAX_ANGLE = Radians.of(Math.PI * 3 / 4 + 0.1); | ||
|
||
public static final Angle GOTO_TOLERANCE = Degrees.of(2); | ||
|
||
public static final AngularVelocity MAX_VELOCITY = RadiansPerSecond.of(4); | ||
public static final AngularAcceleration MAX_ACCEl = RadiansPerSecondPerSecond.of(10); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/org/sciborgs1155/robot/commands/GroundIntake.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.sciborgs1155.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import org.sciborgs1155.robot.arm.Arm; | ||
import org.sciborgs1155.robot.arm.ArmConstants; | ||
import org.sciborgs1155.robot.roller.Roller; | ||
|
||
public class GroundIntake { | ||
|
||
private Arm arm; | ||
private Roller roller; | ||
|
||
public GroundIntake(Arm arm, Roller roller) { | ||
this.arm = arm; | ||
this.roller = roller; | ||
} | ||
|
||
public Command intake() { | ||
return arm.goTo(ArmConstants.INTAKE_ANGLE).alongWith(roller.intake()); | ||
} | ||
|
||
public Command outtake() { | ||
return arm.goTo(ArmConstants.OUTTAKE_ANGLE).andThen(roller.outtake()); | ||
} | ||
|
||
public Command climb() { | ||
return arm.goTo(ArmConstants.CLIMB_INTAKE_ANGLE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters