From ade2ce7bfb4a25b4292849cfd366719be616aad1 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sat, 17 Jan 2015 10:34:08 -0500 Subject: [PATCH] Added drivetrain code --- src/Subsystems/Drivetrain.cpp | 11 +++++++++++ src/Subsystems/Drivetrain.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/Subsystems/Drivetrain.cpp b/src/Subsystems/Drivetrain.cpp index a99eb15..c152a4a 100644 --- a/src/Subsystems/Drivetrain.cpp +++ b/src/Subsystems/Drivetrain.cpp @@ -2,6 +2,17 @@ #include "../RobotMap.h" Drivetrain::Drivetrain() : Subsystem("Drivetrain") { + frontLeft=new Talon(0); + frontRight=new Talon(1); + backLeft=new Talon(2); + backRight=new Talon(3); + drive=new RobotDrive(frontLeft, frontRight, backLeft, backRight); } void Drivetrain::InitDefaultCommand() { } +void Drivetrain::DriveMecanum(float x, float y, float rotation){ + drive->MecanumDrive_Cartesian(x, y, rotation); +} +void Drivetrain::DriveArcade(float x, float y){ + drive->ArcadeDrive(x, y); +} diff --git a/src/Subsystems/Drivetrain.h b/src/Subsystems/Drivetrain.h index 1e5e039..84274b1 100644 --- a/src/Subsystems/Drivetrain.h +++ b/src/Subsystems/Drivetrain.h @@ -5,8 +5,12 @@ class Drivetrain: public Subsystem { private: + Talon *frontLeft, *frontRight, *backLeft, *backRight; + RobotDrive *drive; public: Drivetrain(); void InitDefaultCommand(); + void DriveMecanum(float, float, float); + void DriveArcade(float, float); }; #endif