From 386e3532f82a4ab9e5bc6153c89f10ac0ac4f4af Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Mon, 12 Jan 2015 22:24:48 -0500 Subject: [PATCH 01/18] Updated for bitbucket --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index daab3dd..7dec88e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "src/hhlib"] path = src/hhlib - url = git@github.com:team2059/hhlib.git + url = git@bitbucket.com:hitchhikers2059/hhlib.git From e3e4429c9ac45db564cb0e8275a81fb94458707c Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Tue, 13 Jan 2015 11:07:06 -0500 Subject: [PATCH 02/18] Removed Debug directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5761abc..12a4c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.o +Debug From 51c25256959d27b2d3abc0d5b856aebe08e6c2f4 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Fri, 16 Jan 2015 19:53:25 -0500 Subject: [PATCH 03/18] Reverted back to github --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 7dec88e..daab3dd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "src/hhlib"] path = src/hhlib - url = git@bitbucket.com:hitchhikers2059/hhlib.git + url = git@github.com:team2059/hhlib.git From 369d572cfb22306b68fb2a61ebe89cd0b855ef70 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 25 Jan 2015 08:45:33 -0500 Subject: [PATCH 04/18] Removed src folder --- src/HHBase.cpp => HHBase.cpp | 0 src/HHBase.h => HHBase.h | 0 src/HHRobot.cpp => HHRobot.cpp | 0 src/HHRobot.h => HHRobot.h | 0 {src/classes => classes}/Collector.cpp | 0 {src/classes => classes}/Collector.h | 0 src/hhlib | 1 - 7 files changed, 1 deletion(-) rename src/HHBase.cpp => HHBase.cpp (100%) rename src/HHBase.h => HHBase.h (100%) rename src/HHRobot.cpp => HHRobot.cpp (100%) rename src/HHRobot.h => HHRobot.h (100%) rename {src/classes => classes}/Collector.cpp (100%) rename {src/classes => classes}/Collector.h (100%) delete mode 160000 src/hhlib diff --git a/src/HHBase.cpp b/HHBase.cpp similarity index 100% rename from src/HHBase.cpp rename to HHBase.cpp diff --git a/src/HHBase.h b/HHBase.h similarity index 100% rename from src/HHBase.h rename to HHBase.h diff --git a/src/HHRobot.cpp b/HHRobot.cpp similarity index 100% rename from src/HHRobot.cpp rename to HHRobot.cpp diff --git a/src/HHRobot.h b/HHRobot.h similarity index 100% rename from src/HHRobot.h rename to HHRobot.h diff --git a/src/classes/Collector.cpp b/classes/Collector.cpp similarity index 100% rename from src/classes/Collector.cpp rename to classes/Collector.cpp diff --git a/src/classes/Collector.h b/classes/Collector.h similarity index 100% rename from src/classes/Collector.h rename to classes/Collector.h diff --git a/src/hhlib b/src/hhlib deleted file mode 160000 index 38a965d..0000000 --- a/src/hhlib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 38a965dd1f7c6737f722f56c0f7940805ece9917 From 54eb368bc8d42793e1b874173539e15cb528b355 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 28 Jan 2015 18:53:06 -0500 Subject: [PATCH 05/18] Fixed hhlib --- .gitmodules | 6 +++--- hhlib | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) create mode 160000 hhlib diff --git a/.gitmodules b/.gitmodules index daab3dd..f585686 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "src/hhlib"] - path = src/hhlib - url = git@github.com:team2059/hhlib.git +[submodule "hhlib"] + path = hhlib + url = git@github.com:team2059/hhlib.git diff --git a/hhlib b/hhlib new file mode 160000 index 0000000..787733b --- /dev/null +++ b/hhlib @@ -0,0 +1 @@ +Subproject commit 787733b3d4204d061620c7906af0cf4777c47e34 From 4a4edade9fcf98920773a0713c6b1480a9b3cef3 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 28 Jan 2015 18:56:34 -0500 Subject: [PATCH 06/18] Updated gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 12a4c4b..2af2145 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.o -Debug +Makefile +wpilib +bin From 2951ddd321ec7a5df9135d982fa6a53dbed37870 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 8 Feb 2015 11:52:17 -0500 Subject: [PATCH 07/18] Changed lower timeout --- Commands/Elevator/Lower.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands/Elevator/Lower.cpp b/Commands/Elevator/Lower.cpp index 35d2159..253ffd9 100644 --- a/Commands/Elevator/Lower.cpp +++ b/Commands/Elevator/Lower.cpp @@ -4,7 +4,7 @@ Lower::Lower() : Command("Lower"){ } void Lower::Initialize(){ - SetTimeout(1.0); + SetTimeout(2.0); } void Lower::Execute(){ DentRobot::elevator->Run(-1.0); From e265ac785e22b27c186ec3daf2cdc2dd42c2b223 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 8 Feb 2015 12:19:39 -0500 Subject: [PATCH 08/18] Removed hhlib, added bottom collector --- .gitmodules | 3 --- RobotMap.h | 1 + Subsystems/Collector.cpp | 2 ++ Subsystems/Collector.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index daab3dd..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "src/hhlib"] - path = src/hhlib - url = git@github.com:team2059/hhlib.git diff --git a/RobotMap.h b/RobotMap.h index 3e866a5..cdabc04 100644 --- a/RobotMap.h +++ b/RobotMap.h @@ -22,6 +22,7 @@ #define COLLECTOR_WINDOW_LEFT_CAN 6 #define COLLECTOR_WINDOW_RIGHT_CAN 7 #define COLLECTOR_LEFT_CAN 8 +#define COLLECTOR_BOTTOM_CAN 10 #define COLLECTOR_RIGHT_CAN 9 #endif diff --git a/Subsystems/Collector.cpp b/Subsystems/Collector.cpp index 365809b..f569633 100644 --- a/Subsystems/Collector.cpp +++ b/Subsystems/Collector.cpp @@ -5,6 +5,7 @@ Collector::Collector() : Subsystem("Collector") { windowMotorLeft=new CANTalon(COLLECTOR_WINDOW_LEFT_CAN); windowMotorRight=new CANTalon(COLLECTOR_WINDOW_RIGHT_CAN); collectorMotorLeft=new CANTalon(COLLECTOR_LEFT_CAN); + collectorMotorBottom=new CANTalon(COLLECTOR_BOTTOM_CAN); collectorMotorRight=new CANTalon(COLLECTOR_RIGHT_CAN); } void Collector::InitDefaultCommand() { @@ -15,6 +16,7 @@ void Collector::MoveArms(double a){ } void Collector::MoveRollers(double a){ collectorMotorLeft->Set(a); + collectorMotorBottom->Set(a); collectorMotorRight->Set(-a); } bool Collector::ArmSensor(){ diff --git a/Subsystems/Collector.h b/Subsystems/Collector.h index 24dcc1d..d9cb6ff 100644 --- a/Subsystems/Collector.h +++ b/Subsystems/Collector.h @@ -5,7 +5,7 @@ class Collector: public Subsystem { private: - CANTalon *windowMotorLeft, *windowMotorRight, *collectorMotorLeft, *collectorMotorRight; + CANTalon *windowMotorLeft, *windowMotorRight, *collectorMotorLeft, *collectorMotorBottom, *collectorMotorRight; public: Collector(); void InitDefaultCommand(); From 4790c2d17b18f2eb13b0161441e61d9b293e593f Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 8 Feb 2015 12:26:15 -0500 Subject: [PATCH 09/18] Fixed vim modelines --- CommandBase.cpp | 2 +- CommandBase.h | 2 +- Commands/Autonomous/AutoDrive.cpp | 2 +- Commands/Autonomous/AutoDrive.h | 2 +- Commands/Autonomous/Autonomous.cpp | 2 +- Commands/Autonomous/Autonomous.h | 2 +- Commands/Collector/CloseCollector.cpp | 2 +- Commands/Collector/CloseCollector.h | 2 +- Commands/Collector/CollectTote.cpp | 2 +- Commands/Collector/CollectTote.h | 2 +- Commands/Collector/OpenCollector.cpp | 2 +- Commands/Collector/OpenCollector.h | 2 +- Commands/Collector/ReleaseTote.cpp | 2 +- Commands/Collector/ReleaseTote.h | 2 +- Commands/Drivetrain/Drive.cpp | 2 +- Commands/Drivetrain/Drive.h | 2 +- Commands/Elevator/Calibrate.cpp | 2 +- Commands/Elevator/Calibrate.h | 2 +- Commands/Elevator/Lower.cpp | 2 +- Commands/Elevator/Lower.h | 2 +- Commands/Elevator/Raise.cpp | 2 +- Commands/Elevator/Raise.h | 2 +- DentRobot.cpp | 2 +- OI.cpp | 2 +- OI.h | 2 +- RobotMap.h | 2 +- Subsystems/Collector.cpp | 2 +- Subsystems/Collector.h | 2 +- Subsystems/Drivetrain.cpp | 2 +- Subsystems/Drivetrain.h | 2 +- Subsystems/Elevator.cpp | 2 +- Subsystems/Elevator.h | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/CommandBase.cpp b/CommandBase.cpp index 90e3d27..b98ffac 100644 --- a/CommandBase.cpp +++ b/CommandBase.cpp @@ -16,4 +16,4 @@ void CommandBase::init(){ elevator = new Elevator(); oi = new OI(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/CommandBase.h b/CommandBase.h index c1cb716..ca66699 100644 --- a/CommandBase.h +++ b/CommandBase.h @@ -19,4 +19,4 @@ class CommandBase: public Command { static OI *oi; }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Autonomous/AutoDrive.cpp b/Commands/Autonomous/AutoDrive.cpp index e7f85fc..b5e65df 100644 --- a/Commands/Autonomous/AutoDrive.cpp +++ b/Commands/Autonomous/AutoDrive.cpp @@ -20,4 +20,4 @@ void AutoDrive::End(){ void AutoDrive::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Autonomous/AutoDrive.h b/Commands/Autonomous/AutoDrive.h index eaab4a2..26f2aa3 100644 --- a/Commands/Autonomous/AutoDrive.h +++ b/Commands/Autonomous/AutoDrive.h @@ -16,4 +16,4 @@ class AutoDrive: public Command{ void Interrupted(); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Autonomous/Autonomous.cpp b/Commands/Autonomous/Autonomous.cpp index 93aced5..33bfe6e 100644 --- a/Commands/Autonomous/Autonomous.cpp +++ b/Commands/Autonomous/Autonomous.cpp @@ -6,4 +6,4 @@ Autonomous::Autonomous(){ AddSequential(new AutoDrive()); AddSequential(new Raise()); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Autonomous/Autonomous.h b/Commands/Autonomous/Autonomous.h index 88cf308..43ca69c 100644 --- a/Commands/Autonomous/Autonomous.h +++ b/Commands/Autonomous/Autonomous.h @@ -11,4 +11,4 @@ class Autonomous: public CommandGroup{ Autonomous(); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/CloseCollector.cpp b/Commands/Collector/CloseCollector.cpp index 3b7a866..cd95a99 100644 --- a/Commands/Collector/CloseCollector.cpp +++ b/Commands/Collector/CloseCollector.cpp @@ -17,4 +17,4 @@ void CloseCollector::End(){ void CloseCollector::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/CloseCollector.h b/Commands/Collector/CloseCollector.h index 6be493a..cd26268 100644 --- a/Commands/Collector/CloseCollector.h +++ b/Commands/Collector/CloseCollector.h @@ -17,4 +17,4 @@ class CloseCollector: public Command{ }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/CollectTote.cpp b/Commands/Collector/CollectTote.cpp index eca5210..13c5bcc 100644 --- a/Commands/Collector/CollectTote.cpp +++ b/Commands/Collector/CollectTote.cpp @@ -18,4 +18,4 @@ void CollectTote::End(){ void CollectTote::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/CollectTote.h b/Commands/Collector/CollectTote.h index de2d7db..03074fd 100644 --- a/Commands/Collector/CollectTote.h +++ b/Commands/Collector/CollectTote.h @@ -17,4 +17,4 @@ class CollectTote: public Command{ }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/OpenCollector.cpp b/Commands/Collector/OpenCollector.cpp index 1ec498e..93deb00 100644 --- a/Commands/Collector/OpenCollector.cpp +++ b/Commands/Collector/OpenCollector.cpp @@ -18,4 +18,4 @@ void OpenCollector::End(){ void OpenCollector::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/OpenCollector.h b/Commands/Collector/OpenCollector.h index 47ae5f5..2686251 100644 --- a/Commands/Collector/OpenCollector.h +++ b/Commands/Collector/OpenCollector.h @@ -17,4 +17,4 @@ class OpenCollector: public Command{ }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/ReleaseTote.cpp b/Commands/Collector/ReleaseTote.cpp index e751c35..744efcb 100644 --- a/Commands/Collector/ReleaseTote.cpp +++ b/Commands/Collector/ReleaseTote.cpp @@ -19,4 +19,4 @@ void ReleaseTote::End(){ void ReleaseTote::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/ReleaseTote.h b/Commands/Collector/ReleaseTote.h index 521b7da..722680f 100644 --- a/Commands/Collector/ReleaseTote.h +++ b/Commands/Collector/ReleaseTote.h @@ -17,4 +17,4 @@ class ReleaseTote: public Command{ }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Drivetrain/Drive.cpp b/Commands/Drivetrain/Drive.cpp index dfa803b..3fe46f9 100644 --- a/Commands/Drivetrain/Drive.cpp +++ b/Commands/Drivetrain/Drive.cpp @@ -29,4 +29,4 @@ void Drive::End(){ void Drive::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Drivetrain/Drive.h b/Commands/Drivetrain/Drive.h index 17583fa..17e0ab8 100644 --- a/Commands/Drivetrain/Drive.h +++ b/Commands/Drivetrain/Drive.h @@ -16,4 +16,4 @@ class Drive: public Command{ void Interrupted(); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Elevator/Calibrate.cpp b/Commands/Elevator/Calibrate.cpp index 87f2c25..a55c8c4 100644 --- a/Commands/Elevator/Calibrate.cpp +++ b/Commands/Elevator/Calibrate.cpp @@ -23,4 +23,4 @@ void Calibrate::End(){ void Calibrate::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Elevator/Calibrate.h b/Commands/Elevator/Calibrate.h index 5d70334..d2bb7b2 100644 --- a/Commands/Elevator/Calibrate.h +++ b/Commands/Elevator/Calibrate.h @@ -14,4 +14,4 @@ class Calibrate: public Command{ void Interrupted(); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Elevator/Lower.cpp b/Commands/Elevator/Lower.cpp index 253ffd9..c29c16f 100644 --- a/Commands/Elevator/Lower.cpp +++ b/Commands/Elevator/Lower.cpp @@ -23,4 +23,4 @@ void Lower::End(){ void Lower::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Elevator/Lower.h b/Commands/Elevator/Lower.h index 3a83b57..92c8535 100644 --- a/Commands/Elevator/Lower.h +++ b/Commands/Elevator/Lower.h @@ -14,4 +14,4 @@ class Lower: public Command{ void Interrupted(); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Elevator/Raise.cpp b/Commands/Elevator/Raise.cpp index 050b571..92eecc9 100644 --- a/Commands/Elevator/Raise.cpp +++ b/Commands/Elevator/Raise.cpp @@ -23,4 +23,4 @@ void Raise::End(){ void Raise::Interrupted(){ End(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Commands/Elevator/Raise.h b/Commands/Elevator/Raise.h index abc519b..b19f470 100644 --- a/Commands/Elevator/Raise.h +++ b/Commands/Elevator/Raise.h @@ -15,4 +15,4 @@ class Raise: public Command{ }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/DentRobot.cpp b/DentRobot.cpp index 77c6a8f..d0399a6 100644 --- a/DentRobot.cpp +++ b/DentRobot.cpp @@ -38,4 +38,4 @@ void DentRobot::TeleopPeriodic(){ void DentRobot::TestPeriodic(){ } START_ROBOT_CLASS(DentRobot); -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/OI.cpp b/OI.cpp index 1a81fab..f2c7400 100644 --- a/OI.cpp +++ b/OI.cpp @@ -45,4 +45,4 @@ Joystick* OI::GetRightStick(){ Joystick* OI::GetLeftStick(){ return leftStick; } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/OI.h b/OI.h index 6bdbe19..7f0929f 100644 --- a/OI.h +++ b/OI.h @@ -13,4 +13,4 @@ class OI Joystick* GetLeftStick(); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/RobotMap.h b/RobotMap.h index cdabc04..d0cc6e4 100644 --- a/RobotMap.h +++ b/RobotMap.h @@ -26,4 +26,4 @@ #define COLLECTOR_RIGHT_CAN 9 #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Subsystems/Collector.cpp b/Subsystems/Collector.cpp index f569633..fcc7959 100644 --- a/Subsystems/Collector.cpp +++ b/Subsystems/Collector.cpp @@ -27,4 +27,4 @@ bool Collector::BoxCollected(){ return false; //return boxSwitch->Get(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Subsystems/Collector.h b/Subsystems/Collector.h index d9cb6ff..92262ac 100644 --- a/Subsystems/Collector.h +++ b/Subsystems/Collector.h @@ -15,4 +15,4 @@ class Collector: public Subsystem bool BoxCollected(); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Subsystems/Drivetrain.cpp b/Subsystems/Drivetrain.cpp index 7db8487..6440679 100644 --- a/Subsystems/Drivetrain.cpp +++ b/Subsystems/Drivetrain.cpp @@ -20,4 +20,4 @@ void Drivetrain::DriveMecanum(float x, float y, float z, float sensitivity, floa rightRear->Set((correctX + correctY - correctZ)); leftRear->Set((-correctX + correctY + correctZ)*-1); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Subsystems/Drivetrain.h b/Subsystems/Drivetrain.h index b4114b4..3ab69b3 100644 --- a/Subsystems/Drivetrain.h +++ b/Subsystems/Drivetrain.h @@ -13,4 +13,4 @@ class Drivetrain: public Subsystem{ void DriveArcade(float, float); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Subsystems/Elevator.cpp b/Subsystems/Elevator.cpp index f0ff41e..e02c4ff 100644 --- a/Subsystems/Elevator.cpp +++ b/Subsystems/Elevator.cpp @@ -29,4 +29,4 @@ bool Elevator::GetElevatorBottom(){ bool Elevator::GetElevatorTop(){ return elevatorTop->Get(); } -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et diff --git a/Subsystems/Elevator.h b/Subsystems/Elevator.h index 44c57de..c6facaf 100644 --- a/Subsystems/Elevator.h +++ b/Subsystems/Elevator.h @@ -21,4 +21,4 @@ class Elevator{ bool GetElevatorBottom(); }; #endif -// vim: ts2:sw=2:et +// vim: ts=2:sw=2:et From 267a720b83d2245660d1f726b68006f5448e0ac8 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 8 Feb 2015 16:51:35 -0500 Subject: [PATCH 10/18] Default value changes, more working on auto --- Commands/Autonomous/AutoDrive.cpp | 4 ++-- Commands/Autonomous/Autonomous.cpp | 17 +++++++++++++++-- Commands/Autonomous/Turn.cpp | 22 ++++++++++++++++++++++ Commands/Autonomous/Turn.h | 19 +++++++++++++++++++ Commands/Collector/CloseCollector.cpp | 14 +++++++++++--- Commands/Collector/CollectTote.cpp | 3 ++- Commands/Collector/OpenCollector.cpp | 7 ++++--- Commands/Drivetrain/Drive.cpp | 12 ++++++------ Commands/Elevator/Lower.cpp | 2 +- Commands/Elevator/Raise.cpp | 2 +- OI.cpp | 12 ++++++------ 11 files changed, 89 insertions(+), 25 deletions(-) create mode 100644 Commands/Autonomous/Turn.cpp create mode 100644 Commands/Autonomous/Turn.h diff --git a/Commands/Autonomous/AutoDrive.cpp b/Commands/Autonomous/AutoDrive.cpp index b5e65df..b7833ec 100644 --- a/Commands/Autonomous/AutoDrive.cpp +++ b/Commands/Autonomous/AutoDrive.cpp @@ -4,13 +4,13 @@ // Drive for a short while then stop. Just for testing AutoDrive::AutoDrive() : Command("AutoDrive"){ Requires(DentRobot::drivetrain); - SetTimeout(1.0); + SetTimeout(0.5); } void AutoDrive::Initialize(){ } void AutoDrive::Execute(){ //X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro - DentRobot::drivetrain->DriveMecanum(0.5,0,0,0.9,0); + DentRobot::drivetrain->DriveMecanum(0.0,-.75,0.0,0.9,0.0); } bool AutoDrive::IsFinished(){ return IsTimedOut(); diff --git a/Commands/Autonomous/Autonomous.cpp b/Commands/Autonomous/Autonomous.cpp index 33bfe6e..bc64654 100644 --- a/Commands/Autonomous/Autonomous.cpp +++ b/Commands/Autonomous/Autonomous.cpp @@ -1,9 +1,22 @@ #include "Autonomous.h" -#include "AutoDrive.h" #include "../../DentRobot.h" #include "../Elevator/Raise.h" +#include "../Elevator/Lower.h" +#include "AutoDrive.h" +#include "Turn.h" +#include "../Collector/CloseCollector.h" +#include "../Collector/OpenCollector.h" +#include "../Collector/CollectTote.h" Autonomous::Autonomous(){ - AddSequential(new AutoDrive()); + //AddSequential(new Raise()); + //AddSequential(new Lower()); + //AddSequential(new AutoDrive()); AddSequential(new Raise()); + AddSequential(new Lower()); + AddSequential(new Turn()); + AddParallel(new AutoDrive()); + AddParallel(new CloseCollector()); + AddParallel(new CollectTote()); + AddSequential(new Turn()); } // vim: ts=2:sw=2:et diff --git a/Commands/Autonomous/Turn.cpp b/Commands/Autonomous/Turn.cpp new file mode 100644 index 0000000..174f6cc --- /dev/null +++ b/Commands/Autonomous/Turn.cpp @@ -0,0 +1,22 @@ +#include "Turn.h" +#include "../../DentRobot.h" +// Drive for a short while then stop. Just for testing +Turn::Turn() : Command("Turn"){ + Requires(DentRobot::drivetrain); + SetTimeout(0.25); +} +void Turn::Initialize(){ +} +void Turn::Execute(){ + //X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro + DentRobot::drivetrain->DriveMecanum(0.0,0.0,0.5,0.9,0.0); +} +bool Turn::IsFinished(){ + return IsTimedOut(); +} +void Turn::End(){ +} +void Turn::Interrupted(){ + End(); +} +// vim: ts=2:sw=2:et diff --git a/Commands/Autonomous/Turn.h b/Commands/Autonomous/Turn.h new file mode 100644 index 0000000..2adc701 --- /dev/null +++ b/Commands/Autonomous/Turn.h @@ -0,0 +1,19 @@ +#ifndef TURN_H +#define TURN_H + +#include "Commands/Command.h" +#include "../../CommandBase.h" +#include "../../DentRobot.h" +#include "WPILib.h" + +class Turn: public Command{ + public: + Turn(); + void Initialize(); + void Execute(); + bool IsFinished(); + void End(); + void Interrupted(); +}; +#endif +// vim: ts=2:sw=2:et diff --git a/Commands/Collector/CloseCollector.cpp b/Commands/Collector/CloseCollector.cpp index cd95a99..2418732 100644 --- a/Commands/Collector/CloseCollector.cpp +++ b/Commands/Collector/CloseCollector.cpp @@ -3,13 +3,21 @@ CloseCollector::CloseCollector() : Command("CloseCollector"){ Requires(DentRobot::collector); } void CloseCollector::Initialize(){ - SetTimeout(0.5); + printf("Initialized collector: 0.5\n"); + SetTimeout(2.5); } void CloseCollector::Execute(){ - DentRobot::collector->MoveArms(0.2f); + //printf("Closing collector: -0.5f\n"); + DentRobot::collector->MoveArms(-0.5); + //DentRobot::collector->MoveArms(-(-DentRobot::oi->GetRightStick()->GetRawAxis(3)+1)/2*.3/.5); } bool CloseCollector::IsFinished(){ - return DentRobot::collector->ArmSensor(); + if(DentRobot::collector->ArmSensor()||IsTimedOut()){ + printf("Stopped Closing: %d, %d\n",DentRobot::collector->ArmSensor(), IsTimedOut()); + return true; + }else{ + return false; + } } void CloseCollector::End(){ DentRobot::collector->MoveArms(0.0f); diff --git a/Commands/Collector/CollectTote.cpp b/Commands/Collector/CollectTote.cpp index 13c5bcc..acabd4e 100644 --- a/Commands/Collector/CollectTote.cpp +++ b/Commands/Collector/CollectTote.cpp @@ -3,6 +3,7 @@ CollectTote::CollectTote() : Command("CollectTote"){ Requires(DentRobot::collector); } void CollectTote::Initialize(){ + printf("Initialized CollectTote\n"); SetTimeout(2.0); } void CollectTote::Execute(){ @@ -10,7 +11,7 @@ void CollectTote::Execute(){ DentRobot::collector->MoveRollers(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2); } bool CollectTote::IsFinished(){ - return DentRobot::collector->BoxCollected(); + return DentRobot::collector->BoxCollected()||IsTimedOut(); } void CollectTote::End(){ DentRobot::collector->MoveRollers(0.0); diff --git a/Commands/Collector/OpenCollector.cpp b/Commands/Collector/OpenCollector.cpp index 93deb00..5cebc3e 100644 --- a/Commands/Collector/OpenCollector.cpp +++ b/Commands/Collector/OpenCollector.cpp @@ -6,11 +6,12 @@ void OpenCollector::Initialize(){ SetTimeout(0.5); } void OpenCollector::Execute(){ - //TODO check this value to move the motors in the right direction - DentRobot::collector->MoveArms(-0.2f); + DentRobot::collector->MoveArms(0.35); + //DentRobot::collector->MoveArms((-DentRobot::oi->GetRightStick()->GetRawAxis(3)+1)/2*.3/.5); } bool OpenCollector::IsFinished(){ - return DentRobot::collector->ArmSensor(); + //return DentRobot::collector->ArmSensor(); + return IsTimedOut(); } void OpenCollector::End(){ DentRobot::collector->MoveArms(0.0f); diff --git a/Commands/Drivetrain/Drive.cpp b/Commands/Drivetrain/Drive.cpp index 3fe46f9..60fa59c 100644 --- a/Commands/Drivetrain/Drive.cpp +++ b/Commands/Drivetrain/Drive.cpp @@ -12,12 +12,12 @@ void Drive::Execute(){ x = DentRobot::oi->GetLeftStick()->GetRawAxis(0); z = DentRobot::oi->GetLeftStick()->GetRawAxis(2); y = DentRobot::oi->GetLeftStick()->GetRawAxis(1); - if (DentRobot::oi->GetLeftStick()->GetRawButton(1)){ - x=0; - } - if (DentRobot::oi->GetLeftStick()->GetRawButton(2)){ - y=0; - } + //if (DentRobot::oi->GetLeftStick()->GetRawButton(1)){ + // x=0; + //} + //if (DentRobot::oi->GetLeftStick()->GetRawButton(2)){ + // y=0; + //} //X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro DentRobot::drivetrain->DriveMecanum(x,y,z,0.9,0); } diff --git a/Commands/Elevator/Lower.cpp b/Commands/Elevator/Lower.cpp index c29c16f..378156d 100644 --- a/Commands/Elevator/Lower.cpp +++ b/Commands/Elevator/Lower.cpp @@ -4,7 +4,7 @@ Lower::Lower() : Command("Lower"){ } void Lower::Initialize(){ - SetTimeout(2.0); + SetTimeout(2.5); } void Lower::Execute(){ DentRobot::elevator->Run(-1.0); diff --git a/Commands/Elevator/Raise.cpp b/Commands/Elevator/Raise.cpp index 92eecc9..6f900b4 100644 --- a/Commands/Elevator/Raise.cpp +++ b/Commands/Elevator/Raise.cpp @@ -4,7 +4,7 @@ Raise::Raise() : Command("Raise"){ } void Raise::Initialize(){ - SetTimeout(2.5); + SetTimeout(3.0); } void Raise::Execute(){ DentRobot::elevator->Run(1.0); diff --git a/OI.cpp b/OI.cpp index f2c7400..54c4212 100644 --- a/OI.cpp +++ b/OI.cpp @@ -13,12 +13,12 @@ OI::OI() { // Collector JoystickButton *right1=new JoystickButton(rightStick, 1); JoystickButton *right2=new JoystickButton(rightStick, 2); - JoystickButton *left3=new JoystickButton(leftStick, 3); - JoystickButton *left4=new JoystickButton(leftStick, 4); - right1->WhileHeld(new OpenCollector()); - right2->WhileHeld(new CloseCollector()); - left3->WhileHeld(new CollectTote()); - left4->WhileHeld(new ReleaseTote()); + JoystickButton *left1=new JoystickButton(leftStick, 1); + JoystickButton *left2=new JoystickButton(leftStick, 2); + right1->WhileHeld(new CloseCollector()); + right2->WhileHeld(new OpenCollector()); + left1->WhileHeld(new CollectTote()); + left2->WhileHeld(new ReleaseTote()); // Elevator Raise* raise=new Raise(); Lower* lower=new Lower(); From 376305a5a7a800242e5da628564a401cfe9b0ae5 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 8 Feb 2015 20:29:18 -0500 Subject: [PATCH 11/18] Removed cmath --- Commands/Autonomous/AutoDrive.cpp | 1 - Commands/Drivetrain/Drive.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/Commands/Autonomous/AutoDrive.cpp b/Commands/Autonomous/AutoDrive.cpp index b7833ec..4d46525 100644 --- a/Commands/Autonomous/AutoDrive.cpp +++ b/Commands/Autonomous/AutoDrive.cpp @@ -1,5 +1,4 @@ #include "AutoDrive.h" -#include #include "../../DentRobot.h" // Drive for a short while then stop. Just for testing AutoDrive::AutoDrive() : Command("AutoDrive"){ diff --git a/Commands/Drivetrain/Drive.cpp b/Commands/Drivetrain/Drive.cpp index 60fa59c..3b91bae 100644 --- a/Commands/Drivetrain/Drive.cpp +++ b/Commands/Drivetrain/Drive.cpp @@ -1,5 +1,4 @@ #include "Drive.h" -#include #include "../../DentRobot.h" Drive::Drive() : Command("Drive"){ Requires(DentRobot::drivetrain); From b832b2b647e412b5570ec822c386bb0393d75bdc Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Mon, 9 Feb 2015 18:47:53 -0500 Subject: [PATCH 12/18] Removed .env --- .env | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index fe3ac67..0000000 --- a/.env +++ /dev/null @@ -1,15 +0,0 @@ -function mb(){ - vagrant ssh -c "cd /vagrant/src;make clean 2>&1 >/dev/null;make" -} -function mc(){ - vagrant ssh -c "cd /vagrant/src;make clean 2>&1 >/dev/null" -} -function mk(){ - vagrant ssh -c "cd /vagrant/src;make" -} -function me(){ - vagrant ssh -c "cd /vagrant/src;make deploy" -} -function ma(){ - vagrant ssh -c "cd /vagrant/src;make clean 2>&1 >/dev/null;make;make deploy" -} From dd0b13c4a90a0f4b45007dfd1bf1b244d1be6528 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Tue, 10 Feb 2015 20:12:41 -0500 Subject: [PATCH 13/18] Added binElevator (untested) --- CommandBase.cpp | 3 ++ CommandBase.h | 2 ++ Commands/BinElevator/BinLower.cpp | 26 +++++++++++++++ .../Calibrate.h => BinElevator/BinLower.h} | 8 ++--- Commands/BinElevator/BinRaise.cpp | 26 +++++++++++++++ Commands/BinElevator/BinRaise.h | 18 +++++++++++ Commands/Elevator/Calibrate.cpp | 26 --------------- DentRobot.cpp | 2 ++ DentRobot.h | 2 ++ Subsystems/BinElevator.cpp | 32 +++++++++++++++++++ Subsystems/BinElevator.h | 24 ++++++++++++++ 11 files changed, 139 insertions(+), 30 deletions(-) create mode 100644 Commands/BinElevator/BinLower.cpp rename Commands/{Elevator/Calibrate.h => BinElevator/BinLower.h} (68%) create mode 100644 Commands/BinElevator/BinRaise.cpp create mode 100644 Commands/BinElevator/BinRaise.h delete mode 100644 Commands/Elevator/Calibrate.cpp create mode 100644 Subsystems/BinElevator.cpp create mode 100644 Subsystems/BinElevator.h diff --git a/CommandBase.cpp b/CommandBase.cpp index b98ffac..c4defc3 100644 --- a/CommandBase.cpp +++ b/CommandBase.cpp @@ -2,9 +2,11 @@ #include "Subsystems/Drivetrain.h" #include "Subsystems/Collector.h" #include "Subsystems/Elevator.h" +#include "Subsystems/BinElevator.h" Drivetrain* CommandBase::drivetrain = NULL; Collector* CommandBase::collector = NULL; Elevator* CommandBase::elevator = NULL; +BinElevator* CommandBase::binElevator = NULL; OI* CommandBase::oi = NULL; CommandBase::CommandBase(char const *name) : Command(name) { } @@ -14,6 +16,7 @@ void CommandBase::init(){ drivetrain = new Drivetrain(); collector = new Collector(); elevator = new Elevator(); + binElevator = new BinElevator(); oi = new OI(); } // vim: ts=2:sw=2:et diff --git a/CommandBase.h b/CommandBase.h index ca66699..7443ebd 100644 --- a/CommandBase.h +++ b/CommandBase.h @@ -5,6 +5,7 @@ #include "Subsystems/Drivetrain.h" #include "Subsystems/Collector.h" #include "Subsystems/Elevator.h" +#include "Subsystems/BinElevator.h" #include "OI.h" #include "WPILib.h" @@ -16,6 +17,7 @@ class CommandBase: public Command { static Drivetrain *drivetrain; static Collector *collector; static Elevator *elevator; + static BinElevator *binElevator; static OI *oi; }; #endif diff --git a/Commands/BinElevator/BinLower.cpp b/Commands/BinElevator/BinLower.cpp new file mode 100644 index 0000000..158f98a --- /dev/null +++ b/Commands/BinElevator/BinLower.cpp @@ -0,0 +1,26 @@ +#include "BinLower.h" +#include "../../DentRobot.h" +#include "../../OI.h" +BinLower::BinLower() : Command("BinLower"){ +} +void BinLower::Initialize(){ + SetTimeout(2.5); +} +void BinLower::Execute(){ + DentRobot::binElevator->Run(-1.0); +} +bool BinLower::IsFinished(){ + if (!DentRobot::binElevator->GetElevatorBottom()||IsTimedOut()){ + printf("Robot stoped BinLowering. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorBottom()); + return true; + }else{ + return false; + } +} +void BinLower::End(){ + DentRobot::binElevator->Run(0.0f); +} +void BinLower::Interrupted(){ + End(); +} +// vim: ts=2:sw=2:et diff --git a/Commands/Elevator/Calibrate.h b/Commands/BinElevator/BinLower.h similarity index 68% rename from Commands/Elevator/Calibrate.h rename to Commands/BinElevator/BinLower.h index d2bb7b2..a3504b4 100644 --- a/Commands/Elevator/Calibrate.h +++ b/Commands/BinElevator/BinLower.h @@ -1,12 +1,12 @@ -#ifndef CALIBRATE_H -#define CALIBRATE_H +#ifndef BINLOWER_H +#define BINLOWER_H #include "Commands/Command.h" #include "WPILib.h" -class Calibrate: public Command{ +class BinLower: public Command{ public: - Calibrate(); + BinLower(); void Initialize(); void Execute(); bool IsFinished(); diff --git a/Commands/BinElevator/BinRaise.cpp b/Commands/BinElevator/BinRaise.cpp new file mode 100644 index 0000000..aa765a4 --- /dev/null +++ b/Commands/BinElevator/BinRaise.cpp @@ -0,0 +1,26 @@ +#include "BinRaise.h" +#include "../../DentRobot.h" +#include "../../OI.h" +BinRaise::BinRaise() : Command("BinRaise"){ +} +void BinRaise::Initialize(){ + SetTimeout(3.0); +} +void BinRaise::Execute(){ + DentRobot::binElevator->Run(1.0); +} +bool BinRaise::IsFinished(){ + if (!DentRobot::binElevator->GetElevatorTop()||IsTimedOut()){ + printf("Robot stoped raising. Sensor based? %d\n", !DentRobot::binElevator->GetElevatorTop()); + return true; + }else{ + return false; + } +} +void BinRaise::End(){ + DentRobot::binElevator->Run(0.0f); +} +void BinRaise::Interrupted(){ + End(); +} +// vim: ts=2:sw=2:et diff --git a/Commands/BinElevator/BinRaise.h b/Commands/BinElevator/BinRaise.h new file mode 100644 index 0000000..ea73454 --- /dev/null +++ b/Commands/BinElevator/BinRaise.h @@ -0,0 +1,18 @@ +#ifndef BINRAISE_H +#define BINRAISE_H + +#include "Commands/Command.h" +#include "WPILib.h" + +class BinRaise: public Command{ + public: + BinRaise(); + void Initialize(); + void Execute(); + bool IsFinished(); + void End(); + void Interrupted(); +}; + +#endif +// vim: ts=2:sw=2:et diff --git a/Commands/Elevator/Calibrate.cpp b/Commands/Elevator/Calibrate.cpp deleted file mode 100644 index a55c8c4..0000000 --- a/Commands/Elevator/Calibrate.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "Calibrate.h" -#include "../../DentRobot.h" -// Lowers elevator until it hits the limit switch then sets the height of the elevator to the height of the limit switches -Calibrate::Calibrate() : Command("Calibrate"){ -} -void Calibrate::Initialize(){ -} -void Calibrate::Execute(){ - // Lower collector until End() - DentRobot::elevator->Run(-0.4f); -} -bool Calibrate::IsFinished(){ - if(DentRobot::elevator->GetElevatorBottom()){ - DentRobot::elevator->ResetEncoder(); - DentRobot::elevator->SetOffset(0.99); - return true; - } - return false; -} -void Calibrate::End(){ - DentRobot::elevator->Run(0.0f); -} -void Calibrate::Interrupted(){ - End(); -} -// vim: ts=2:sw=2:et diff --git a/DentRobot.cpp b/DentRobot.cpp index d0399a6..4588bf6 100644 --- a/DentRobot.cpp +++ b/DentRobot.cpp @@ -4,12 +4,14 @@ OI* DentRobot::oi=NULL; Collector* DentRobot::collector=NULL; Drivetrain* DentRobot::drivetrain=NULL; Elevator* DentRobot::elevator=NULL; +BinElevator* DentRobot::binElevator=NULL; CommandGroup* DentRobot::aut=NULL; DentRobot::DentRobot(){ oi=new OI(); collector=new Collector(); drivetrain=new Drivetrain(); elevator=new Elevator(); + binElevator=new BinElevator(); aut=new Autonomous(); printf("Initialized"); } diff --git a/DentRobot.h b/DentRobot.h index e089405..68b17ba 100644 --- a/DentRobot.h +++ b/DentRobot.h @@ -3,6 +3,7 @@ #include "WPILib.h" #include "OI.h" #include "Subsystems/Elevator.h" +#include "Subsystems/BinElevator.h" #include "Subsystems/Drivetrain.h" #include "Subsystems/Collector.h" #include "Commands/Autonomous/Autonomous.h" @@ -15,6 +16,7 @@ class DentRobot: public IterativeRobot { static Collector* collector; static Drivetrain* drivetrain; static Elevator* elevator; + static BinElevator* binElevator; static CommandGroup* aut; void RobotInit(); void DisabledPeriodic(); diff --git a/Subsystems/BinElevator.cpp b/Subsystems/BinElevator.cpp new file mode 100644 index 0000000..2ada4b9 --- /dev/null +++ b/Subsystems/BinElevator.cpp @@ -0,0 +1,32 @@ +#include "BinElevator.h" +#include "../RobotMap.h" +BinElevator::BinElevator(){ + motor=new CANTalon(ELEVATOR_CAN); + elevatorEncoder=new Encoder(0,1,false); + offset=0; + height=0; + elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO); + elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO); + //SetAbsoluteTolerance(0.004); +} +void BinElevator::InitDefaultCommand(){ +} +void BinElevator::Run(double power){ + motor->Set(power); +} +void BinElevator::SetOffset(double ht){ + offset=ht; +} +void BinElevator::ResetEncoder(){ + elevatorEncoder->Reset(); +} +double BinElevator::GetHeight(){ + return elevatorEncoder->Get()+offset; +} +bool BinElevator::GetElevatorBottom(){ + return elevatorBottom->Get(); +} +bool BinElevator::GetElevatorTop(){ + return elevatorTop->Get(); +} +// vim: ts=2:sw=2:et diff --git a/Subsystems/BinElevator.h b/Subsystems/BinElevator.h new file mode 100644 index 0000000..5e9e72d --- /dev/null +++ b/Subsystems/BinElevator.h @@ -0,0 +1,24 @@ +#ifndef BINELEVATOR_H +#define BINELEVATOR_H + +#include "WPILib.h" +#include "Commands/PIDSubsystem.h" +class BinElevator{ + private: + CANTalon *motor; + Encoder *elevatorEncoder; + static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2; + double offset, height; + DigitalInput *elevatorBottom, *elevatorTop; + public: + BinElevator(); + void InitDefaultCommand(); + void Run(double); + void SetOffset(double); + void ResetEncoder(); + double GetHeight(); + bool GetElevatorTop(); + bool GetElevatorBottom(); +}; +#endif +// vim: ts=2:sw=2:et From c77ee7a548e26de638cbf2434a2d38fe2fdc25c8 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 11 Feb 2015 18:34:38 -0500 Subject: [PATCH 14/18] Added camera, fixed binelevator (untested) --- DentRobot.cpp | 3 +++ RobotMap.h | 8 ++++++-- Subsystems/BinElevator.cpp | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/DentRobot.cpp b/DentRobot.cpp index 4588bf6..d43ffb8 100644 --- a/DentRobot.cpp +++ b/DentRobot.cpp @@ -13,6 +13,9 @@ DentRobot::DentRobot(){ elevator=new Elevator(); binElevator=new BinElevator(); aut=new Autonomous(); + CameraServer::GetInstance()->SetQuality(50); + //the camera name (ex "cam0") can be found through the roborio web interface + CameraServer::GetInstance()->StartAutomaticCapture("cam0"); printf("Initialized"); } void DentRobot::RobotInit(){ diff --git a/RobotMap.h b/RobotMap.h index d0cc6e4..8a7a765 100644 --- a/RobotMap.h +++ b/RobotMap.h @@ -8,10 +8,14 @@ #define ELEVATOR_BOTTOM_DIO 0 #define ELEVATOR_COLELCT_TOTE_DIO 1 #define ELEVATOR_READY_TOTE_DIO 2 -#define ELEVATOR_COLELCT_CAN_DIO 3 -#define ELEVATOR_READY_CAN_DIO 4 #define ELEVATOR_TOP_DIO 5 +// BinElevator +#define BINELEVATOR_CAN 11 +#define BINELEVATOR_BOTTOM_DIO 6 +#define BINELEVATOR_COLELCT_BIN_DIO 7 +#define BINELEVATOR_TOP_DIO 8 + // Drivetrain #define DRIVE_FRONT_LEFT_CAN 2 #define DRIVE_BACK_LEFT_CAN 3 diff --git a/Subsystems/BinElevator.cpp b/Subsystems/BinElevator.cpp index 2ada4b9..1692361 100644 --- a/Subsystems/BinElevator.cpp +++ b/Subsystems/BinElevator.cpp @@ -1,12 +1,12 @@ #include "BinElevator.h" #include "../RobotMap.h" BinElevator::BinElevator(){ - motor=new CANTalon(ELEVATOR_CAN); + motor=new CANTalon(BINELEVATOR_CAN); elevatorEncoder=new Encoder(0,1,false); offset=0; height=0; - elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO); - elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO); + elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO); + elevatorTop=new DigitalInput(BINELEVATOR_TOP_DIO); //SetAbsoluteTolerance(0.004); } void BinElevator::InitDefaultCommand(){ From 0831c1084bc5a537f58cd004008df7e351dc183e Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 11 Feb 2015 19:22:59 -0500 Subject: [PATCH 15/18] Camera works, untested binelevator changes --- DentRobot.cpp | 3 +-- RobotMap.h | 4 ++++ Subsystems/BinElevator.cpp | 2 +- Subsystems/Elevator.cpp | 10 ++-------- Subsystems/Elevator.h | 2 -- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/DentRobot.cpp b/DentRobot.cpp index d43ffb8..f5eafec 100644 --- a/DentRobot.cpp +++ b/DentRobot.cpp @@ -13,8 +13,7 @@ DentRobot::DentRobot(){ elevator=new Elevator(); binElevator=new BinElevator(); aut=new Autonomous(); - CameraServer::GetInstance()->SetQuality(50); - //the camera name (ex "cam0") can be found through the roborio web interface + CameraServer::GetInstance()->SetQuality(25); CameraServer::GetInstance()->StartAutomaticCapture("cam0"); printf("Initialized"); } diff --git a/RobotMap.h b/RobotMap.h index 8a7a765..a3abe10 100644 --- a/RobotMap.h +++ b/RobotMap.h @@ -9,12 +9,16 @@ #define ELEVATOR_COLELCT_TOTE_DIO 1 #define ELEVATOR_READY_TOTE_DIO 2 #define ELEVATOR_TOP_DIO 5 +#define ELEVATOR_ENCODERA 0 +#define ELEVATOR_ENCODERB 1 // BinElevator #define BINELEVATOR_CAN 11 #define BINELEVATOR_BOTTOM_DIO 6 #define BINELEVATOR_COLELCT_BIN_DIO 7 #define BINELEVATOR_TOP_DIO 8 +#define BINELEVATOR_ENCODERA 2 +#define BINELEVATOR_ENCODERB 3 // Drivetrain #define DRIVE_FRONT_LEFT_CAN 2 diff --git a/Subsystems/BinElevator.cpp b/Subsystems/BinElevator.cpp index 1692361..119bfb8 100644 --- a/Subsystems/BinElevator.cpp +++ b/Subsystems/BinElevator.cpp @@ -2,7 +2,7 @@ #include "../RobotMap.h" BinElevator::BinElevator(){ motor=new CANTalon(BINELEVATOR_CAN); - elevatorEncoder=new Encoder(0,1,false); + elevatorEncoder=new Encoder(BINELEVATOR_ENCODERA,BINELEVATOR_ENCODERB,false); offset=0; height=0; elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO); diff --git a/Subsystems/Elevator.cpp b/Subsystems/Elevator.cpp index e02c4ff..9264b4a 100644 --- a/Subsystems/Elevator.cpp +++ b/Subsystems/Elevator.cpp @@ -2,26 +2,20 @@ #include "../RobotMap.h" Elevator::Elevator(){ motor=new CANTalon(ELEVATOR_CAN); - elevatorEncoder=new Encoder(0,1,false); - offset=0; - height=0; + elevatorEncoder=new Encoder(ELEVATOR_ENCODERA,ELEVATOR_ENCODERB,false); elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO); elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO); - //SetAbsoluteTolerance(0.004); } void Elevator::InitDefaultCommand(){ } void Elevator::Run(double power){ motor->Set(power); } -void Elevator::SetOffset(double ht){ - offset=ht; -} void Elevator::ResetEncoder(){ elevatorEncoder->Reset(); } double Elevator::GetHeight(){ - return elevatorEncoder->Get()+offset; + return elevatorEncoder->Get(); } bool Elevator::GetElevatorBottom(){ return elevatorBottom->Get(); diff --git a/Subsystems/Elevator.h b/Subsystems/Elevator.h index c6facaf..bdc0c8d 100644 --- a/Subsystems/Elevator.h +++ b/Subsystems/Elevator.h @@ -8,13 +8,11 @@ class Elevator{ CANTalon *motor; Encoder *elevatorEncoder; static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2; - double offset, height; DigitalInput *elevatorBottom, *elevatorTop; public: Elevator(); void InitDefaultCommand(); void Run(double); - void SetOffset(double); void ResetEncoder(); double GetHeight(); bool GetElevatorTop(); From e26b7e825c50a072468a97af96b8ea1a163a00d0 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 11 Feb 2015 20:49:56 -0500 Subject: [PATCH 16/18] Updated binElevator --- Subsystems/BinElevator.cpp | 8 +------- Subsystems/BinElevator.h | 2 -- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Subsystems/BinElevator.cpp b/Subsystems/BinElevator.cpp index 119bfb8..daff79b 100644 --- a/Subsystems/BinElevator.cpp +++ b/Subsystems/BinElevator.cpp @@ -3,25 +3,19 @@ BinElevator::BinElevator(){ motor=new CANTalon(BINELEVATOR_CAN); elevatorEncoder=new Encoder(BINELEVATOR_ENCODERA,BINELEVATOR_ENCODERB,false); - offset=0; - height=0; elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO); elevatorTop=new DigitalInput(BINELEVATOR_TOP_DIO); - //SetAbsoluteTolerance(0.004); } void BinElevator::InitDefaultCommand(){ } void BinElevator::Run(double power){ motor->Set(power); } -void BinElevator::SetOffset(double ht){ - offset=ht; -} void BinElevator::ResetEncoder(){ elevatorEncoder->Reset(); } double BinElevator::GetHeight(){ - return elevatorEncoder->Get()+offset; + return elevatorEncoder->Get(); } bool BinElevator::GetElevatorBottom(){ return elevatorBottom->Get(); diff --git a/Subsystems/BinElevator.h b/Subsystems/BinElevator.h index 5e9e72d..8814152 100644 --- a/Subsystems/BinElevator.h +++ b/Subsystems/BinElevator.h @@ -8,13 +8,11 @@ class BinElevator{ CANTalon *motor; Encoder *elevatorEncoder; static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2; - double offset, height; DigitalInput *elevatorBottom, *elevatorTop; public: BinElevator(); void InitDefaultCommand(); void Run(double); - void SetOffset(double); void ResetEncoder(); double GetHeight(); bool GetElevatorTop(); From 97c5182e889c01f8c95824bc4679844a17d6f7d1 Mon Sep 17 00:00:00 2001 From: Adam Long Date: Thu, 12 Feb 2015 17:56:09 +0000 Subject: [PATCH 17/18] Updated makefile to create bin directory if it doesn't exist --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0eee4bc..9bf4a49 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ EXEC=bin/FRCUserProgram CLEANSER=rm -r all : $(OBJECTS) + if [ ! -d bin ];then mkdir bin; fi $(CC) -L$(WPILIB)/lib $(LDFLAGS) -o $(EXEC) $(OBJECTS) -lwpi %.o : %.cpp @@ -17,10 +18,10 @@ all : $(OBJECTS) clean: $(CLEANSER) $(OBJECTS) bin/FRCUserProgram -deploy: +deploy: all @cat bin/FRCUserProgram | ssh admin@$(REMOTEIP) 'cat > /home/lvuser/FRCUserProgram2&&rm /home/lvuser/FRCUserProgram;mv /home/lvuser/FRCUserProgram2 /home/lvuser/FRCUserProgram&&. /etc/profile.d/natinst-path.sh;chmod a+x /home/lvuser/FRCUserProgram' -debug: +debug: all @cat bin/FRCUserProgram | ssh admin@$(REMOTEIP) 'cat > /home/lvuser/FRCUserProgram2&&rm /home/lvuser/FRCUserProgram;mv /home/lvuser/FRCUserProgram2 /home/lvuser/FRCUserProgram&&. /etc/profile.d/natinst-path.sh;chmod a+x /home/lvuser/FRCUserProgram;/home/lvuser/run.sh' putkey: From 09fe0ca9c657e145d7657dea342121adba18d954 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 12 Feb 2015 21:18:48 -0500 Subject: [PATCH 18/18] Removed HH* files, changed auto, implemented encoder (untested) --- Commands/Autonomous/Autonomous.cpp | 5 ++-- Commands/Elevator/Raise.cpp | 4 +++ DentRobot.cpp | 12 ++++++-- HHBase.cpp | 28 ------------------ HHBase.h | 26 ----------------- HHRobot.cpp | 46 ------------------------------ HHRobot.h | 19 ------------ OI.cpp | 4 +-- OI.h | 2 ++ Subsystems/Elevator.cpp | 12 ++++++++ Subsystems/Elevator.h | 3 ++ 11 files changed, 34 insertions(+), 127 deletions(-) delete mode 100644 HHBase.cpp delete mode 100644 HHBase.h delete mode 100644 HHRobot.cpp delete mode 100644 HHRobot.h diff --git a/Commands/Autonomous/Autonomous.cpp b/Commands/Autonomous/Autonomous.cpp index bc64654..0d0df58 100644 --- a/Commands/Autonomous/Autonomous.cpp +++ b/Commands/Autonomous/Autonomous.cpp @@ -8,11 +8,10 @@ #include "../Collector/OpenCollector.h" #include "../Collector/CollectTote.h" Autonomous::Autonomous(){ - //AddSequential(new Raise()); - //AddSequential(new Lower()); - //AddSequential(new AutoDrive()); AddSequential(new Raise()); AddSequential(new Lower()); + AddParallel(new OpenCollector()); + AddParallel(new CloseCollector()); AddSequential(new Turn()); AddParallel(new AutoDrive()); AddParallel(new CloseCollector()); diff --git a/Commands/Elevator/Raise.cpp b/Commands/Elevator/Raise.cpp index 6f900b4..cd8885f 100644 --- a/Commands/Elevator/Raise.cpp +++ b/Commands/Elevator/Raise.cpp @@ -18,6 +18,10 @@ bool Raise::IsFinished(){ } } void Raise::End(){ + // If the elevator is at the top + if(DentRobot::elevator->GetElevatorTop()){ + DentRobot::elevator->SetUseEncoder(true); + } DentRobot::elevator->Run(0.0f); } void Raise::Interrupted(){ diff --git a/DentRobot.cpp b/DentRobot.cpp index f5eafec..e801009 100644 --- a/DentRobot.cpp +++ b/DentRobot.cpp @@ -1,4 +1,5 @@ #include "DentRobot.h" +#include "OI.h" #include "Commands/Autonomous/Autonomous.h" OI* DentRobot::oi=NULL; Collector* DentRobot::collector=NULL; @@ -32,12 +33,17 @@ void DentRobot::AutonomousPeriodic(){ Scheduler::GetInstance()->Run(); } void DentRobot::TeleopInit(){ - //if (aut != NULL){ - // aut->Cancel(); - //} + if (aut != NULL){ + aut->Cancel(); + } } void DentRobot::TeleopPeriodic(){ Scheduler::GetInstance()->Run(); + // TODO: Calibrate 1.0 to the height we want the elevator to automatically raise + if(elevator->GetUseEncoder()&&elevator->GetHeight()<=-1.0){ + // Raise the elevator if it dips below elevatorTop + oi->raise->Start(); + } } void DentRobot::TestPeriodic(){ } diff --git a/HHBase.cpp b/HHBase.cpp deleted file mode 100644 index 0023bc3..0000000 --- a/HHBase.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "HHBase.h" -#include -#include -#include -#include -HHBase::HHBase(): - hhbot(new HHRobot()){ - printf("Done\n"); - } -void HHBase::RobotInit(){ -} -void HHBase::DisabledInit(){} -void HHBase::AutonomousInit(){ -} -void HHBase::TeleopInit(){ -} -void HHBase::DisabledContinuous(){} -void HHBase::AutonomousContinuous(){} -void HHBase::TeleopContinuous(){} -void HHBase::DisabledPeriodic(){} -void HHBase::AutonomousPeriodic(){ -} -void HHBase::TeleopPeriodic(){ - hhbot->Handler(); -} -void HHBase::Test(){} -START_ROBOT_CLASS(HHBase); -// vim: ts=2:sw=2:et diff --git a/HHBase.h b/HHBase.h deleted file mode 100644 index c4e66e2..0000000 --- a/HHBase.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __HH_BASE_H__ -#define __HH_BASE_H__ -#include -#include -#include "HHRobot.h" -//Because this is the first header to be included, classes need to be declared here -class HHRobot; -class HHBase : public IterativeRobot{ - private: - HHRobot *hhbot; - public: - HHBase(); - void RobotInit(); - void DisabledInit(); - void AutonomousInit(); - void TeleopInit(); - void DisabledContinuous(); - void AutonomousContinuous(); - void TeleopContinuous(); - void DisabledPeriodic(); - void AutonomousPeriodic(); - void TeleopPeriodic(); - void Test(); -}; -#endif -// vim: ts=2:sw=2:et diff --git a/HHRobot.cpp b/HHRobot.cpp deleted file mode 100644 index 1020bc1..0000000 --- a/HHRobot.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "HHRobot.h" -#include "HHBase.h" -HHRobot::HHRobot(): - hhdrive(new RobotDrive(2,0,3,1)), - gyro(new Gyro(1)), - collector(new DentCollector(4, 5, 6, 7)), - driveStick(new Extreme3dPro(0)){ - hhdrive->SetExpiration(0.1); - hhdrive->SetInvertedMotor(RobotDrive::kFrontRightMotor, true); - hhdrive->SetInvertedMotor(RobotDrive::kRearLeftMotor,true); - } -void HHRobot::Init(){ - printf("Initing\n"); - printf("Code Version: %f\n",0000.1); - gyro->Reset(); -} -//Main function used to handle periodic tasks on the robot -void HHRobot::Handler(){ - const float Kp = 0.3; - if(driveStick->GetJoystickButton(1)==1){ - hhdrive->MecanumDrive_Cartesian(driveStick->GetJoystickAxis("z"), 0, driveStick->GetJoystickAxis("x")); - }else if(driveStick->GetJoystickButton(2)==1){ - hhdrive->MecanumDrive_Cartesian(driveStick->GetJoystickAxis("z"), driveStick->GetJoystickAxis("y"), 0); - }else if(driveStick->GetJoystickButton(3)==1){ - hhdrive->Drive(driveStick->GetJoystickAxis("y"), driveStick->GetJoystickAxis("y")*Kp*-gyro->GetAngle()); - }else{ - hhdrive->MecanumDrive_Cartesian(driveStick->GetJoystickAxis("z"), driveStick->GetJoystickAxis("y"), driveStick->GetJoystickAxis("x")); - } - if(driveStick->GetJoystickButton(11)==1){ - collector->Collect(driveStick->GetThrottle()); - }else if(driveStick->GetJoystickButton(12)==1){ - collector->Collect(-driveStick->GetThrottle()); - }else if(driveStick->GetJoystickButton(9)==1){ - collector->Raise(driveStick->GetThrottle()); - }else if(driveStick->GetJoystickButton(10)==1){ - collector->Raise(-driveStick->GetThrottle()); - }else{ - collector->Rest(); - } - SmartDashboard::PutNumber("hambone1", driveStick->GetThrottle()); - SmartDashboard::PutNumber("hambone2", driveStick->GetJoystickAxis("joystick")); - SmartDashboard::PutNumber("hambone3", driveStick->GetRawJoystickAxis(3)); - printf("hambone2: %f", driveStick->GetThrottle()); - Wait(0.005); -} -// vim: ts=2:sw=2:et diff --git a/HHRobot.h b/HHRobot.h deleted file mode 100644 index f6dc004..0000000 --- a/HHRobot.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __ROBOT_H__ -#define __ROBOT_H__ -#include -#include "HHBase.h" -#include "classes/Collector.h" -#include "hhlib/input/controller/Joystick.h" -class HHRobot{ - private: - RobotDrive *hhdrive; - Gyro *gyro; - DentCollector *collector; - Extreme3dPro *driveStick; - public: - HHRobot(); - void Init(); - void Handler(); -}; -#endif -// vim: ts=2:sw=2:et diff --git a/OI.cpp b/OI.cpp index 54c4212..e01e119 100644 --- a/OI.cpp +++ b/OI.cpp @@ -20,8 +20,8 @@ OI::OI() { left1->WhileHeld(new CollectTote()); left2->WhileHeld(new ReleaseTote()); // Elevator - Raise* raise=new Raise(); - Lower* lower=new Lower(); + raise=new Raise(); + lower=new Lower(); JoystickButton *right3=new JoystickButton(rightStick, 3); JoystickButton *right4=new JoystickButton(rightStick, 4); JoystickButton *right5=new JoystickButton(rightStick, 5); diff --git a/OI.h b/OI.h index 7f0929f..357dbda 100644 --- a/OI.h +++ b/OI.h @@ -2,6 +2,7 @@ #define OI_H #include "WPILib.h" +#include "Commands/Command.h" class OI { @@ -11,6 +12,7 @@ class OI OI(); Joystick* GetRightStick(); Joystick* GetLeftStick(); + Command *raise, *lower; }; #endif // vim: ts=2:sw=2:et diff --git a/Subsystems/Elevator.cpp b/Subsystems/Elevator.cpp index 9264b4a..ffe24c3 100644 --- a/Subsystems/Elevator.cpp +++ b/Subsystems/Elevator.cpp @@ -5,10 +5,16 @@ Elevator::Elevator(){ elevatorEncoder=new Encoder(ELEVATOR_ENCODERA,ELEVATOR_ENCODERB,false); elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO); elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO); + // Checks if the elevator is drifting + useEncoder=false; } void Elevator::InitDefaultCommand(){ } void Elevator::Run(double power){ + // If we're not telling it to stop + if(power != 0.0){ + SetUseEncoder(false); + } motor->Set(power); } void Elevator::ResetEncoder(){ @@ -23,4 +29,10 @@ bool Elevator::GetElevatorBottom(){ bool Elevator::GetElevatorTop(){ return elevatorTop->Get(); } +void Elevator::SetUseEncoder(bool param){ + useEncoder=param; +} +bool Elevator::GetUseEncoder(){ + return useEncoder; +} // vim: ts=2:sw=2:et diff --git a/Subsystems/Elevator.h b/Subsystems/Elevator.h index bdc0c8d..5454063 100644 --- a/Subsystems/Elevator.h +++ b/Subsystems/Elevator.h @@ -9,6 +9,7 @@ class Elevator{ Encoder *elevatorEncoder; static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2; DigitalInput *elevatorBottom, *elevatorTop; + bool useEncoder; public: Elevator(); void InitDefaultCommand(); @@ -17,6 +18,8 @@ class Elevator{ double GetHeight(); bool GetElevatorTop(); bool GetElevatorBottom(); + void SetUseEncoder(bool); + bool GetUseEncoder(); }; #endif // vim: ts=2:sw=2:et