mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[examples] Rename DriveTrain classes to Drivetrain (#3594)
Drivetrain is one word, not two.
This commit is contained in:
@@ -15,7 +15,7 @@ import edu.wpi.first.wpilibj.examples.gearsbot.commands.SetElevatorSetpoint;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.commands.SetWristSetpoint;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.commands.TankDrive;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Claw;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.DriveTrain;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Drivetrain;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Elevator;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Wrist;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
@@ -31,7 +31,7 @@ import edu.wpi.first.wpilibj2.command.button.JoystickButton;
|
||||
*/
|
||||
public class RobotContainer {
|
||||
// The robot's subsystems and commands are defined here...
|
||||
private final DriveTrain m_drivetrain = new DriveTrain();
|
||||
private final Drivetrain m_drivetrain = new Drivetrain();
|
||||
private final Elevator m_elevator = new Elevator();
|
||||
private final Wrist m_wrist = new Wrist();
|
||||
private final Claw m_claw = new Claw();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.gearsbot.commands;
|
||||
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Claw;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.DriveTrain;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Drivetrain;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Elevator;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Wrist;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
@@ -13,7 +13,7 @@ import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
/** The main autonomous command to pickup and deliver the soda to the box. */
|
||||
public class Autonomous extends SequentialCommandGroup {
|
||||
/** Create a new autonomous command. */
|
||||
public Autonomous(DriveTrain drive, Claw claw, Wrist wrist, Elevator elevator) {
|
||||
public Autonomous(Drivetrain drive, Claw claw, Wrist wrist, Elevator elevator) {
|
||||
addCommands(
|
||||
new PrepareToPickup(claw, wrist, elevator),
|
||||
new Pickup(claw, wrist, elevator),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.gearsbot.commands;
|
||||
|
||||
import edu.wpi.first.math.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.DriveTrain;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Drivetrain;
|
||||
import edu.wpi.first.wpilibj2.command.PIDCommand;
|
||||
|
||||
/**
|
||||
@@ -14,14 +14,14 @@ import edu.wpi.first.wpilibj2.command.PIDCommand;
|
||||
* averaged values of the left and right encoders.
|
||||
*/
|
||||
public class DriveStraight extends PIDCommand {
|
||||
private final DriveTrain m_drivetrain;
|
||||
private final Drivetrain m_drivetrain;
|
||||
|
||||
/**
|
||||
* Create a new DriveStraight command.
|
||||
*
|
||||
* @param distance The distance to drive
|
||||
*/
|
||||
public DriveStraight(double distance, DriveTrain drivetrain) {
|
||||
public DriveStraight(double distance, Drivetrain drivetrain) {
|
||||
super(
|
||||
new PIDController(4, 0, 0), drivetrain::getDistance, distance, d -> drivetrain.drive(d, d));
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.gearsbot.commands;
|
||||
|
||||
import edu.wpi.first.math.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.DriveTrain;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Drivetrain;
|
||||
import edu.wpi.first.wpilibj2.command.PIDCommand;
|
||||
|
||||
/**
|
||||
@@ -14,14 +14,14 @@ import edu.wpi.first.wpilibj2.command.PIDCommand;
|
||||
* values of the left and right encoders.
|
||||
*/
|
||||
public class SetDistanceToBox extends PIDCommand {
|
||||
private final DriveTrain m_drivetrain;
|
||||
private final Drivetrain m_drivetrain;
|
||||
|
||||
/**
|
||||
* Create a new set distance to box command.
|
||||
*
|
||||
* @param distance The distance away from the box to drive to
|
||||
*/
|
||||
public SetDistanceToBox(double distance, DriveTrain drivetrain) {
|
||||
public SetDistanceToBox(double distance, Drivetrain drivetrain) {
|
||||
super(
|
||||
new PIDController(-2, 0, 0),
|
||||
drivetrain::getDistanceToObstacle,
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.gearsbot.commands;
|
||||
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.DriveTrain;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Drivetrain;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
/** Have the robot drive tank style. */
|
||||
public class TankDrive extends CommandBase {
|
||||
private final DriveTrain m_drivetrain;
|
||||
private final Drivetrain m_drivetrain;
|
||||
private final DoubleSupplier m_left;
|
||||
private final DoubleSupplier m_right;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class TankDrive extends CommandBase {
|
||||
* @param right The control input for the right sight of the drive
|
||||
* @param drivetrain The drivetrain subsystem to drive
|
||||
*/
|
||||
public TankDrive(DoubleSupplier left, DoubleSupplier right, DriveTrain drivetrain) {
|
||||
public TankDrive(DoubleSupplier left, DoubleSupplier right, Drivetrain drivetrain) {
|
||||
m_drivetrain = drivetrain;
|
||||
m_left = left;
|
||||
m_right = right;
|
||||
|
||||
@@ -15,9 +15,9 @@ import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class DriveTrain extends SubsystemBase {
|
||||
public class Drivetrain extends SubsystemBase {
|
||||
/**
|
||||
* The DriveTrain subsystem incorporates the sensors and actuators attached to the robots chassis.
|
||||
* The Drivetrain subsystem incorporates the sensors and actuators attached to the robots chassis.
|
||||
* These include four drive motors, a left and right encoder and a gyro.
|
||||
*/
|
||||
private final MotorController m_leftMotor =
|
||||
@@ -33,8 +33,8 @@ public class DriveTrain extends SubsystemBase {
|
||||
private final AnalogInput m_rangefinder = new AnalogInput(6);
|
||||
private final AnalogGyro m_gyro = new AnalogGyro(1);
|
||||
|
||||
/** Create a new drive train subsystem. */
|
||||
public DriveTrain() {
|
||||
/** Create a new drivetrain subsystem. */
|
||||
public Drivetrain() {
|
||||
super();
|
||||
|
||||
// We need to invert one side of the drivetrain so that positive voltages
|
||||
@@ -74,7 +74,7 @@ public class DriveTrain extends SubsystemBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tank style driving for the DriveTrain.
|
||||
* Tank style driving for the Drivetrain.
|
||||
*
|
||||
* @param left Speed in range [-1,1]
|
||||
* @param right Speed in range [-1,1]
|
||||
@@ -10,7 +10,7 @@ import edu.wpi.first.wpilibj.command.Scheduler;
|
||||
import edu.wpi.first.wpilibj.examples.pacgoat.commands.DriveAndShootAutonomous;
|
||||
import edu.wpi.first.wpilibj.examples.pacgoat.commands.DriveForward;
|
||||
import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Collector;
|
||||
import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.DriveTrain;
|
||||
import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Drivetrain;
|
||||
import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Pivot;
|
||||
import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Pneumatics;
|
||||
import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Shooter;
|
||||
@@ -30,7 +30,7 @@ public class Robot extends TimedRobot {
|
||||
public static OI oi;
|
||||
|
||||
// Initialize the subsystems
|
||||
public static DriveTrain drivetrain = new DriveTrain();
|
||||
public static Drivetrain drivetrain = new Drivetrain();
|
||||
public static Collector collector = new Collector();
|
||||
public static Shooter shooter = new Shooter();
|
||||
public static Pneumatics pneumatics = new Pneumatics();
|
||||
|
||||
@@ -17,10 +17,10 @@ import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup;
|
||||
import edu.wpi.first.wpilibj.motorcontrol.Victor;
|
||||
|
||||
/**
|
||||
* The DriveTrain subsystem controls the robot's chassis and reads in information about it's speed
|
||||
* The Drivetrain subsystem controls the robot's chassis and reads in information about it's speed
|
||||
* and position.
|
||||
*/
|
||||
public class DriveTrain extends Subsystem {
|
||||
public class Drivetrain extends Subsystem {
|
||||
// Subsystem devices
|
||||
private final MotorController m_frontLeftCIM = new Victor(1);
|
||||
private final MotorController m_frontRightCIM = new Victor(2);
|
||||
@@ -35,8 +35,8 @@ public class DriveTrain extends Subsystem {
|
||||
private final Encoder m_leftEncoder = new Encoder(3, 4, false, EncodingType.k4X);
|
||||
private final AnalogGyro m_gyro = new AnalogGyro(0);
|
||||
|
||||
/** Create a new drive train subsystem. */
|
||||
public DriveTrain() {
|
||||
/** Create a new drivetrain subsystem. */
|
||||
public Drivetrain() {
|
||||
// Configure drive motors
|
||||
addChild("Front Left CIM", (Victor) m_frontLeftCIM);
|
||||
addChild("Front Right CIM", (Victor) m_frontRightCIM);
|
||||
Reference in New Issue
Block a user