Basic auto mode
This commit is contained in:
parent
07b2b64f3d
commit
1c51dc6e41
@ -44,6 +44,7 @@ private:
|
|||||||
RobotDrive drive;
|
RobotDrive drive;
|
||||||
Shooter shooter;
|
Shooter shooter;
|
||||||
Joystick driver_stick, operator_stick;
|
Joystick driver_stick, operator_stick;
|
||||||
|
Timer auto_clock;
|
||||||
|
|
||||||
// instance variables
|
// instance variables
|
||||||
bool pickupRunning; // don't want to spam the Talon with set messages. Toggle the pickup when a button is pressed or released.
|
bool pickupRunning; // don't want to spam the Talon with set messages. Toggle the pickup when a button is pressed or released.
|
||||||
@ -55,6 +56,15 @@ private:
|
|||||||
bool arcade;
|
bool arcade;
|
||||||
float shooter_power;
|
float shooter_power;
|
||||||
|
|
||||||
|
enum auto_states
|
||||||
|
{
|
||||||
|
START,
|
||||||
|
DRIVING_FORWARD,
|
||||||
|
STOP
|
||||||
|
};
|
||||||
|
|
||||||
|
auto_states auto_status;
|
||||||
|
|
||||||
LiveWindow *lw = LiveWindow::GetInstance();
|
LiveWindow *lw = LiveWindow::GetInstance();
|
||||||
SendableChooser *chooser;
|
SendableChooser *chooser;
|
||||||
const std::string autoNameDefault = "Default";
|
const std::string autoNameDefault = "Default";
|
||||||
@ -218,16 +228,45 @@ public:
|
|||||||
//Custom Auto goes here
|
//Custom Auto goes here
|
||||||
} else {
|
} else {
|
||||||
//Default Auto goes here
|
//Default Auto goes here
|
||||||
|
auto_status = START;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutonomousPeriodic()
|
void AutonomousPeriodic()
|
||||||
{
|
{
|
||||||
|
const float drivePower = 0.7;
|
||||||
LogCSVData();
|
LogCSVData();
|
||||||
if(autoSelected == autoNameCustom){
|
if(autoSelected == autoNameCustom){
|
||||||
//Custom Auto goes here
|
//Custom Auto goes here
|
||||||
} else {
|
} else {
|
||||||
//Default Auto goes here
|
//Default Auto goes here
|
||||||
|
switch (auto_status)
|
||||||
|
{
|
||||||
|
case START:
|
||||||
|
{
|
||||||
|
auto_clock.Start();
|
||||||
|
auto_status = DRIVING_FORWARD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DRIVING_FORWARD:
|
||||||
|
{
|
||||||
|
if (auto_clock.Get() > 5.0 )
|
||||||
|
{
|
||||||
|
drive.TankDrive(0.0, 0.0);
|
||||||
|
auto_status = STOP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
drive.TankDrive(drivePower, drivePower);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case STOP:
|
||||||
|
{
|
||||||
|
std::cout << "All done!\n" ;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user