This repository was archived by the owner on Nov 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
arm #20
Open
stavit456
wants to merge
13
commits into
master
Choose a base branch
from
Arm
base: master
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
arm #20
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b2721b0
I built Arm system and action.
stavit456 21bd36e
I get the angle from the encoder.
stavit456 4b37fae
getAngle in Arm system is still constant.
stavit456 5fd61f8
I combined the 2 forward and backward methods into one method - move.
stavit456 5486492
I added encoder and static to all the constant.
stavit456 54c628e
I got the angle and built SystemFactory.
stavit456 37c82a1
I fixed the SystemFactory and put values in LIMIT and ERROR.
stavit456 a07652c
.
stavit456 493e846
Update the values in the RobotMap and turn the angle to be in degrees.
stavit456 e94e637
Fixed the SystemFactory.
stavit456 0a263a0
I added two new angles
stavit456 5c3e63f
I added the offset angle
stavit456 f08f531
I added range to the time of the angle
stavit456 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Build & Deploy Robot for Debugging" type="GradleRunConfiguration" factoryName="Gradle"> | ||
| <ExternalSystemSettings> | ||
| <option name="executionName" /> | ||
| <option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||
| <option name="externalSystemIdString" value="GRADLE" /> | ||
| <option name="scriptParameters" value="-PdebugMode=true" /> | ||
| <option name="taskDescriptions"> | ||
| <list /> | ||
| </option> | ||
| <option name="taskNames"> | ||
| <list> | ||
| <option value="deploy" /> | ||
| </list> | ||
| </option> | ||
| <option name="vmOptions" /> | ||
| </ExternalSystemSettings> | ||
| <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
| <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
| <DebugAllEnabled>false</DebugAllEnabled> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Build & Deploy Robot" 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="deploy" /> | ||
| </list> | ||
| </option> | ||
| <option name="vmOptions" /> | ||
| </ExternalSystemSettings> | ||
| <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
| <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
| <DebugAllEnabled>false</DebugAllEnabled> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Build Robot" 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="build" /> | ||
| </list> | ||
| </option> | ||
| <option name="vmOptions" /> | ||
| </ExternalSystemSettings> | ||
| <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
| <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
| <DebugAllEnabled>false</DebugAllEnabled> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Clean Build & Deploy Robot for Debugging" type="GradleRunConfiguration" factoryName="Gradle"> | ||
| <ExternalSystemSettings> | ||
| <option name="executionName" /> | ||
| <option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||
| <option name="externalSystemIdString" value="GRADLE" /> | ||
| <option name="scriptParameters" value="-PdebugMode=true" /> | ||
| <option name="taskDescriptions"> | ||
| <list /> | ||
| </option> | ||
| <option name="taskNames"> | ||
| <list> | ||
| <option value="clean" /> | ||
| <option value="deploy" /> | ||
| </list> | ||
| </option> | ||
| <option name="vmOptions" /> | ||
| </ExternalSystemSettings> | ||
| <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
| <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
| <DebugAllEnabled>false</DebugAllEnabled> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Clean Build & Deploy Robot" 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="deploy" /> | ||
| </list> | ||
| </option> | ||
| <option name="vmOptions" /> | ||
| </ExternalSystemSettings> | ||
| <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
| <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
| <DebugAllEnabled>false</DebugAllEnabled> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Clean Build Robot" 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="build" /> | ||
| </list> | ||
| </option> | ||
| <option name="vmOptions" /> | ||
| </ExternalSystemSettings> | ||
| <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
| <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
| <DebugAllEnabled>false</DebugAllEnabled> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Clean" 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" /> | ||
| </list> | ||
| </option> | ||
| <option name="vmOptions" /> | ||
| </ExternalSystemSettings> | ||
| <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
| <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
| <DebugAllEnabled>false</DebugAllEnabled> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Debug Robot via IP" type="Remote"> | ||
| <module name="Flash2024.main" /> | ||
| <option name="USE_SOCKET_TRANSPORT" value="true" /> | ||
| <option name="SERVER_MODE" value="false" /> | ||
| <option name="SHMEM_ADDRESS" value="javadebug" /> | ||
| <option name="HOST" value="10.33.88.2" /> | ||
| <option name="PORT" value="8349" /> | ||
| <option name="AUTO_RESTART" value="false" /> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="Debug Robot via USB" type="Remote"> | ||
| <module name="Flash2024.main" /> | ||
| <option name="USE_SOCKET_TRANSPORT" value="true" /> | ||
| <option name="SERVER_MODE" value="false" /> | ||
| <option name="SHMEM_ADDRESS" value="javadebug" /> | ||
| <option name="HOST" value="172.22.11.2" /> | ||
| <option name="PORT" value="8349" /> | ||
| <option name="AUTO_RESTART" value="false" /> | ||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,11 +3,15 @@ | |
| import com.flash3388.flashlib.frc.robot.FrcRobotControl; | ||
| import com.flash3388.flashlib.frc.robot.base.iterative.DelegatingFrcRobotControl; | ||
| import com.flash3388.flashlib.frc.robot.base.iterative.IterativeFrcRobot; | ||
| import frc.robot.subSystems.Arm; | ||
|
|
||
| public class Robot extends DelegatingFrcRobotControl implements IterativeFrcRobot { | ||
|
|
||
| private Arm arm; | ||
| public Robot(FrcRobotControl robotControl) { | ||
|
|
||
| super(robotControl); | ||
| arm = SystemFactory.createArm(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great |
||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -27,7 +31,7 @@ public void teleopInit() { | |
|
|
||
| @Override | ||
| public void teleopPeriodic() { | ||
|
|
||
| arm.print(); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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 |
|---|---|---|
| @@ -1,4 +1,10 @@ | ||
| package frc.robot; | ||
|
|
||
| import com.flash3388.flashlib.frc.robot.RoboRio; | ||
| import com.flash3388.flashlib.hid.HidChannel; | ||
|
|
||
| public class RobotMap { | ||
| public static final int ARM_MASTER = 15; | ||
| public static final int ARM_FOLLOW = 16; | ||
| public static final int ARM_ENCODER = 9; | ||
| } |
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,15 @@ | ||
| package frc.robot; | ||
|
|
||
| import com.revrobotics.CANSparkMax; | ||
| import com.revrobotics.CANSparkMaxLowLevel; | ||
| import edu.wpi.first.wpilibj.DutyCycleEncoder; | ||
| import frc.robot.subSystems.Arm; | ||
|
|
||
| public class SystemFactory { | ||
| public static Arm createArm(){ | ||
| CANSparkMax master = new CANSparkMax(RobotMap.ARM_MASTER, CANSparkMaxLowLevel.MotorType.kBrushless); | ||
| CANSparkMax follow = new CANSparkMax(RobotMap.ARM_FOLLOW, CANSparkMaxLowLevel.MotorType.kBrushless); | ||
| DutyCycleEncoder encoder = new DutyCycleEncoder(RobotMap.ARM_ENCODER); | ||
| return new Arm(encoder.getAbsolutePosition(), master, follow, encoder); | ||
| } | ||
| } |
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,70 @@ | ||
| package frc.robot.actions; | ||
|
|
||
| import com.flash3388.flashlib.robot.RunningRobot; | ||
| import com.flash3388.flashlib.scheduling.ActionControl; | ||
| import com.flash3388.flashlib.scheduling.FinishReason; | ||
| import com.flash3388.flashlib.scheduling.actions.ActionBase; | ||
| import com.flash3388.flashlib.time.Clock; | ||
| import com.flash3388.flashlib.time.Time; | ||
| import com.jmath.ExtendedMath; | ||
| import frc.robot.subSystems.Arm; | ||
|
|
||
|
|
||
| public class SetAngle extends ActionBase { | ||
|
|
||
| private Arm arm; | ||
| private boolean high; | ||
| private boolean low; | ||
| private static final double ALLOWED_ERROR = 2; | ||
| private static final double TIME = 1; | ||
| private Clock clock; | ||
| private Time time; | ||
| public SetAngle(Arm arm, boolean high, boolean low){ //high true | ||
| this.arm = arm; | ||
| this.high = true; | ||
| this.low = false; | ||
|
|
||
| this.clock = RunningRobot.getControl().getClock(); | ||
|
|
||
| requires(arm); | ||
| } | ||
|
|
||
| @Override | ||
| public void initialize(ActionControl control) { | ||
| arm.pidReset(); | ||
| arm.angleReset(); | ||
| } | ||
|
|
||
| @Override | ||
| public void execute(ActionControl control) { | ||
| if(high){ | ||
| arm.moveHigh(); | ||
| } | ||
| else{ | ||
| arm.moveLow(); | ||
| } | ||
|
|
||
|
|
||
| if(inRange()){ | ||
| if(time.isValid()){ | ||
| time.before(clock.currentTime()); | ||
| } | ||
| else{ | ||
| time = clock.currentTime().add(Time.seconds(TIME)); | ||
| } | ||
| } | ||
| else{ | ||
| time = Time.INVALID; | ||
| } | ||
| control.finish(); | ||
| } | ||
|
|
||
| public boolean inRange(){ | ||
| return ExtendedMath.constrained(arm.getAngle2Target(),-ALLOWED_ERROR, ALLOWED_ERROR); | ||
| } | ||
|
|
||
| @Override | ||
| public void end(FinishReason reason) { | ||
| arm.slow(); | ||
| } | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh those files again.
@Maayan-Luzon
@NoamZW
Remember what I told you about how to fix this?