From d05dfd3e8d24e6a0bedfba4fdc7b6cff5636f25b Mon Sep 17 00:00:00 2001 From: Adam Long Date: Tue, 10 Jun 2014 14:33:10 -0400 Subject: [PATCH] Added a shooting power indicator to the dashboard with refreshing --- src/Subsystems/Dashboard.cpp | 5 ++++- src/ZaphodRobot.cpp | 6 ++++++ src/ZaphodRobot.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Subsystems/Dashboard.cpp b/src/Subsystems/Dashboard.cpp index fce31bc..60f2f8c 100644 --- a/src/Subsystems/Dashboard.cpp +++ b/src/Subsystems/Dashboard.cpp @@ -2,11 +2,14 @@ ZaphodDashboard::ZaphodDashboard() { + //Add Dashboard Initalizations here (for now) + SmartDashboard::PutNumber("Shooting Power", 0.0f); } float ZaphodDashboard::getKeyValue(const char* key) { - return 1.0f; + float value = SmartDashboard::GetNumber(key); + return value; } bool ZaphodDashboard::putKeyValue(const char* key, float value) diff --git a/src/ZaphodRobot.cpp b/src/ZaphodRobot.cpp index 28afde8..b093bd1 100644 --- a/src/ZaphodRobot.cpp +++ b/src/ZaphodRobot.cpp @@ -89,6 +89,11 @@ void ZaphodRobot::driveRobot(float x, float y) left3->SetRaw(int(leftPower)); } +void ZaphodRobot::updateDashboard() +{ + dashboard->putKeyValue("Shooting Power", ControlSystem->throttle); +} + //Main function used to handle periodic tasks on the robot void ZaphodRobot::handler() @@ -100,6 +105,7 @@ void ZaphodRobot::handler() compressorSystem->compressorSystemPeriodic(); collector->updateCollector(shooter->isShooting, shooter->getAngle()); driveRobot(ControlSystem->rightJoystickAxisValues[3]+ControlSystem->rightJoystickAxisValues[1], -ControlSystem->rightJoystickAxisValues[2]); + updateDashboard(); //Button assignments to actions if(ControlSystem->leftJoystickValues[SHOOTER_FIRE]) diff --git a/src/ZaphodRobot.h b/src/ZaphodRobot.h index 461d86a..93f65df 100644 --- a/src/ZaphodRobot.h +++ b/src/ZaphodRobot.h @@ -30,6 +30,7 @@ class ZaphodRobot float getRearSonar(); bool checkJoystickValues(); void driveRobot(float,float); + void updateDashboard(); void handler(); }; #endif