FIRST Tech Challenge Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How stop autonomous actions when go disabled? (Archived)

Update: This discussion applies to Issues from the 2010 FTC season and is no longer relevant for current FTC competition software.


If we put a sequence of Move blocks and Wait blocks in the while loop box at the bottom of the FTC Autonomous template, how do we make them stop when Disabled?

The While Loop runs until "disabled", but it seems like it runs everything within the while until completion (once) every iteration of the while loop.

The more general question is "how do I get out of the middle of a sequence of function blocks".

The attached example has a simple sequence of tones and waits, and after Disable, one or 2 Tones are still played.

Is there a way to bail out mid-stream?

(note: in case the answer is, "after Autonomous period ends, the Field Controller kills your program", I am still interested in ways to skip out of a sequence in the middle because in teleop mode we also have a sequence of things we want to repeat until some condition happens, but we want to stop the sequence as soon as the condition happens, not wait until the end of the sequence).

Advice appreciated.  Perhaps this approach is all wrong.

Thanks,

David Fort

0 Kudos
Message 1 of 4
(6,701 Views)

I feel your pain.  I tried to do what you want last year, but gave up this year and lived with the "the FCS kills the program".

Last year I created some smarter move blocks that also checked the status of the Enabled flag.

Since the NXT doesn't support Global variables, you need to be smart how you share the state of a variable between VIs'

I created a "Get_Set_Enabled" VI that could be used to read or write the enabled state by just holding it within that VI.

There's a fancy name for this in LabVIEW but I forget what it is.  It just uses a one-oteration loop with a shift register to hold the value.

Once the Enabled flag went false, the move blocks just bypassed the code.

It's possible that you could do it with the NXT Error code that gets passed between FTC blocks.  If the Error status is set true, most of the blocks just do nothing, so they would terminate very quickly.

Phil.

Get a life? This IS my life!
0 Kudos
Message 2 of 4
(2,873 Views)

Functional Global Variables is the Fancy Name.

(took me a while to remember it too. I saw it in an earlier quest for

information about shift registers)

http://decibel.ni.com/content/docs/DOC-2143

0 Kudos
Message 3 of 4
(2,873 Views)

This issue is actually caused by a race condition in the Autonomous templates.  This condition also existed in last years templates.  This is one of the issues addressed in the FTC Toolkit 2010f4 patch.  You can install this update on top of your existing FTC install without issue.  That said if you already have a lot of code in the f3 templates it could take some time to migrate it over to the f4 templates.

Mark
NI App Software R&D
0 Kudos
Message 4 of 4
(2,873 Views)