This repository has been archived by the owner on May 19, 2024. It is now read-only.
-
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.
Merge pull request #15 from Gongoliers/2_8_2024_arm_testing
2/8/2024 - 2/9/2024 shoulder joint implementation
- Loading branch information
Showing
21 changed files
with
354 additions
and
186 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package frc.lib; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
|
||
/** Helper class to assist with arm feedforward calculations. */ | ||
public class ArmFeedforwardCalculator { | ||
|
||
/** | ||
* Calculates the gravity compensation constant for an arm given the voltage applied at an | ||
* equilibrium position. | ||
* | ||
* @param angle the equilibrium position of the arm. | ||
* @param volts the voltage applied to the arm to hold it the equilibrium position. | ||
* @return the gravity compensation constant for the arm. | ||
*/ | ||
public static double calculateArmGravityCompensation(Rotation2d angle, double volts) { | ||
return volts / angle.getCos(); | ||
} | ||
} |
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,17 @@ | ||
package frc.lib; | ||
|
||
/** Helper class to assist with motion profile calculations. */ | ||
public class MotionProfileCalculator { | ||
|
||
/** | ||
* Calculates an acceleration using a ramp duration. | ||
* | ||
* @param maximumSpeed the maximum speed in units per second. | ||
* @param desiredRampDurationSeconds the desired duration to ramp from no speed to full speed. | ||
* @return the acceleration in units per second per second. | ||
*/ | ||
public static double calculateAcceleration( | ||
double maximumSpeed, double desiredRampDurationSeconds) { | ||
return maximumSpeed / desiredRampDurationSeconds; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,49 @@ | ||
package frc.robot.arm; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.math.util.Units; | ||
import frc.lib.CAN; | ||
import frc.lib.MotionProfileCalculator; | ||
|
||
/** Constants for the arm subsystem. */ | ||
public class ArmConstants { | ||
|
||
/** Constants for the shoulder motor. */ | ||
public static class ShoulderMotorConstants { | ||
/** Maximum voltage that can be applied to the shoulder motor. */ | ||
public static final double MAXIMUM_VOLTAGE = 2.0; | ||
public static final CAN CAN = new CAN(32); | ||
|
||
/** Gearing between the soulder motor and the shoulder joint. */ | ||
public static final double GEARING = 51.2; | ||
|
||
/** Moment of intertia of the shoulder, in kilograms meters squared. */ | ||
public static final double MOI = 0.15093; | ||
|
||
/** Minumum angle of the shoulder joint. */ | ||
public static final Rotation2d MINIMUM_ANGLE = Rotation2d.fromDegrees(20); | ||
|
||
/** Maximum angle of the shoulder joint. */ | ||
public static final Rotation2d MAXIMUM_ANGLE = Rotation2d.fromDegrees(90); | ||
|
||
/** Shoulder pivot to elbow pivot distance in meters. */ | ||
public static final double SHOULDER_TO_ELBOW_DISTANCE = Units.inchesToMeters(16.775); | ||
|
||
/** Proportional gain in volts per rotation. */ | ||
public static final double KP = 36.0; | ||
|
||
/** Maximum speed of the shoulder joint in rotations per second. */ | ||
public static final double MAXIMUM_SPEED = 1.5; | ||
|
||
/** Maximum acceleration of the shoulder joint in rotations per second per second. */ | ||
public static final double MAXIMUM_ACCELERATION = | ||
MotionProfileCalculator.calculateAcceleration(MAXIMUM_SPEED, 0.3); | ||
} | ||
|
||
/** Constants for the elbow motor. */ | ||
public static class ElbowMotorConstants { | ||
/** Maximum voltage that can be applied to the elbow motor. */ | ||
public static final double MAXIMUM_VOLTAGE = 2.0; | ||
|
||
/** Elbow pivot to wrist pivot distance in meters. */ | ||
public static final double ELBOW_TO_WRIST_DISTANCE = Units.inchesToMeters(16.825); | ||
} | ||
} |
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
Oops, something went wrong.