-
Notifications
You must be signed in to change notification settings - Fork 22
Stage 1a curriculum Kitbot Drivetrain #153
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
Draft
Spaceman113138
wants to merge
29
commits into
frcsoftware:main
Choose a base branch
from
Spaceman113138:stage-1a-curriculum
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.
+625
−17
Draft
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f2a31f7
some motor control stuff
Spaceman113138 477fa01
some intro on the drivetrain
Spaceman113138 fe69253
motor config
Spaceman113138 9fa7204
some motor control stuff
Spaceman113138 8fed7ed
some intro on the drivetrain
Spaceman113138 00743e3
motor config
Spaceman113138 efa9218
Merge branch 'stage-1a-curriculum' of https://github.com/Spaceman1131…
Spaceman113138 5e9d262
Merge branch 'frcsoftware:main' into stage-1a-curriculum
Spaceman113138 643d5f0
reorg
Spaceman113138 f9035cc
reorg part 2
Spaceman113138 cd29d7a
reorg part 3
Spaceman113138 13caf14
improve writing
Spaceman113138 416682c
apply suggestions
Spaceman113138 c424bb3
formating
Spaceman113138 cd6cd01
Clear up some stuff
Spaceman113138 2880d96
clear up things + danger message
Spaceman113138 c7fc87c
DifferentialDrive creation
Spaceman113138 4d2fb27
grammerFix
Spaceman113138 f56cc0b
Merge branch 'stage-1a-curriculum' of https://github.com/Spaceman1131…
Spaceman113138 4cd30c4
tryingToCommitChanges
Spaceman113138 3cdcb06
IMU and CheckUp
Spaceman113138 5a45160
Drivetrain Sim Code
Spaceman113138 416410c
Merge branch 'frcsoftware:main' into stage-1a-curriculum
Spaceman113138 50e78e8
fix drivetrain sim page
Spaceman113138 8e92e3d
Merge branch 'frcsoftware:main' into stage-1a-curriculum
Spaceman113138 92fd0dd
Teleop Opmode
Spaceman113138 2a9630b
Merge branch 'stage-1a-curriculum' of https://github.com/Spaceman1131…
Spaceman113138 04dfc33
Fix my silly mistakes
Spaceman113138 786020d
Tutorial to Sim GUI and Ascope
Spaceman113138 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 |
|---|---|---|
|
|
@@ -17,48 +17,86 @@ | |
| import org.wpilib.hardware.imu.OnboardIMU; | ||
| import org.wpilib.hardware.imu.OnboardIMU.MountOrientation; | ||
|
|
||
| // [RobotTop] | ||
| /** | ||
| * The methods in this class are called automatically as described in the OpModeRobot documentation. | ||
| * OpMode classes anywhere in the package (or sub-packages) where this class is located are | ||
| * automatically registered to display in the Driver Station. If you change the name of this class | ||
| * or the package after creating this project, you must also update the Main.java file in the | ||
| * project. | ||
| */ | ||
| public class Robot extends OpModeRobot { | ||
|
|
||
| // [DriveMotorsLeft] | ||
| private SparkMax leftLeader = new SparkMax(0, 0, MotorType.kBrushless); | ||
| private SparkMax leftFollower = new SparkMax(0, 1, MotorType.kBrushless); | ||
| // [/DriveMotorsLeft] | ||
| // [DriveMotorsRight] | ||
| private SparkMax rightLeader = new SparkMax(0, 2, MotorType.kBrushless); | ||
| private SparkMax rightFollower = new SparkMax(0, 3, MotorType.kBrushless); | ||
|
Comment on lines
+34
to
36
Member
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. I think putting comments for each line could be helpful for when the students try to figure out the code on their own |
||
| // [/DriveMotorsRight] | ||
|
|
||
| // [DrivetrainInstance] | ||
| public final DifferentialDrive drivetrain = | ||
| new DifferentialDrive(leftLeader::setThrottle, rightLeader::setThrottle); | ||
| // [/DrivetrainInstance] | ||
|
|
||
| // [IMU] | ||
| private OnboardIMU imu = new OnboardIMU(MountOrientation.FLAT); | ||
| // [/IMU] | ||
| // [/RobotTop] | ||
|
|
||
| // [DrivetrainSim] | ||
| private DrivetrainSim drivetrainSim = new DrivetrainSim(leftLeader, rightLeader); | ||
| // [/DrivetrainSim] | ||
|
|
||
| public SparkMax intakeLauncher = new SparkMax(0, 4, MotorType.kBrushless); | ||
| public SparkMax feeder = new SparkMax(0, 5, MotorType.kBrushless); | ||
|
|
||
| private SingleFlywheelSim intakeLauncherSim = | ||
| new SingleFlywheelSim(intakeLauncher, "IntakeLauncher"); | ||
| private SingleFlywheelSim feederSim = new SingleFlywheelSim(feeder, "Feeder"); | ||
|
|
||
| public final DifferentialDrive drivetrain = | ||
| new DifferentialDrive(leftLeader::setThrottle, rightLeader::setThrottle); | ||
|
|
||
| // [AllConfigs] | ||
| /** | ||
| * This function is run when the robot is first started up and should be used for any | ||
| * initialization code. | ||
| */ | ||
| public Robot() { | ||
|
|
||
| var leftConfig = new SparkMaxConfig().inverted(true); | ||
| // [MotorConfigCreationLeft] | ||
| var leftConfig = new SparkMaxConfig(); | ||
| // [/MotorConfigCreationLeft] | ||
| // [MotorConfigSetLeft] | ||
| leftConfig.inverted(true); | ||
| // [/MotorConfigSetLeft] | ||
| // [MotorConfigLeft] | ||
| leftLeader.configure( | ||
| leftConfig, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters); | ||
| leftFollower.configure( | ||
| leftConfig.follow(leftLeader), | ||
| ResetMode.kResetSafeParameters, | ||
| PersistMode.kPersistParameters); | ||
| // [/MotorConfigLeft] | ||
|
|
||
| var rightConfig = new SparkMaxConfig().inverted(false); | ||
| // [MotorConfig] | ||
| var rightConfig = new SparkMaxConfig(); | ||
| rightConfig.inverted(false); | ||
| rightLeader.configure( | ||
| rightConfig, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters); | ||
| rightFollower.configure( | ||
| rightConfig.follow(rightLeader), | ||
| ResetMode.kResetSafeParameters, | ||
| PersistMode.kPersistParameters); | ||
| // [/MotorConfig] | ||
| } | ||
|
|
||
| // [/AllConfigs] | ||
|
|
||
| // [DriveSimPeriodic] | ||
| @Override | ||
| public void simulationPeriodic() { | ||
| drivetrainSim.periodic(); | ||
| // [/DriveSimPeriodic] | ||
| intakeLauncherSim.periodic(); | ||
| feederSim.periodic(); | ||
| } | ||
|
|
||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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.
I think putting comments for each line could be helpful for when the students try to figure out the code on their own