Skip to content

Commit 2acb971

Browse files
committed
Updating kitbot tutorial for neos.
1 parent b2bd57d commit 2acb971

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

docs/programming/driving_robot.md

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,26 @@ Before we begin we must create the class file for the drivetrain subsystem. See
2323

2424
In the Drivetrain class we will tell the subsystem what type of components it will be using.
2525

26-
- A Drivetrain needs motor controllers. In our case we will use 4 Talon SRs (a brand of controller for motors).
27-
- You could use other motor controllers such as Victor SPs or Talon SRXs but we will be using Talon SRs
28-
- If you are using other motor controllers, replace Talon with TalonSRX, Victor, or VictorSP in the code you write depending on the type you use.
29-
- You can use 2 motors (left and right), but for this tutorial we will use 4.
26+
- A Drivetrain needs motor controllers. In our case we will use 4 SparkMax Neos (a brand of controller for motors made by Rev Robotics).
27+
- You could use other motor controllers such as Victor SPs or Talon SRXs but we will be using SparkMax Neos.
28+
- If you are using other motor controllers, replace SparkMax with TalonSRX, Victor, or VictorSP in the code you write depending on the type you use.
29+
- You can use 2 motors (left and right), but for this tutorial we will use 4 since that is what the base Kitbot uses.
3030

3131
!!! Tip
3232
Be sure to read [Visual Studio Code Tips](../basics/vscode_tips.md){target=_blank} before getting started! It will make your life a lot easier.
3333

34-
### Creating the Talon Variables
34+
### Creating the Motor Variables
3535

3636
!!! summary ""
37-
**1)** Create 4 global variables of data type **Talon** and name them: `leftFrontTalon`, `rightFrontTalon`, `leftBackTalon`, `rightBackTalon`
37+
**1)** At the top of the DriveTrainSubSystem class, create 4 global variables of data type **SparkMax** and name them: `leftLeader`, `rightLeader`, `leftFollower`, `rightFollower`
3838

39-
- To get started type the word Talon followed by the name i.e. `#!java Talon leftFrontTalon;`
40-
- These will eventually hold the object values for Talons and their port numbers.
39+
- To get started type private final SparkMax followed by the name i.e. `#!java private final SparkMax leftLeader;`
40+
- These are declared at private and final because they will not be used outside of the drivetrain class, and will not be changing once assigned.
41+
- These will eventually hold the object values for Neos and their port numbers.
4142

4243
!!! summary ""
43-
**2)** Next assign their values to `#!java null` ([more info on `null`](../basics/java_basics.md#overview){target=_blank}).
44+
<!--**2)** Next assign their values to `#!java null` ([more info on `null`](../basics/java_basics.md#overview){target=_blank}).-->
45+
**2)** These will not be Assigned values here.
4446

4547
- We do this to make sure it is empty at this point.
4648
- When we assign these variables a value, we will be getting the motor controller's port numbers out of Constants
@@ -51,10 +53,10 @@ In the Drivetrain class we will tell the subsystem what type of components it wi
5153
The code you typed should be this:
5254

5355
```java
54-
Talon leftFrontTalon = null;
55-
Talon leftBackTalon = null;
56-
Talon rightFrontTalon = null;
57-
Talon rightBackTalon = null;
56+
private final SparkMax leftLeader;
57+
private final SparkMax leftFollower;
58+
private final SparkMax rightLeader;
59+
private final SparkMax rightFollower;
5860
```
5961

6062
Your full **Drivetrain.java** should look like this:
@@ -68,14 +70,17 @@ In the Drivetrain class we will tell the subsystem what type of components it wi
6870
/**
6971
* Add your docs here.
7072
*/
71-
public class Drivetrain extends Subsystem {
72-
// Put methods for controlling this subsystem
73-
// here. Call these from Commands.
73+
public class CANDriveSubsystem extends SubsystemBase {
74+
private final SparkMax leftLeader;
75+
private final SparkMax leftLeader;
76+
private final SparkMax leftFollower;
77+
private final SparkMax rightLeader;
78+
private final SparkMax rightFollower;
7479

75-
Talon leftFrontTalon = null;
76-
Talon leftBackTalon = null;
77-
Talon rightFrontTalon = null;
78-
Talon rightBackTalon = null;
80+
81+
public CANDriveSubsystem() {
82+
83+
}
7984

8085
@Override
8186
public void periodic() {
@@ -86,11 +91,11 @@ In the Drivetrain class we will tell the subsystem what type of components it wi
8691
<!-- TODO: Generalize this more -->
8792

8893
??? fail "If an error occurs (red squiggles)"
89-
1. Click the word Talon
94+
1. Click the word SparkMax
9095
![](../assets/images/driving_robot/e1.png)
9196
2. 💡 Click the light bulb
9297
![](../assets/images/driving_robot/e2.png)
93-
3. Select "Import 'Talon' (edu.wpi.first.wpilibj)"
98+
3. Select "Import 'SparkMax' (edu.wpi.first.wpilibj)"
9499
![](../assets/images/driving_robot/e3.png)
95100
4. Your error should be gone!
96101

0 commit comments

Comments
 (0)