mirror of
https://github.com/team2059/Zaphod
synced 2024-12-18 20:12:28 -05:00
Added NetworkTables support and fixed minor auto logic issues
This commit is contained in:
parent
1fd59a0a84
commit
ca3e5f513c
@ -1,4 +1,5 @@
|
||||
#include "HHRobot.h"
|
||||
#include "NetworkTables/NetworkTable.h"
|
||||
#include "HHBase.h"
|
||||
HHRobot::HHRobot():
|
||||
ControlSystem(new JoystickController()),
|
||||
@ -8,6 +9,7 @@ HHRobot::HHRobot():
|
||||
dashboard(new HHDashboard()),
|
||||
autoseq(new HHAuto()),
|
||||
sonar(new HHSonar()){
|
||||
netTable = NetworkTable::GetTable("datatable");
|
||||
}
|
||||
bool HHRobot::CheckJoystickValues(){
|
||||
float x=ControlSystem->rightJoystickAxisValues[1];
|
||||
@ -54,7 +56,7 @@ void HHRobot::RunAuto(){
|
||||
}
|
||||
//TODO Pass the shooting power and sonar distance as variables to the RunAuto function
|
||||
//Shoot at a power
|
||||
if(step == 1){
|
||||
if(step == 1 && time < 500){
|
||||
shooter->StartShootingSequence(0.78);
|
||||
}else{
|
||||
step = 2;
|
||||
@ -62,12 +64,15 @@ void HHRobot::RunAuto(){
|
||||
if(step == 2){
|
||||
return;
|
||||
}
|
||||
//Important periodic things
|
||||
netTable->PutNumber("AutoStep",step); //Debugging purposes
|
||||
time++;
|
||||
}
|
||||
|
||||
//Main function used to handle periodic tasks on the robot
|
||||
void HHRobot::Handler(){
|
||||
int targetAngle;
|
||||
bool allowCompressing = true;
|
||||
bool allowCompressing;
|
||||
//Periodic tasks that should be run by every loop
|
||||
ControlSystem->UpdateJoysticks();
|
||||
shooter->UpdateShooterPosition(targetAngle);
|
||||
|
@ -15,6 +15,7 @@ class HHRobot{
|
||||
private:
|
||||
Jaguar *right1, *right2, *right3, *left1, *left2, *left3;
|
||||
JoystickController *ControlSystem;
|
||||
NetworkTable *netTable;
|
||||
HHShooter *shooter;
|
||||
HHCollector *collector;
|
||||
HHCompressor *compressorSystem;
|
||||
|
Loading…
Reference in New Issue
Block a user