Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   GetLocation() or GetAlliance() (http://www.chiefdelphi.com/forums/showthread.php?t=104665)

DavisC 15-03-2012 20:05

GetLocation() or GetAlliance()
 
Hello,

I am wondering how to use either of the two functions (GetLocation() or GetAlliance()) whic gets the location or alliance off of the Driver Station.

I want to make it so that I can have 2 or more different autonomous'. How would I fully implement this?

Thanks,
Davis

DjScribbles 16-03-2012 10:16

Re: GetLocation() or GetAlliance()
 
You can actually read the joysticks during disabled. I setup a snippet of code this week to read the driver joystick and check if the trigger is held for 3 seconds, and switch to a different autonomous routine.
For reference, here's that chunk out of my code
Code:

static Timer button_combo_timer;
if (BUTTON_COMBO_SWITCH_AUTONOMOUS() == true)
{
    button_combo_timer.Start();
}
else
{
    button_combo_timer.Reset();
    button_combo_timer.Stop();
}

if (button_combo_timer.Get() > 3.00)
{
    button_combo_timer.Reset();
    switch (autonomousMode)
    {
    case AUTONOMOUS_MODE_1:
        autonomousMode = AUTONOMOUS_MODE_2;
    break;
    case AUTONOMOUS_MODE_2:
        autonomousMode = AUTONOMOUS_MODE_3;
    break;
    case AUTONOMOUS_MODE_3:
        autonomousMode = AUTONOMOUS_MODE_1;
    break;
    }
}
switch (autonomousMode)
{
    default:
    case AUTONOMOUS_MODE_1:
    driverStationLCD->PrintfLine((DriverStationLCD::Line) 3, "Using 1");
    break;
    case AUTONOMOUS_MODE_2:
    driverStationLCD->PrintfLine((DriverStationLCD::Line) 3, "Using 2");
    break;
    case AUTONOMOUS_MODE_3:
    driverStationLCD->PrintfLine((DriverStationLCD::Line) 3, "Using 3");
    break;
}
driverStationLCD->UpdateLCD();


DavisC 16-03-2012 20:28

Re: GetLocation() or GetAlliance()
 
Interesting, where would I place that to read it before a match?

Thanks

DjScribbles 22-03-2012 11:39

Re: GetLocation() or GetAlliance()
 
If your using iterative robot, in
Code:

void DisabledPeriodic(void){
}

I'm not sure if your using simple robot though :)


All times are GMT -5. The time now is 17:40.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi