Skip to content

Commit

Permalink
Resolved all prs from Alexander the great
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron345678 committed Jan 20, 2024
1 parent 2f54547 commit 8b3cf15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 16 additions & 1 deletion src/main/java/org/carlmontrobotics/commands/ArmTeleop.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,22 @@ public ArmTeleop(DoubleSupplier joystickSupplier, Arm armSubsystem) {
this.armSubsystem = armSubsystem;
addRequirements(armSubsystem);
}

public void controllerMoveArm(DoubleSupplier rightJoystick) {
/*
// move the arm around based off the right joystick movement on the manipulator joystick
//use the trapezoid thingy from robot code 2023
//Math below | Summary: Take in controller Y axis as a double then calculate amount of volts needed to pass to the arm and when to stop based off of the controller movement. Done so by finding the constraints of the arm, translating the controller numbers, and finding how many volts and when to stop using feedvolts and PID
double kgv = getKg();
double armFeedVolts = kgv * getCoM().getAngle().getCos() + armFeed.calculate(state.velocity, 0);
double armPIDVolts = armPID.calculate(getArmPos(), state.position);
if ((getArmPos() > ARM_UPPER_LIMIT_RAD && state.velocity > 0) ||
(getArmPos() < ARM_LOWER_LIMIT_RAD && state.velocity < 0)) {
forbFlag = true;
armFeedVolts = kgv * getCoM().getAngle().getCos() + armFeed.calculate(0, 0);
*/


}
// Called when the command is initially scheduled.
@Override
public void initialize() {}
Expand Down
17 changes: 1 addition & 16 deletions src/main/java/org/carlmontrobotics/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,7 @@ public void setArmGoal(double targetPosition, double targetVelocity) {
targetPosition = getArmClampedGoal(targetPosition);

}
public void controllerMoveArm(double rightJoystick) {
/*
// move the arm around based off the right joystick movement on the manipulator joystick
//use the trapezoid thingy from robot code 2023
//Math below | Summary: Take in controller Y axis as a double then calculate amount of volts needed to pass to the arm and when to stop based off of the controller movement. Done so by finding the constraints of the arm, translating the controller numbers, and finding how many volts and when to stop using feedvolts and PID
double kgv = getKg();
double armFeedVolts = kgv * getCoM().getAngle().getCos() + armFeed.calculate(state.velocity, 0);
double armPIDVolts = armPID.calculate(getArmPos(), state.position);
if ((getArmPos() > ARM_UPPER_LIMIT_RAD && state.velocity > 0) ||
(getArmPos() < ARM_LOWER_LIMIT_RAD && state.velocity < 0)) {
forbFlag = true;
armFeedVolts = kgv * getCoM().getAngle().getCos() + armFeed.calculate(0, 0);
*/


}

public double getArmClampedGoal(double goal) {
//Find the limits of the arm. Used to move it and ensure that the arm does not move past the amount
return MathUtil.clamp(MathUtil.inputModulus(goal, Constants.Arm.ARM_DICONT_RAD, Constants.Arm.ARM_DICONT_RAD + 2 * Math.PI), Constants.Arm.LOWER_ANGLE, Constants.Arm.UPPER_ANGLE);
Expand Down

0 comments on commit 8b3cf15

Please sign in to comment.