Skip to content
Draft
Show file tree
Hide file tree
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 Jul 1, 2026
477fa01
some intro on the drivetrain
Spaceman113138 Jul 4, 2026
fe69253
motor config
Spaceman113138 Jul 5, 2026
9fa7204
some motor control stuff
Spaceman113138 Jul 1, 2026
8fed7ed
some intro on the drivetrain
Spaceman113138 Jul 4, 2026
00743e3
motor config
Spaceman113138 Jul 5, 2026
efa9218
Merge branch 'stage-1a-curriculum' of https://github.com/Spaceman1131…
Spaceman113138 Jul 30, 2026
5e9d262
Merge branch 'frcsoftware:main' into stage-1a-curriculum
Spaceman113138 Jul 30, 2026
643d5f0
reorg
Spaceman113138 Jul 30, 2026
f9035cc
reorg part 2
Spaceman113138 Jul 30, 2026
cd29d7a
reorg part 3
Spaceman113138 Jul 30, 2026
13caf14
improve writing
Spaceman113138 Jul 30, 2026
416682c
apply suggestions
Spaceman113138 Jul 30, 2026
c424bb3
formating
Spaceman113138 Jul 30, 2026
cd6cd01
Clear up some stuff
Spaceman113138 Jul 31, 2026
2880d96
clear up things + danger message
Spaceman113138 Jul 31, 2026
c7fc87c
DifferentialDrive creation
Spaceman113138 Aug 1, 2026
4d2fb27
grammerFix
Spaceman113138 Aug 1, 2026
f56cc0b
Merge branch 'stage-1a-curriculum' of https://github.com/Spaceman1131…
Spaceman113138 Aug 1, 2026
4cd30c4
tryingToCommitChanges
Spaceman113138 Aug 1, 2026
3cdcb06
IMU and CheckUp
Spaceman113138 Aug 2, 2026
5a45160
Drivetrain Sim Code
Spaceman113138 Aug 3, 2026
416410c
Merge branch 'frcsoftware:main' into stage-1a-curriculum
Spaceman113138 Aug 3, 2026
50e78e8
fix drivetrain sim page
Spaceman113138 Aug 3, 2026
8e92e3d
Merge branch 'frcsoftware:main' into stage-1a-curriculum
Spaceman113138 Aug 3, 2026
92fd0dd
Teleop Opmode
Spaceman113138 Aug 3, 2026
2a9630b
Merge branch 'stage-1a-curriculum' of https://github.com/Spaceman1131…
Spaceman113138 Aug 3, 2026
04dfc33
Fix my silly mistakes
Spaceman113138 Aug 3, 2026
786020d
Tutorial to Sim GUI and Ascope
Spaceman113138 Aug 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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
Expand All @@ -27,47 +28,75 @@
*/
public class Robot extends OpModeRobot {

// [DriveMotorsLeft]
private final int leftLeaderID = 0;
public TalonFX leftLeader = new TalonFX(leftLeaderID, CANBus.systemcore(0));
private TalonFX leftFollower = new TalonFX(1, CANBus.systemcore(0));
// [/DriveMotorsLeft]

// [DriveMotorsRight]
private final int rightLeaderID = 2;
public TalonFX rightLeader = new TalonFX(rightLeaderID, CANBus.systemcore(0));
private TalonFX rightFollower = new TalonFX(3, CANBus.systemcore(0));
// [/DriveMotorsRight]

Copy link
Copy Markdown
Member

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


public TalonFX intakeLauncher = new TalonFX(4, CANBus.systemcore(0));
public TalonFX feeder = new TalonFX(5, CANBus.systemcore(0));

private OnboardIMU imu = new OnboardIMU(MountOrientation.FLAT);

// [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 TalonFX intakeLauncher = new TalonFX(4, CANBus.systemcore(0));
public TalonFX feeder = new TalonFX(5, CANBus.systemcore(0));

private SingleFlywheelSim intakeLauncherSim =
new SingleFlywheelSim(intakeLauncher, "intakeLauncher");
private SingleFlywheelSim feederSim = new SingleFlywheelSim(feeder, "feeder");

// [AllConfigs]
/**
* This function is run when the robot is first started up and should be used for any
* initialization code.
*/
public Robot() {
// [MotorConfigCreationLeft]
var leftConfig = new TalonFXConfiguration();
// [/MotorConfigCreationLeft]
// [MotorConfigSetLeft]
leftConfig.MotorOutput.withInverted(InvertedValue.Clockwise_Positive);
// [/MotorConfigSetLeft]
// [MotorConfigLeft]
leftLeader.getConfigurator().apply(leftConfig);
leftFollower.getConfigurator().apply(leftConfig);

leftFollower.setControl(new Follower(leftLeaderID, MotorAlignmentValue.Aligned));
// [/MotorConfigLeft]

// [MotorConfig]
var rightConfig = new TalonFXConfiguration();
rightConfig.MotorOutput.withInverted(InvertedValue.CounterClockwise_Positive);
rightLeader.getConfigurator().apply(rightConfig);
rightFollower.getConfigurator().apply(leftConfig);

leftFollower.setControl(new Follower(leftLeaderID, MotorAlignmentValue.Aligned));
rightFollower.setControl(new Follower(rightLeaderID, MotorAlignmentValue.Aligned));
// [/MotorConfig]
}

// [/AllConfigs]

// [DriveSimPeriodic]
@Override
public void simulationPeriodic() {
drivetrainSim.periodic();
// [/DriveSimPeriodic]
intakeLauncherSim.periodic();
feederSim.periodic();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@
@Teleop
public class MyTeleop extends PeriodicOpMode {
private final Robot robot;
// [Controller]
private final NiDsXboxController xboxController = new NiDsXboxController(0);

// [/Controller]

/** The Robot instance is passed into the opmode via the constructor. */
public MyTeleop(Robot robot) {
this.robot = robot;
}

// [DriveSimPeriodic]
@Override
public void periodic() {
/* Called periodically (set time interval) while the robot is enabled. */
robot.drivetrain.arcadeDrive(-xboxController.getLeftY(), xboxController.getRightX());
// [/DriveSimPeriodic]

if (xboxController.getRightBumperButton()) {
// shoot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Member

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

// [/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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
@Teleop
public class MyTeleop extends PeriodicOpMode {
private final Robot robot;
// [Controller]
private final NiDsXboxController xboxController = new NiDsXboxController(0);

// [/Controller]

public MyTeleop(Robot robot) {
this.robot = robot;
}

// [DriveSimPeriodic]
@Override
public void periodic() {
robot.drivetrain.arcadeDrive(-xboxController.getLeftY(), xboxController.getRightX());
// [/DriveSimPeriodic]

if (xboxController.getRightBumperButton()) {
// shoot
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.
8 changes: 8 additions & 0 deletions src/config/sidebarConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ export const sidebarSections: Record<string, SidebarSection[]> = {
label: 'Stage 1A Introduction',
slug: 'learning-course/stage1/stage1a/stage-overview',
},
{
label: 'Kitbot Drivetrain',
slug: 'learning-course/stage1/stage1a/kitbot-drivetrain',
},
{
label: 'Stage 1A Drivetrain Simulation',
slug: 'learning-course/stage1/stage1a/drivetrain-sim',
},
// {
// label: 'TBD',
// slug: 'stage-1a-commands/the-command-body',
Expand Down
Loading