Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Cross Mode Variables? (http://www.chiefdelphi.com/forums/showthread.php?t=37409)

Mr. Steve 17-04-2005 23:13

Cross Mode Variables?
 
Do Variables carry over from autonomous to controlled and vice versa? I know they remain intact when disabled is on/off so it would stand to reason that they would carry over here as well.

Thanks

AIBob 17-04-2005 23:16

Re: Cross Mode Variables?
 
It should, because between autonomous and user controlled mode, they just allow input from the OI to be read, and unset the Autonomous Mode bit, but other than that, it should be the same.

Alan Anderson 17-04-2005 23:57

Re: Cross Mode Variables?
 
Global variables will work just as you expect. Local static variables, by design, are accessible only from within the functions they are defined in. Since the default code calls one function in teleoperated mode and a different function in autonomous mode, only global variables will be useful.

dm0ney 21-04-2005 07:49

Re: Cross Mode Variables?
 
I believe that the question is 'If I update a variable, will that value be available to me in both modes?'

If you have defined a user variable, the values are NOT rewritten when modes are changed. OI related variables are cleared in the switch from user mdoe to autonomous.

dcbrown 25-01-2006 11:14

Re: Cross Mode Variables?
 
1 Attachment(s)
Rather than start another thread, and this one seemed pretty close.

Could folks comment on the following state diagram? We're trying to understand the flow of the game from the robot controller state perspective?

Is this correct? Are there other states to be concerned with? Missing or incorrect state transitions?

Thanks,
DCBrown

JBotAlan 25-01-2006 11:56

Re: Cross Mode Variables?
 
I know this sounds ignorant, but that's because it is. I got lost in that diagram about five seconds after I opened it. It could be perfectly fine, I just don't really know how to read it. :o

JBotAlan

Mr. Steve 25-01-2006 16:06

Re: Cross Mode Variables?
 
Hey this is my thread :)

It took me a second to understand that diagram, but for the most part it makes sense. I don't really think there's a disabled/autonomous mode but rather just 3 options..

-Disabled
-Enabled - Autonomous
-Enabled - User Control

Andrew Blair 25-01-2006 16:14

Re: Cross Mode Variables?
 
Quote:

Originally Posted by Mr. Steve
Hey this is my thread :)

It took me a second to understand that diagram, but for the most part it makes sense. I don't really think there's a disabled/autonomous mode but rather just 3 options..

-Disabled
-Enabled - Autonomous
-Enabled - User Control

Yes, and one odd one, autonomous and disabled. Don't know when that one happens...

Ryan M. 25-01-2006 16:19

Re: Cross Mode Variables?
 
Technically speaking, you can set it to "disabled autonomous," which as far as I know runs autonomous, but doesn't send the output out... just like in regular disabled.

Eldarion 25-01-2006 16:26

Re: Cross Mode Variables?
 
Quote:

Originally Posted by Ryan M.
Technically speaking, you can set it to "disabled autonomous," which as far as I know runs autonomous, but doesn't send the output out... just like in regular disabled.

Disabled overrides autonomous, I.E. when both are set, the robot acts as if only the Disabled bit was set.

As soon as the Disabled bit is cleared, the robot runs the autonomous initialization and then runs the autonomous loop.

JBotAlan 25-01-2006 16:32

Re: Cross Mode Variables?
 
Quote:

Originally Posted by Ryan M.
Technically speaking, you can set it to "disabled autonomous," which as far as I know runs autonomous, but doesn't send the output out... just like in regular disabled.

Hmm...I'd better code that case into my code...

I'm hijacking this thread from the thread hijacker! :)

I realized that in the default code, when autonomous starts, the User_Autonomous_Code (I think) enters into an infinite loop, where the Process_Data_From_Master_uP and Process_Data_From_Local_IO functions are not called. Now, I realize that I don't want to process I/O that isn't valid during auton, but all the camera initialization and tracking code is there in the functions that aren't called during auton. Do you forsee any problems with removing this loop and just processing auton every 26 ms? That's all I really need. It seemed to run fine on our system, but I don't know if there would be any issues with competition.

Thanks,
JBotAlan

Ryan M. 25-01-2006 17:43

Re: Cross Mode Variables?
 
Quote:

Originally Posted by JBotAlan
Hmm...I'd better code that case into my code...

Verify which way it works before putting work into doing code...
Eldarion (above) says that autonomous holds until disable is removed. I don't know which way it is for sure.

duane 26-01-2006 01:45

Re: Cross Mode Variables?
 
Quote:

Originally Posted by Mr. Steve
I don't really think there's a disabled/autonomous mode but rather just 3 options..

-Disabled
-Enabled - Autonomous
-Enabled - User Control

The state of two inputs can't change at (exactly) the same time. I expect that autonomous mode is on before disabled is off:
->Disabled/not Autonomous
->Disabled/Autonomous
->Enabled/Autonomous
->Enabled/Not Autonomous

Alan Anderson 26-01-2006 07:19

Re: Cross Mode Variables?
 
Whether or not the two inputs can change simultaneously doesn't really matter here. The flags in the data packets can, and do. Regardless of the state of the autonomous input, if the disable input on the competition port is active, the robot is executing the teleoperated code, not the autonomous code.

This is true with a 2005 OI and RC, anyway. I'll discover if it's still true with the 2006 system as soon as we start scripting our autonomous routines.

dcbrown 26-01-2006 12:09

Re: Cross Mode Variables?
 
Quote:

It took me a second to understand that diagram, but for the most part it makes sense. I don't really think there's a disabled/autonomous mode but rather just 3 options..
My guess is that autonomous is applied to all 'bots on the field, and robot disables are both individual along with a global field disable. So if you are disabled for rules infraction while in autonomous mode, then I'd expect autonomous would be still active but your individual robot would have disabled applied. The robot state would then be !Enabled/Autonomous state.

It might seem esoteric, but what if you wanted to do something in the last 4 seconds of autonomous period... like gain a certain field position... to set up for manual play. Yeah, I know you might not have won the autonomous period so might be putting the robot in the WRONG position but that is part of the fun of selecting autonomous strategy. So, you'd like to know in the code how much time you have left. If you start counting when autonomous is enabled but disabled is still applied then you'd be counting time wrong. I suspect these two input changes happen very close together, but still I'd rather understand the risks associated with states we're ignoring vs get surprises during competition events.

Regards,
DCBrown

Eldarion 26-01-2006 13:15

Re: Cross Mode Variables?
 
Quote:

Originally Posted by dcbrown
My guess is that autonomous is applied to all 'bots on the field, and robot disables are both individual along with a global field disable. So if you are disabled for rules infraction while in autonomous mode, then I'd expect autonomous would be still active but your individual robot would have disabled applied. The robot state would then be !Enabled/Autonomous state.

It might seem esoteric, but what if you wanted to do something in the last 4 seconds of autonomous period... like gain a certain field position... to set up for manual play. Yeah, I know you might not have won the autonomous period so might be putting the robot in the WRONG position but that is part of the fun of selecting autonomous strategy. So, you'd like to know in the code how much time you have left. If you start counting when autonomous is enabled but disabled is still applied then you'd be counting time wrong. I suspect these two input changes happen very close together, but still I'd rather understand the risks associated with states we're ignoring vs get surprises during competition events.

Regards,
DCBrown

It would seem pretty simple to start counting in the autonomous initialization routine, as it will not be executed until the actual autonomous mode starts. :)

dcbrown 26-01-2006 14:34

Re: Cross Mode Variables?
 
Quote:

Originally Posted by Eldarion
It would seem pretty simple to start counting in the autonomous initialization routine, as it will not be executed until the actual autonomous mode starts. :)

We have a interrupt driven system clock. It is always running in the background and we want it to figure out when to start/stop wall clock accumulation on its own.

Regard,
DCBrown


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

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