|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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! |
|
#2
|
|||||
|
|||||
|
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
|
|
#3
|
||||||
|
||||||
|
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. |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
||||||
|
||||||
|
Re: Receiving info from OI to select autonomous mode
Quote:
|
|
#6
|
|||||
|
|||||
|
Re: Receiving info from OI to select autonomous mode
Quote:
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 |
|
#7
|
||||
|
||||
|
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.
*/
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? |
|
#8
|
|||||
|
|||||
|
Re: Receiving info from OI to select autonomous mode
A new wrinkle:
Posted on IFI's FAQ site yesterday: Quote:
|
|
#9
|
||||||
|
||||||
|
Re: Receiving info from OI to select autonomous mode
Quote:
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, |
|
#10
|
||||
|
||||
|
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. |
|
#11
|
|||||
|
|||||
|
Re: Receiving info from OI to select autonomous mode
Quote:
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.) |
|
#12
|
|||
|
|||
|
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. ![]() |
|
#13
|
||||
|
||||
|
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... |
|
#14
|
|||||
|
|||||
|
Re: Receiving info from OI to select autonomous mode
Quote:
|
|
#15
|
|||||
|
|||||
|
Re: Receiving info from OI to select autonomous mode
Quote:
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? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A little question about the autonomous mode | Anton | Programming | 4 | 18-01-2005 14:08 |
| Future of Autonomous Mode | FadyS. | Programming | 41 | 24-05-2004 19:45 |
| Blue Man Group FIRST get-together? | Gui Cavalcanti | Chit-Chat | 11 | 16-09-2003 18:11 |
| autonomous mode problem on field | Chris_C | Programming | 17 | 26-03-2003 19:11 |