2
0
mirror of https://github.com/team2059/Zaphod synced 2025-01-07 22:14:14 -05:00

Added a shooting power indicator to the dashboard with refreshing

This commit is contained in:
Adam Long 2014-06-10 14:33:10 -04:00
parent 4d176a607d
commit d05dfd3e8d
3 changed files with 11 additions and 1 deletions

View File

@ -2,11 +2,14 @@
ZaphodDashboard::ZaphodDashboard() ZaphodDashboard::ZaphodDashboard()
{ {
//Add Dashboard Initalizations here (for now)
SmartDashboard::PutNumber("Shooting Power", 0.0f);
} }
float ZaphodDashboard::getKeyValue(const char* key) float ZaphodDashboard::getKeyValue(const char* key)
{ {
return 1.0f; float value = SmartDashboard::GetNumber(key);
return value;
} }
bool ZaphodDashboard::putKeyValue(const char* key, float value) bool ZaphodDashboard::putKeyValue(const char* key, float value)

View File

@ -89,6 +89,11 @@ void ZaphodRobot::driveRobot(float x, float y)
left3->SetRaw(int(leftPower)); left3->SetRaw(int(leftPower));
} }
void ZaphodRobot::updateDashboard()
{
dashboard->putKeyValue("Shooting Power", ControlSystem->throttle);
}
//Main function used to handle periodic tasks on the robot //Main function used to handle periodic tasks on the robot
void ZaphodRobot::handler() void ZaphodRobot::handler()
@ -100,6 +105,7 @@ void ZaphodRobot::handler()
compressorSystem->compressorSystemPeriodic(); compressorSystem->compressorSystemPeriodic();
collector->updateCollector(shooter->isShooting, shooter->getAngle()); collector->updateCollector(shooter->isShooting, shooter->getAngle());
driveRobot(ControlSystem->rightJoystickAxisValues[3]+ControlSystem->rightJoystickAxisValues[1], -ControlSystem->rightJoystickAxisValues[2]); driveRobot(ControlSystem->rightJoystickAxisValues[3]+ControlSystem->rightJoystickAxisValues[1], -ControlSystem->rightJoystickAxisValues[2]);
updateDashboard();
//Button assignments to actions //Button assignments to actions
if(ControlSystem->leftJoystickValues[SHOOTER_FIRE]) if(ControlSystem->leftJoystickValues[SHOOTER_FIRE])

View File

@ -30,6 +30,7 @@ class ZaphodRobot
float getRearSonar(); float getRearSonar();
bool checkJoystickValues(); bool checkJoystickValues();
void driveRobot(float,float); void driveRobot(float,float);
void updateDashboard();
void handler(); void handler();
}; };
#endif #endif