2015-01-16 19:49:16 -05:00
|
|
|
#include "DentRobot.h"
|
2015-02-12 21:18:48 -05:00
|
|
|
#include "OI.h"
|
2015-02-19 12:33:23 -05:00
|
|
|
#include "RobotMap.h"
|
2015-02-07 12:32:46 -05:00
|
|
|
#include "Commands/Autonomous/Autonomous.h"
|
2015-01-17 12:21:16 -05:00
|
|
|
OI* DentRobot::oi=NULL;
|
|
|
|
Collector* DentRobot::collector=NULL;
|
|
|
|
Drivetrain* DentRobot::drivetrain=NULL;
|
|
|
|
Elevator* DentRobot::elevator=NULL;
|
2015-02-10 20:12:41 -05:00
|
|
|
BinElevator* DentRobot::binElevator=NULL;
|
2015-02-07 12:50:36 -05:00
|
|
|
CommandGroup* DentRobot::aut=NULL;
|
2015-02-20 15:54:41 -05:00
|
|
|
Pneumatics* DentRobot::pneumatics=NULL;
|
2015-01-17 12:21:16 -05:00
|
|
|
DentRobot::DentRobot(){
|
|
|
|
oi=new OI();
|
|
|
|
collector=new Collector();
|
|
|
|
drivetrain=new Drivetrain();
|
|
|
|
elevator=new Elevator();
|
2015-02-10 20:12:41 -05:00
|
|
|
binElevator=new BinElevator();
|
2015-02-20 15:54:41 -05:00
|
|
|
pneumatics=new Pneumatics();
|
2015-02-26 12:18:23 -05:00
|
|
|
//CameraServer::GetInstance()->SetQuality(25);
|
|
|
|
//CameraServer::GetInstance()->StartAutomaticCapture("cam0");
|
2015-02-13 22:30:15 -05:00
|
|
|
//SmartDashboard::PutNumber("Auto Wait Time", 1.0);
|
|
|
|
//SmartDashboard::PutNumber("Auto Sequence", 0);
|
2015-02-20 08:28:49 -05:00
|
|
|
printf("The robot is on\n");
|
2015-01-16 19:49:16 -05:00
|
|
|
}
|
|
|
|
void DentRobot::RobotInit(){
|
2015-02-19 10:28:29 -05:00
|
|
|
SmartDashboard::PutNumber("CodeVersion",CODE_VERSION);
|
2015-02-24 12:02:30 -05:00
|
|
|
// Autonomous
|
|
|
|
// Sequence of autonomous command
|
|
|
|
SmartDashboard::PutNumber("Auto Sequence",1.0);
|
|
|
|
SmartDashboard::PutNumber("Auto Wait Time",1.0);
|
|
|
|
// If the robot will be picking up three totes in sequence 3
|
|
|
|
SmartDashboard::PutBoolean("Three totes", true);
|
|
|
|
// TODO: Calibrate the following two values
|
|
|
|
// Distance (in time) to auto zone
|
|
|
|
SmartDashboard::PutNumber("Auto Zone Distance", 1.0);
|
|
|
|
// Distance (in time) to auto tote (used in sequence 3)
|
|
|
|
SmartDashboard::PutNumber("Auto Tote Distance", 0.5);
|
|
|
|
|
|
|
|
// Elevators
|
|
|
|
SmartDashboard::PutBoolean("Bin Elevator Bottom", false);
|
|
|
|
SmartDashboard::PutBoolean("Bin Elevator Top", false);
|
|
|
|
SmartDashboard::PutBoolean("Elevator Bottom", false);
|
|
|
|
SmartDashboard::PutBoolean("Elevator Top", false);
|
2015-01-16 19:49:16 -05:00
|
|
|
}
|
|
|
|
void DentRobot::DisabledPeriodic(){
|
|
|
|
Scheduler::GetInstance()->Run();
|
|
|
|
}
|
|
|
|
void DentRobot::AutonomousInit(){
|
2015-02-24 12:02:30 -05:00
|
|
|
aut=new Autonomous(SmartDashboard::GetNumber("Auto Sequence"));
|
|
|
|
printf("Enabling Auto Sequence %f\n",SmartDashboard::GetNumber("Auto Sequence"));
|
2015-02-26 12:18:23 -05:00
|
|
|
//if(aut != NULL){
|
|
|
|
// aut->Start();
|
|
|
|
//}
|
2015-01-16 19:49:16 -05:00
|
|
|
}
|
|
|
|
void DentRobot::AutonomousPeriodic(){
|
2015-02-20 08:43:31 -05:00
|
|
|
printf("Running auto.\n");
|
2015-01-16 19:49:16 -05:00
|
|
|
Scheduler::GetInstance()->Run();
|
|
|
|
}
|
|
|
|
void DentRobot::TeleopInit(){
|
2015-02-12 21:18:48 -05:00
|
|
|
if (aut != NULL){
|
|
|
|
aut->Cancel();
|
|
|
|
}
|
2015-01-16 19:49:16 -05:00
|
|
|
}
|
|
|
|
void DentRobot::TeleopPeriodic(){
|
|
|
|
Scheduler::GetInstance()->Run();
|
2015-02-12 21:18:48 -05:00
|
|
|
// 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();
|
|
|
|
}
|
2015-01-16 19:49:16 -05:00
|
|
|
}
|
|
|
|
void DentRobot::TestPeriodic(){
|
|
|
|
}
|
2015-01-11 16:02:49 -05:00
|
|
|
START_ROBOT_CLASS(DentRobot);
|
2015-02-08 12:26:15 -05:00
|
|
|
// vim: ts=2:sw=2:et
|