Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Autonomous runs during Teleop (http://www.chiefdelphi.com/forums/showthread.php?t=83951)

Ether 15-03-2010 16:27

Re: Autonomous runs during Teleop
 
Quote:

Originally Posted by garrettg (Post 937416)
This should be the code in it's broken entirety. Enjoy.

OK Greg, the ball's in your court :-)


~

Vikesrock 15-03-2010 16:28

Re: Autonomous runs during Teleop
 
Quote:

Originally Posted by Greg McKaskle (Post 936733)
Next using either Find or the hierarchy window, determine if you are explicitly calling the Autonomous Independent VI.

Greg McKaskle

As you predicted, this is the issue. You can see in the attached code posted above that the call from Robot Main that is typically to Autonomous Iterative has been replaced with a call to Autonomous Independent.

For any others having this problem this is a good first thing to check. To use Autonomous Independent, the only thing you have to do is make sure that the enum at the top of Begin.VI is set to Independent and then place your code inside the existing Autonomous Independent VI accessed from the Project Explorer.

Ether 15-03-2010 16:43

Re: Autonomous runs during Teleop
 
Quote:

Originally Posted by Vikesrock (Post 937429)
As you predicted, this is the issue. You can see in the attached code posted above that the call from Robot Main that is typically to Autonomous Iterative has been replaced with a call to Autonomous Independent.

For any others having this problem this is a good first thing to check. To use Autonomous Independent, the only thing you have to do is make sure that the enum at the top of Begin.VI is set to Independent and then place your code inside the existing Autonomous Independent VI accessed from the Project Explorer.

Hi Kevin,

Do you know if there's a document somewhere which clearly explains this? If so, I want to make sure our programmers go read it thoroughly. They're working on autonomous now.

Thanks.

~

garrettg 15-03-2010 16:55

Re: Autonomous runs during Teleop
 
So I should replace auto indep in robot main with the iteritive VI, and then that code should work?

Zme 15-03-2010 17:02

Re: Autonomous runs during Teleop
 
that, and from what it sounds like, make sure that the begin.vi states that you are using the autonomous independent function instead of iteritive. this seems a little counter intuitive to me but if it works then it would save people a lot of time.

please try it and let us know how it goes

Vikesrock 15-03-2010 17:04

Re: Autonomous runs during Teleop
 
Quote:

Originally Posted by garrettg (Post 937442)
So I should replace auto indep in robot main with the iteritive VI, and then that code should work?

Greg could tell you with more certainty than I can, but yes that is what appears to be wrong with the code. The Autonomous Independent VI is called from inside the Get Competition Mode VI by the default code when the mode in Begin is set to Independent and is aborted by the same VI when the mode is switched away from Autonomous.

Because your call was separate it was not being aborted by the Get Competition Mode VI.

Ether,
I will look around and see if this is spelled out in any documentation I have at the moment or not. I learned a lot of this through reading the comments that are in the default code and poking around inside some of the VIs such as the Get Competition Mode VI.

garrettg 15-03-2010 17:15

Re: Autonomous runs during Teleop
 
Our robot is currently out of the bag for the next hour and 45 minutes, so I will test this adjustment when build gets build problems out of the way (I might not get to try this today, but should be able to try tomorrow).

Edit: I was able to test it today, and the change of having Iteritive in Robot Main got Independent to kick out on time. I don't understand why though. Anyone mind explaining in the clearest way possible why Iteritive needs to run if you want Independent? All help given is greatly appreciated, and I doubt I'm the only one to have changed Robot Main like this.

Greg McKaskle 15-03-2010 20:43

Re: Autonomous runs during Teleop
 
I just got home from work and looked at the code. To fix the auto that won't stop, delete the call from the Robot Main. It is not necessary to call the iterative there as it is an empty template anyway.

Begin VI is still set for using Independent, and the AutoIndependent VI is the one that it will call and abort.

I'll post again with more explanation of what the framework does, why this behaved the way it did, and where the docs are.

Good Luck with your auto.
Greg McKaskle

Greg McKaskle 15-03-2010 21:24

Re: Autonomous runs during Teleop
 
There are tutorials on NI.com/first and on the LVMastery.com sites. I'll admit that I didn't write them, and I haven't watched all of them for correctness, but they should show how to write the autonomous that works.

The other documentation on the framework is in the code itself. The green comment to the left of the loop in RobotMain states

Quote:

Robot Main implements the framework and scheduler for your robotics program.

It should not be necessary to modify the framework. You should be able to implement your code within the following VIs. ...
As usual, more documentation can be added, especially once we know what the misunderstandings are. Actually, no final decision yet, but we may look at some simplifications while we are at it. The initial framework was a widely cast net, intended to support many different programming styles and abilities. Now that we've seen what most teams prefer to use, I think it can be vastly simplified.

Back on topic, the auto was supported in two ways, independent and iterative. Iterative is basically the same as TeleOp -- called for each packet, expected to complete in under 20ms, and no easy support of sequences or repetitive code. Independent, on the other hand, is called once asynchronously, is automatically aborted when auto is over, making it east to do sequences and repetitive tasks. The way Iterative is called is pretty obvious, a subVI call for each packet. Independent is less obvious. In Begin, a VI reference is designated as being the AutoIndependent VI reference. Then the Get Mode VI in the Robot Main loop will automatically run the referenced VI when auto begins and abort it when the period completes. The syntax for calling and aborting was intentionally hidden in part because it is complicated by the different state transitions of the DS, and partly to prevent it form becoming broken by curious programmers.

By adding a subVI call to Auto Independent, the Run method will return an error. It is a little complicated, but VIs have a number of states they can be in (Broken, Idle, Active, Running, Reserved, Suspended, and I'm sure more that I can't remember off the top of my head) which define the operations that are valid on the VI. Run only works on Idle VIs. SubVIs are Reserved by their caller, so are not runnable because the are callable. Anyway, For that reason, I'm pretty sure the VI refnum was invalid so that Abort also failed. To be more sure what the value of the refnum was from the failed Run, I'll need to run that app.

Anyway, if there are any more questions or any more things to learn from this, fire away.
Greg McKaskle

Madification 15-03-2010 22:10

Re: Autonomous runs during Teleop
 
Our bot is definately doing the same thing but I'm Build and Chairman's team so I have no idea what you're talking about lol I'll get our programmer to look at this.

Greg McKaskle 15-03-2010 22:25

Re: Autonomous runs during Teleop
 
If you can't find the issue, post code to this thread. There are lots of people willing to help.

Greg McKaskle


All times are GMT -5. The time now is 01:31.

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