From e3b80c65131f7636d2dfc7e10384cda26e9abcb1 Mon Sep 17 00:00:00 2001 From: Adam Long Date: Sat, 17 Jan 2015 12:28:12 +0000 Subject: [PATCH] Added compressor auto-disable --- src/HHBase.cpp | 3 +++ src/HHRobot.cpp | 12 ++++++++++-- src/HHRobot.h | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/HHBase.cpp b/src/HHBase.cpp index 0023bc3..6afbc03 100644 --- a/src/HHBase.cpp +++ b/src/HHBase.cpp @@ -8,11 +8,14 @@ HHBase::HHBase(): printf("Done\n"); } void HHBase::RobotInit(){ + hhbot->Init(); } void HHBase::DisabledInit(){} void HHBase::AutonomousInit(){ + hhbot->Init(); } void HHBase::TeleopInit(){ + hhbot->Init(); } void HHBase::DisabledContinuous(){} void HHBase::AutonomousContinuous(){} diff --git a/src/HHRobot.cpp b/src/HHRobot.cpp index 5f6f401..9466634 100644 --- a/src/HHRobot.cpp +++ b/src/HHRobot.cpp @@ -2,15 +2,17 @@ #include "HHBase.h" HHRobot::HHRobot(): DriveStick(new Extreme3dPro(0)), + AirCompressor(new Compressor(30)), + PowerDistPanel(new PowerDistributionPanel()), //FrontRight,FrontLeft,RearRight,RearLeft RobotDrive(new MecanumDrive(40,41,42,43)){ } void HHRobot::Init(){ printf("Initing\n"); - printf("Code Version: %f\n",0000.1); } //Main function used to handle periodic tasks on the robot void HHRobot::Handler(){ + //Code to lock the axis when driving double x,y,z; if (DriveStick->GetJoystickButton(1)){ y = 0; @@ -26,6 +28,12 @@ void HHRobot::Handler(){ x = DriveStick->GetJoystickAxis("x"); z = DriveStick->GetJoystickAxis("z"); } - RobotDrive->handler(x,y,z,0); + //X axis, Y axis, Z axis, acceleration, threshold, gyro + RobotDrive->handler(x,y,z,0.5,1,0); + + //Disables the compressor if the battery voltage is detected to be less than 10 volts + if (PowerDistPanel->GetVoltage()<=10){ + AirCompressor->Stop(); + } } // vim: ts=2:sw=2:et diff --git a/src/HHRobot.h b/src/HHRobot.h index c1f7b60..91d4033 100644 --- a/src/HHRobot.h +++ b/src/HHRobot.h @@ -7,6 +7,9 @@ class HHRobot{ private: Extreme3dPro *DriveStick; + //CAN Devices + Compressor *AirCompressor; + PowerDistributionPanel *PowerDistPanel; MecanumDrive *RobotDrive; public: HHRobot();