Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Receiving info from OI to select autonomous mode (http://www.chiefdelphi.com/forums/showthread.php?t=34702)

Mr. Lim 15-02-2005 17:32

Receiving info from OI to select autonomous mode
 
I've tried searching for this topic, because I'm sure someone has mentioned this before, however:


Can I read values from the OI during autonomous mode?

All I want to do is read a few switches and joystick axes to select an appropriate autonomous mode to run, so they don't even need to be updated while autonomous mode is running.

It would be nice to know if I can use variables like p1_x, p3_sw_trig, etc without having to do anything special.

Thanks in advance!

AIBob 15-02-2005 17:41

Re: Receiving info from OI to select autonomous mode
 
It cannot read from OI during the autonomous mode, but you can read it before they (whatever at FIRST competitions that sets the modes) set it to autonomous mode

Travis Hoffman 15-02-2005 18:32

Re: Receiving info from OI to select autonomous mode
 
Code:

void SelectAutonomousProgram(void)
{
 
if (autonomous_mode)        //AUTONOMOUS MODE IS ACTIVE
{
        if (automode_LED == 0)
        {
                automode_LED = 1; //Turn on the autonomous LED when autonomous mode first starts
 
                DriveNeutral(); //Stop the drive motors.
 
                //Do other initial autonomous initialization stuff.
 
        }
}
else                //MANUAL MODE IS ACTIVE
{                       
        if (automode_LED == 1)
        {
                automode_LED = 0; //Turn off the autonomous LED
 
                DriveNeutral();        //Stop the motors
        }
 
        //Store the status of the LR side select switch
        sideselect = LRsideselect_sw;
 
        //Store the status of the Auto Drive Disable switch
 
        autodriveselect = smartdrivedisable_sw;
        //Calculate the autonomous program number set by the BCD switch on the button box --> positions 0-7 are valid. 8-9 are not
 
        autocode = (autoselect0 * 1) + (autoselect1 * 2) + (autoselect2 * 4);
 
}
 
} //End SelectAutonomousProgram


See the above code for reference - it's what I used last year. I call the SelectAutonomousProgram routine from Process_Data_From_Master_uP. To store any OI switch-driven settings I want to make available to the program once the match starts, I create variables (i.e. sideselect, autodriveselect, autocode) and write the status of the OI switches to them while the robot is in human control mode (which it is when it's powered on and disabled before match start). When autonomous mode starts, these variables are still available to the autonomous code while the OI switches, joysticks, etc. are being ignored. This routine also sets initial robot behavior when the bot first comes out of autonomous mode.

This year, we're using a 3-position toggle switch (wired to an analog input with the help of 22k and 47k resistors) and a BCD thumbwheel switch (8 distinct program options that consume three digital inputs) to yield 24 different autonomous program possibilities. The likelihood of me having the time to program our robot to do 24 different things in autonomous is almost nil, but that's beside the point.

Workaphobia 15-02-2005 18:34

Re: Receiving info from OI to select autonomous mode
 
Question: Are we allowed to use the OI while the robot is in disabled mode, before we have to step back and wait for autonomous to start?

If we can't touch the OI before autonomous, but can still transmit data, then I guess we'd have to use a set of switches to select a mode, since they don't require anyone to physically hold them in place.

Travis Hoffman 15-02-2005 19:17

Re: Receiving info from OI to select autonomous mode
 
Quote:

Originally Posted by Workaphobia
Question: Are we allowed to use the OI while the robot is in disabled mode, before we have to step back and wait for autonomous to start?

If we can't touch the OI before autonomous, but can still transmit data, then I guess we'd have to use a set of switches to select a mode, since they don't require anyone to physically hold them in place.

Really, if you use toggle switches or other devices which maintain their state once you set them, you don't have to wait for the robot to be turned on before setting up your controls at the player station. Just use the toggles to choose the autonomous settings you want and then step back behind the line and wait for the match to start. In your program, you still need to copy the OI variable values to your own custom variables in order for them to be accessible during autonomous, because all OI variables are reset once autonomous starts.

dlavery 15-02-2005 23:58

Re: Receiving info from OI to select autonomous mode
 
Quote:

Originally Posted by T. Hoffman
Really, if you use toggle switches or other devices which maintain their state once you set them, you don't have to wait for the robot to be turned on before setting up your controls at the player station. Just use the toggles to choose the autonomous settings you want and then step back behind the line and wait for the match to start. In your program, you still need to copy the OI variable values to your own custom variables in order for them to be accessible during autonomous, because all OI variables are reset once autonomous starts.

Actually, this would not work. A similar question came up in another thread, so I asked Tony Norman at IFI exactly how and when various data may be passed between the OI and RC. Tony double-checked and said that the field control system will not allow any data to be passed between the OI and the RC prior to the start of the match and the completion of the autonomous period. The OI and RC will both be active, but the field control system (which is different this year than last year) will prevent them from communicating.

So if you want to have a switch or dial setting to choose between autonomous programs, you should put it on the robot and not on the OI. The RC will be able to read the state of any switches, sensors, etc. that are local to the robot when it is powered up, and can use that information during the autonomous period.

Just to complete the story, if the robot is disabled later during the teleoperated period (like when the human player steps off the pressure pad sensor) communications between the RC and OI can continue. But the field control system will disable all the outputs from the RC so the system cannot activate any motors or actuate any other devices.

-dave

ace123 16-02-2005 02:19

Re: Receiving info from OI to select autonomous mode
 
I was also planning on using a switch for autonomous mode, but I guess I have a few more inputs for something else...

AS I was browsing through the code, I noticed this comment:
Code:

/* Initialize all PWMs and Relays when entering Autonomous mode, or else it
    will be stuck with the last values mapped from the joysticks.  Remember,
    even when Disabled it is reading inputs from the Operator Interface.
  */

This seems to say that inputs are still being read during the autonomous mode?

How do they prevent you from reading inputs during the first Disabled mode, but not later disabled modes after you leave the pad? Do you know how to simulate this outside of the competition or does disable mode automatically disable all OI inputs even after the first time?

My code reads the inputs and prints them out every frame (even autonomous) and every variable ended up at 0 for autonomous mode. It seems that instead, the values should be whatever they were before autonomous mode turned on, not reset to 0.

But, according to other team members, this is not true for disabled mode at the beginning, and you can be allowed to read inputs at some point.

Are the other experienced people on this team wrong? Is this rule new this year?

Kris Verdeyen 16-02-2005 02:46

Re: Receiving info from OI to select autonomous mode
 
A new wrinkle:

Posted on IFI's FAQ site yesterday:
Quote:

Originally Posted by People who wanna muddle issues
Can you verify that in the disabled mode, the robot still recieves input from the operator interface, but does not output to pwms or relays. If at the begining of a match, in the disabled mode, the operator sets some switches (stores it in some variable) to tell the robot which autonomous program to run. When the robot enters autonomous mode, it will be able to access the variable and know which program to run. Is this possible with the current hardware setup? So instead of placing switches on the robot to tell it which autonomous program to run, we can use switches connected to the operator interface.

Yes, the RC still receives data from the OI unit while the RC is Disabled. Also on the RC unit, all PWM Outputs are set to 127 and Relay Outputs are set to 0V. Yes, if the operator sets some switches on the OI and stores the data in some variables, the robot controller could access those variables during Autonomous Mode and know which program to run. So yes, you can have switches on the OI instead of the RC to tell which autonomous program to run as long as the switch data is stored in a different variable. All switch data from the OI during Autonomous Mode is set to 0.


Travis Hoffman 16-02-2005 08:41

Re: Receiving info from OI to select autonomous mode
 
Quote:

Originally Posted by Kris Verdeyen
A new wrinkle:

Posted on IFI's FAQ site yesterday:

Thanks, Kris. The specific detail of the FAQ post makes it hard to argue with what is posted - I'm inclined to listen to the IFI "techie geeks" who reply to those FAQ questions. I hope the FAQ is true because quite frankly, I can't see why IFI would ever disable such a convenient feature as setting autonomous parameters from the OI.

Dave, there seem to yet again be multiple conflicting answers to the same question. I'm not going to 100% say that the FAQ is true, but as I said, I'm inclined to believe the "straight from the geek's mouth" version. I'll leave it up to you to clarify this confusion with Mr. Norman and make sure everyone's on the same and correct page.

Thanks,

Alan Anderson 16-02-2005 08:41

Re: Receiving info from OI to select autonomous mode
 
Quote:

Originally Posted by dlavery
Actually, this would not work. A similar question came up in another thread, so I asked Tony Norman at IFI exactly how and when various data may be passed between the OI and RC. Tony double-checked and said that the field control system will not allow any data to be passed between the OI and the RC prior to the start of the match and the completion of the autonomous period. The OI and RC will both be active, but the field control system (which is different this year than last year) will prevent them from communicating.

Tony Norman and the IFI documentation disagree.

It sounds like Tony is describing autonomous mode, not disabled mode. With the documented features of the system, I know of no way to prevent the kind of communication required to implement a mode switch on the OI. If FIRST is using an undocumented "uber-disable" mode while the robots are being placed on the field, a whole lot of teams will be surprised to find they have no autonomous mode selection control.

The recent FAQ on the IFI site also contradicts Mr. Norman. It explicitly approves the kind of OI automode selection asked about in this thread. (It gets a technical detail incorrect, though -- disabled mode doesn't set the RC PWMs to 127, it turns them completely off.)

phillutz 16-02-2005 11:06

Re: Receiving info from OI to select autonomous mode
 
When in doubt, always err of the side of caution.
We will be placing the switches on the Robot.
No good just sitting there the 15 seconds. ;)

Mr. Lim 16-02-2005 11:08

Re: Receiving info from OI to select autonomous mode
 
Caveat:

Dave Lavery mentioned that this year's arena controller is different than last year's.

If this year's arena controller places robots in both autonomous mode AND disabled mode (they are independant control bits) before a match, then I would agree that OI switch data will never be passed to the RC. OI data would constantly be reset to 0.

Unfortunately, the details of the arena controller operation aren't really information most of us are privy to.

Can I respectfully request someone to contact IFI again, and attempt to garner a definitive answer?

In the meantime I think I'll err on the side of caution, and hook up our Autonomous selection to the RC's I/O.

-SlimBoJones...

Mark McLeod 16-02-2005 12:06

Re: Receiving info from OI to select autonomous mode
 
Quote:

Originally Posted by SlimBoJones
If this year's arena controller places robots in both autonomous mode AND disabled mode (they are independant control bits) before a match, ...

I witnessed this circumstance during the SBPLI regional last year. The autonomous mode bit would be set sometime during disable mode, then the disable mode turned off some number of seconds later.

Ian W. 16-02-2005 12:15

Re: Receiving info from OI to select autonomous mode
 
That code snippet could be just old stuff IFI never took out from last year, so don't completely trust it I'd say.

Couldn't someone test this with a simple dongle? There's two bits, Autonomous and Disable, nothing else (unless it's super secret and in that case all bets are off). So, if you have a dongle (or two paperclips), couldn't you easily test all scenarios of bits being on and off, there can't be that many combinations, and then post the results up here? I would think that's all you need, and I'd offer to do it, but I don't currently have access to an OI/RC.

Alan Anderson 16-02-2005 14:03

Re: Receiving info from OI to select autonomous mode
 
Quote:

Originally Posted by Alan Anderson
It sounds like Tony is describing autonomous mode, not disabled mode. With the documented features of the system, I know of no way to prevent the kind of communication required to implement a mode switch on the OI...

Whoops. SlimBoJones pointed out the way to do it. If the FIRST field system sets the autonomous mode pin active early, even before field setup, and doesn't release it until the beginning of teleoperated mode, that would indeed keep the robot from ever getting information from the OI controls until after the match begins.

It would also break every autonomous program I've ever seen, since they universally assume the autonomous_mode flag will become active at the start of the match. They would blindly start running as soon as communication with the OI was established, but the robot would still be disabled. Default code version 2.4 works that way. Can someone with both a copy of the "scripted autonomous" software and a grasp of the software issues involved look to see how it's handled there?


All times are GMT -5. The time now is 08:26.

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