-
Notifications
You must be signed in to change notification settings - Fork 0
Nahum #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Nummun14
wants to merge
212
commits into
main
Choose a base branch
from
arm-Nahum
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Nahum #5
Changes from all commits
Commits
Show all changes
212 commits
Select commit
Hold shift + click to select a range
63b0ccb
InitiatedCanSparkMotors
Nummun14 36c5c3c
added PIDControler
Nummun14 a833f5c
added TalonSRX
Nummun14 e74b59c
attempted to add cancoder
Nummun14 050897d
Made Can_Spark_Config
Nummun14 5826d79
removed ExtraNewLine
Nummun14 6546c54
fixed angle encoder config
Nummun14 d499b63
fixed enum
Nummun14 03a04c8
removed extra new lines
Nummun14 d3126b5
corrected type of canCOder
Nummun14 51ecd48
added follower motors
Nummun14 a5194f2
Made TalonSRX configuration
Nummun14 d0ab93e
made elevator encoder
Nummun14 77e39a0
removed redundent code
Nummun14 af0ec9c
corrected enum
Nummun14 d56fa7a
added canCoder config
Nummun14 9315c1d
corrected names
Nummun14 6d51eb6
corrected enum made code cleaner
Nummun14 8bffce3
added inverted to encoders
Nummun14 94c9ade
ctrl alt l
Nummun14 b132590
added offset to elevatorencoder
Nummun14 a86c2c3
fixed code acording to review
Nummun14 4d0c790
fixed coder acording to review
Nummun14 931356a
Updated acording to review
Nummun14 4e21034
fixed code acording to review
Nummun14 9d361c0
fixed code acording to review
Nummun14 e42415a
added motion profiles
Nummun14 6bd97e8
Update ArmConstants.java
Nummun14 9a83496
fixed Vcomp variable
Nummun14 8848dcd
removed extra import
Nummun14 b869fe6
fixed code acording to review
Nummun14 8f1ce72
removed extranewline
Nummun14 4930fce
removed extranewline
Nummun14 08ffebc
made arm a subsystem
Nummun14 4230bb5
made Angle motion profile
Nummun14 03d947d
added elevator motion profiles
Nummun14 62a2d12
added setTargetElevatorFromProfile
Nummun14 6886357
added getSetTargetCommand
Nummun14 1eb2d00
fixed coder acroding to review
Nummun14 17440b3
corrected angleVelocity method
Nummun14 40de5fb
changed elevator functions from Rotation2d to double
Nummun14 327af2a
fixed generateAngleMotorProfile
Nummun14 e55d720
fixed getAngleMotorVelocity
Nummun14 50918f4
fixed getVelocity functions
Nummun14 d14442b
fixed getElevatorMotorPositionRevolutions
Nummun14 39de4e7
changed generateElevatorMotorProfile param name
Nummun14 a011e7e
reformatted class
Nummun14 221bcc0
corrected generateElevatorMotorProfile
Nummun14 10e669c
corrected getSetElevatorTargetCommand
Nummun14 e033ede
corrected getSetTargetAngleCommand
Nummun14 2eeebdf
corrected getSetElevatorTargetCommand
Nummun14 6a75329
fixed name of getSetTargetElevatorPositionCommand
Nummun14 ab517b7
removed final from setTargetAngleFromProfile
Nummun14 48fb2b6
corrected name of param in generateElevatorMotorProfile
Nummun14 3cc49ad
changed name of setTargetElevatorPositionFromProfile
Nummun14 3592990
corrected getElevatorVelocityRevolutionsPerSecond
Nummun14 8aa85d2
changed name to getAngleMotorVelocityDegrees
Nummun14 bc258c3
fixed getElevatorVelocityRevolutionsPerSecond
Nummun14 61ea993
added feedforward to constants
Nummun14 6649fdc
added feedforward
Nummun14 f0dce60
added setMotorVoltage functions and removed whitespace
Nummun14 af21637
fixed calculateElevatorMotorOutput
Nummun14 9b307eb
removed redundent TrapezoidProfile.Constraints
Nummun14 7e37b95
added angle status signals to constants
Nummun14 c6b5259
corrected setMotorVoltage
Nummun14 6eb1d24
added getAngleEncoderPosition
Nummun14 0371855
added status signals
Nummun14 4fc05e8
corrected getAngleMotorVelocityDegreesPerSecond
Nummun14 ebf16c5
corrected calculateElevatorMotorOutput
Nummun14 68bbc14
Merge branch 'main' into arm-Nahum
Nummun14 bac71a7
cleaned up constants
Nummun14 026c66b
fixed calculateElevatorMotorOutput
Nummun14 4d80cbb
added setArmTarget
Nummun14 3bdded3
fixed setArmTarget
Nummun14 2f85546
corrected names, made unnecery methods private and remived else
Nummun14 f79e185
corrected names
Nummun14 c76ccba
corredted configureAngleEncoder
Nummun14 cc1efea
corrected getSetArmTarget
Nummun14 a38a846
corrected getSetArmTarget and updated names
Nummun14 15b2c85
corrected calculateElevatorMotorOutput
Nummun14 6b1d2a1
removed extra new line
Nummun14 1bac018
corrected names and logic
Nummun14 db6b373
corrected getSetArmTarget
Nummun14 e7e4c8c
removed andThen
Nummun14 9abeec7
reformatted and changed names
Nummun14 1c5db4e
recloned repository
Nummun14 bd23984
atempted to make DefferedCommand, but I'm defenetly wrong
Nummun14 efa9808
added DeferedCommands
Nummun14 6a4a3bb
added new line
Nummun14 36fcff8
reordered code
Nummun14 5f7ff70
corrected DefferedCommandLogic
Nummun14 bccb7da
renamed and reformatted
Nummun14 7cd766a
renamed and removed redundent code
Nummun14 890035b
added first command
Nummun14 5cd1987
fixed getCurrentSetTargetArmStateCommand
Nummun14 f0045be
reformatted
Nummun14 6d4be9d
atemted to add other commands
Nummun14 e105509
fixed names and reformated
Nummun14 6384a1c
fixed constraints logic
Nummun14 d9395e3
made speedPercentage simpler
Nummun14 987cbc9
reorgenized code
Nummun14 0e79dc2
updated names
Nummun14 5cbe2a3
added javadocs
Nummun14 cbd4daf
fixed javadocs
Nummun14 4fa9c89
fixed javadocs
Nummun14 07fa3d2
!!++==__ERROR--FIX--ERROR__==++!!
Nummun14 f907794
updated javadocs
Nummun14 fa3789f
removed extra new line
Nummun14 e029a41
added new line
Nummun14 5ac4606
fixed code
Nummun14 11c5d30
fixed====+-*$#*&%!
Nummun14 16e284b
added GETTTTTTTTTTTTTTTTTTTTTTTTTTT
Nummun14 7e732ad
תיקנתני (קיבלתי השראה מאזולאי
Nummun14 18b9313
תוקן *&%$#@!
Nummun14 592353a
Merge branch 'main' into arm-Nahum
Nummun14 1188b07
added Akit
Nummun14 cbd408c
added updateInputs
Nummun14 2d91362
made code cleaner
Nummun14 198462c
started arm Akit
Nummun14 62fbe0d
removed redundent config
Nummun14 7a4c316
removed getters
Nummun14 d47d24e
added pid and ff to IOconstants
Nummun14 8401451
moved PID and ff to kablamaArmConstants
Nummun14 97354e7
added setTargetAngle and setTargetElevatorPosition
Nummun14 e7ef4b6
cleaned up code
Nummun14 4561f53
corrected names
Nummun14 ac72e38
__==Cleaned up code==__
Nummun14 0c81176
extracted code into functions
Nummun14 583a8f5
reordered code
Nummun14 3ec284c
optimized imports
Nummun14 7b35232
attempted to add simulation
Nummun14 b51537d
attempted to add ElevatorSim and SingleJointedArmSim
Nummun14 607ecaf
made dcMotorSim
Nummun14 4e40e1d
implemented DCMotorSim
Nummun14 a2d9475
fixed code acording to review
Nummun14 fdbc558
updated names
Nummun14 cfd1b39
added arm simulation constants
Nummun14 c054fdd
made SimulationArmIOMotors
Nummun14 ae088e1
added set voltage functions
Nummun14 411f606
fixed most of review
Nummun14 106b4dc
added calulate functions
Nummun14 a8edef9
added inputs
Nummun14 5f4dd56
reformatted
Nummun14 def5f73
finished inputs
Nummun14 9a09dd0
corrected angle_radians
Nummun14 7f5d318
fixed inputs
Nummun14 fbba8f4
updated names and elevatorPosition logic
Nummun14 c469f96
removed extra new lines
Nummun14 30a569e
removed extra new line
Nummun14 5ae7575
corrected variable names
Nummun14 29efec5
corrected variable name
Nummun14 13daf8a
attempted to add Mechanism2d
Nummun14 62cea69
added mechanism2d and ran
Nummun14 57afd92
logged mechanism
Nummun14 4607436
moved commands to ArmCommands
Nummun14 f45789b
corrected requierments
Nummun14 8f63234
made commands static
Nummun14 65fda23
added mechanism2d to collector
Nummun14 c23f627
Delete networktables.json
levyishai 2c7e36f
removed mechanism from collector
Nummun14 1e4596e
Merge branch 'arm-Nahum' of https://github.com/Programming-TRIGON/Rob…
Nummun14 eefc55c
removed extra files
Nummun14 1beae0a
corrected startAdvantageKitLogging
Nummun14 9d6b464
changed TalonSRX to WPI_TalonSRX
Nummun14 5964480
corrected addition of mech2d
Nummun14 b4302dd
corrected names
Nummun14 c12dde8
fixed naming and reorginized
Nummun14 e8d8f43
fixed commandgroup logic
Nummun14 543c987
added values
Nummun14 189d1d1
attempted to add target position mechanism
Nummun14 dacece0
fixed target position ligment
Nummun14 f8e9004
corrected elevatorEncoder config
Nummun14 717c828
fixed tolerance
Nummun14 a1c327d
minor fixes
Nummun14 4d7c698
תוקן
Nummun14 992b0e4
fixed names and reorgenized
Nummun14 65eaeea
Merge branch 'main' into arm-Nahum
levyishai eb6491b
restored robot container and fixed pid
Nummun14 a5424f1
Merge branch 'arm-Nahum' of https://github.com/Programming-TRIGON/Rob…
Nummun14 e9b3b83
changed names
Nummun14 894124c
finished tweeking sim
Nummun14 e80a87e
optimized names and imports
Nummun14 1073dca
fninished armSim
Nummun14 02f9742
made turret constants
Nummun14 4d4ef64
added translation2d
Nummun14 0fb2d99
attempted to make Turret
Nummun14 b44a710
attempted calulation
Nummun14 ec1ae5a
corrected output calulation
Nummun14 12076c1
fixed names
Nummun14 eec4a60
corrected units
Nummun14 0556a93
added most of turretAkit
Nummun14 1cacd17
finished adding akit
Nummun14 2f3d308
corrected turret code logic
Nummun14 6414044
added pid usage
Nummun14 71edd73
fixed zArmRoot
Nummun14 c657737
fixed angle logic
Nummun14 a029de6
corrected mechanism, and turret names
Nummun14 b3d2c41
added simulation
Nummun14 4a04d4c
removed redundent constants
Nummun14 3c63367
corrected logic of calculateTargetAngle
Nummun14 6c62c82
corrected mechaism
Nummun14 12c6e1a
corrected names and tested
Nummun14 96cac05
minor fixes
Nummun14 a66c1a3
minor fixes
Nummun14 ec46d1c
added motion magic
Nummun14 e8c1573
added mech2d
Nummun14 318a7ea
added mechanism
Nummun14 c2612fe
attempted to fix mechanism
Nummun14 2f06d9f
fixed status signals
Nummun14 156f017
fixed robotContainer
Nummun14 1401436
minor fixes
Nummun14 5950370
tuned PID, and added runCommand
Nummun14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,24 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Build & Run Simulate Java" type="GradleRunConfiguration" factoryName="Gradle"> | ||
<ExternalSystemSettings> | ||
<option name="executionName" /> | ||
<option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||
<option name="externalSystemIdString" value="GRADLE" /> | ||
<option name="scriptParameters" /> | ||
<option name="taskDescriptions"> | ||
<list /> | ||
</option> | ||
<option name="taskNames"> | ||
<list> | ||
<option value="simulateJava" /> | ||
</list> | ||
</option> | ||
<option name="vmOptions" /> | ||
</ExternalSystemSettings> | ||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
<DebugAllEnabled>false</DebugAllEnabled> | ||
<ForceTestExec>false</ForceTestExec> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,25 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Clean Build & Run Simulate Java" type="GradleRunConfiguration" factoryName="Gradle"> | ||
<ExternalSystemSettings> | ||
<option name="executionName" /> | ||
<option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||
<option name="externalSystemIdString" value="GRADLE" /> | ||
<option name="scriptParameters" /> | ||
<option name="taskDescriptions"> | ||
<list /> | ||
</option> | ||
<option name="taskNames"> | ||
<list> | ||
<option value="clean" /> | ||
<option value="simulateJava" /> | ||
</list> | ||
</option> | ||
<option name="vmOptions" /> | ||
</ExternalSystemSettings> | ||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
<DebugAllEnabled>false</DebugAllEnabled> | ||
<ForceTestExec>false</ForceTestExec> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -21,4 +21,4 @@ public Command getAutonomousCommand() { | |
|
||
private void configureBindings() { | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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,101 @@ | ||
package frc.trigon.robot.subsystems.arm; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.math.trajectory.TrapezoidProfile; | ||
import edu.wpi.first.wpilibj.Timer; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import frc.trigon.robot.utilities.Conversions; | ||
import org.littletonrobotics.junction.Logger; | ||
|
||
public class Arm extends SubsystemBase { | ||
Nummun14 marked this conversation as resolved.
Show resolved
Hide resolved
Nummun14 marked this conversation as resolved.
Show resolved
Hide resolved
Nummun14 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private final static Arm INSTANCE = new Arm(); | ||
private final ArmIO armIO = ArmIO.generateIO(); | ||
private final ArmInputsAutoLogged armInputs = new ArmInputsAutoLogged(); | ||
private TrapezoidProfile | ||
angleMotorProfile = null, | ||
elevatorMotorProfile = null; | ||
private double | ||
lastAngleMotorProfileGenerationTime, | ||
lastElevatorMotorProfileGenerationTime; | ||
|
||
public static Arm getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
private Arm() { | ||
} | ||
|
||
@Override | ||
public void periodic() { | ||
armIO.updateInputs(armInputs); | ||
Logger.processInputs("Arm", armInputs); | ||
updateMechanism(); | ||
} | ||
|
||
boolean atAngle(Rotation2d targetAngle) { | ||
return Math.abs(armInputs.anglePositionDegrees - targetAngle.getDegrees()) <= ArmConstants.ANGLE_TOLERANCE_DEGREES; | ||
} | ||
|
||
boolean atTargetElevatorPosition(double targetElevatorPositionMeters) { | ||
return Math.abs(armInputs.elevatorPositionMeters - targetElevatorPositionMeters) <= ArmConstants.ELEVATOR_TOLERANCE_METERS; | ||
} | ||
|
||
boolean isElevatorOpening(double targetElevatorPositionMeters) { | ||
return armInputs.elevatorPositionMeters < targetElevatorPositionMeters; | ||
} | ||
|
||
void generateAngleMotorProfile(Rotation2d targetAngle, double speedPercentage) { | ||
angleMotorProfile = new TrapezoidProfile( | ||
Conversions.scaleConstraints(ArmConstants.ANGLE_CONSTRAINTS, speedPercentage), | ||
new TrapezoidProfile.State(targetAngle.getDegrees(), 0), | ||
new TrapezoidProfile.State(armInputs.anglePositionDegrees, armInputs.angleVelocityDegreesPerSecond) | ||
); | ||
|
||
lastAngleMotorProfileGenerationTime = Timer.getFPGATimestamp(); | ||
} | ||
|
||
void generateElevatorMotorProfile(double targetElevatorPositionMeters, double speedPercentage) { | ||
elevatorMotorProfile = new TrapezoidProfile( | ||
Conversions.scaleConstraints(ArmConstants.ELEVATOR_CONSTRAINTS, speedPercentage), | ||
new TrapezoidProfile.State(targetElevatorPositionMeters, 0), | ||
new TrapezoidProfile.State(armInputs.elevatorPositionMeters, armInputs.elevatorVelocityMetersPerSecond) | ||
); | ||
|
||
lastElevatorMotorProfileGenerationTime = Timer.getFPGATimestamp(); | ||
} | ||
|
||
void setTargetAngleFromProfile() { | ||
if (angleMotorProfile == null) { | ||
armIO.stopAngleMotors(); | ||
return; | ||
} | ||
|
||
TrapezoidProfile.State targetState = angleMotorProfile.calculate(getAngleMotorProfileTime()); | ||
ArmConstants.TARGET_POSITION_LIGAMENT.setAngle(targetState.position); | ||
armIO.setTargetAngleState(targetState); | ||
} | ||
|
||
void setTargetElevatorPositionFromProfile() { | ||
if (elevatorMotorProfile == null) { | ||
armIO.stopElevatorMotors(); | ||
return; | ||
} | ||
|
||
TrapezoidProfile.State targetState = elevatorMotorProfile.calculate(getElevatorMotorProfileTime()); | ||
ArmConstants.TARGET_POSITION_LIGAMENT.setLength(targetState.position + ArmConstants.RETRACTED_ARM_LENGTH_METERS); | ||
armIO.setTargetElevatorState(targetState); | ||
} | ||
|
||
private double getAngleMotorProfileTime() { | ||
return Timer.getFPGATimestamp() - lastAngleMotorProfileGenerationTime; | ||
} | ||
|
||
private double getElevatorMotorProfileTime() { | ||
return Timer.getFPGATimestamp() - lastElevatorMotorProfileGenerationTime; | ||
} | ||
private void updateMechanism() { | ||
ArmConstants.ARM_LIGAMENT.setLength(armInputs.elevatorPositionMeters + ArmConstants.RETRACTED_ARM_LENGTH_METERS); | ||
ArmConstants.ARM_LIGAMENT.setAngle(armInputs.anglePositionDegrees); | ||
Logger.recordOutput("ArmMechanism", ArmConstants.ARM_MECHANISM); | ||
Nummun14 marked this conversation as resolved.
Show resolved
Hide resolved
Nummun14 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.