mirror of
https://github.com/Team4388/Robot-Essentials.git
synced 2026-06-09 08:48:02 -06:00
Implement Drive Code
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ plugins {
|
|||||||
id "edu.wpi.first.GradleRIO" version "2019.1.1"
|
id "edu.wpi.first.GradleRIO" version "2019.1.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
def ROBOT_MAIN_CLASS = "frc.robot.Main"
|
def ROBOT_MAIN_CLASS = "frc4388.robot.Main"
|
||||||
|
|
||||||
// Define my targets (RoboRIO) and artifacts (deployable files)
|
// Define my targets (RoboRIO) and artifacts (deployable files)
|
||||||
// This is added by GradleRIO's backing project EmbeddedTools.
|
// This is added by GradleRIO's backing project EmbeddedTools.
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import edu.wpi.first.wpilibj.command.Scheduler;
|
|||||||
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
import frc4388.robot.commands.ExampleCommand;
|
import frc4388.robot.commands.ExampleCommand;
|
||||||
|
import frc4388.robot.subsystems.Drive;
|
||||||
import frc4388.robot.subsystems.ExampleSubsystem;
|
import frc4388.robot.subsystems.ExampleSubsystem;
|
||||||
import frc4388.robot.subsystems.LED;
|
import frc4388.robot.subsystems.LED;
|
||||||
import frc4388.utility.controller.XboxController;
|
import frc4388.utility.controller.XboxController;
|
||||||
@@ -27,6 +28,7 @@ import frc4388.utility.controller.XboxController;
|
|||||||
public class Robot extends TimedRobot {
|
public class Robot extends TimedRobot {
|
||||||
public static ExampleSubsystem m_subsystem = new ExampleSubsystem();
|
public static ExampleSubsystem m_subsystem = new ExampleSubsystem();
|
||||||
public static LED m_led = new LED();
|
public static LED m_led = new LED();
|
||||||
|
public static Drive m_Drive = new Drive();
|
||||||
public static OI m_oi;
|
public static OI m_oi;
|
||||||
|
|
||||||
Command m_autonomousCommand;
|
Command m_autonomousCommand;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import edu.wpi.first.wpilibj.Talon;
|
|||||||
import edu.wpi.first.wpilibj.command.Subsystem;
|
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||||
import frc4388.robot.RobotMap;
|
import frc4388.robot.RobotMap;
|
||||||
|
import frc4388.robot.OI;
|
||||||
import frc4388.robot.Robot;
|
import frc4388.robot.Robot;
|
||||||
import frc4388.utility.controller.XboxController;
|
import frc4388.utility.controller.XboxController;
|
||||||
|
|
||||||
@@ -27,12 +28,14 @@ public class Drive extends Subsystem {
|
|||||||
// Put methods for controlling this subsystem
|
// Put methods for controlling this subsystem
|
||||||
// here. Call these from Commands.
|
// here. Call these from Commands.
|
||||||
|
|
||||||
WPI_TalonSRX m_leftFrontMotor = new WPI_TalonSRX(RobotMap.DRIVE_LEFT_FRONT_CAN_ID);
|
public static WPI_TalonSRX m_leftFrontMotor = new WPI_TalonSRX(RobotMap.DRIVE_LEFT_FRONT_CAN_ID);
|
||||||
WPI_TalonSRX m_rightFrontMotor = new WPI_TalonSRX(RobotMap.DRIVE_RIGHT_FRONT_CAN_ID);
|
public static WPI_TalonSRX m_rightFrontMotor = new WPI_TalonSRX(RobotMap.DRIVE_RIGHT_FRONT_CAN_ID);
|
||||||
WPI_TalonSRX m_leftBackMotor = new WPI_TalonSRX(RobotMap.DRIVE_LEFT_BACK_CAN_ID);
|
public static WPI_TalonSRX m_leftBackMotor = new WPI_TalonSRX(RobotMap.DRIVE_LEFT_BACK_CAN_ID);
|
||||||
WPI_TalonSRX m_rightBackMotor = new WPI_TalonSRX(RobotMap.DRIVE_RIGHT_BACK_CAN_ID);
|
public static WPI_TalonSRX m_rightBackMotor = new WPI_TalonSRX(RobotMap.DRIVE_RIGHT_BACK_CAN_ID);
|
||||||
|
|
||||||
DifferentialDrive m_driveTrain = new DifferentialDrive(m_leftFrontMotor, m_rightFrontMotor);
|
public static DifferentialDrive m_driveTrain = new DifferentialDrive(m_leftFrontMotor, m_rightFrontMotor);
|
||||||
|
|
||||||
|
private static double m_inputMove, m_inputSteer;
|
||||||
|
|
||||||
public Drive(){
|
public Drive(){
|
||||||
/* factory default values */
|
/* factory default values */
|
||||||
@@ -60,6 +63,10 @@ public class Drive extends Subsystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic() {
|
||||||
|
m_inputMove = OI.getInstance().getDriverController().getLeftYAxis();
|
||||||
|
m_inputSteer = -(OI.getInstance().getDriverController().getRightXAxis());
|
||||||
|
|
||||||
|
m_driveTrain.arcadeDrive(m_inputMove, m_inputSteer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user