Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Basic Autonomous Structures (http://www.chiefdelphi.com/forums/showthread.php?t=111511)

cammy:) 18-01-2013 01:21

Basic Autonomous Structures
 
2 Attachment(s)
So this is only my second week of being in FRC to be exact, so I'm pretty new here... forgive me if my questions are... weird, or whatever.

Recently I've been trying to teach myself LabView, with some slow progress.... however, some assistance from more experienced people could help a lot.

Right now I'm trying to program a simple practice autonomous program, allowing the robot to simply drive in a square when the button is clicked. It said that it was runnable, however when I tried to run it, it said there were errors with the 2-motor drive open WPI and some other things as well... :confused: I attached a picture of the current program and one of my SubVIs (hopefully it appears.......)

Anyway, it'd be really helpful if someone... told me if anything's wrong with my program, or if there are any basic structures that I'm missing....? Yeah... just let me know what to change to make it work.

Thank you! :D

Greg McKaskle 18-01-2013 06:39

Re: Basic Autonomous Structures
 
One suggestion, for the code on the left is to consider using a For loop for things that run a computed number of iterations. It is less flexible than a while loop, but takes less code and is more obvious that it runs four iterations. I don't believe you need the delay in the loop. Each movement will take far longer than 50ms, so the delay is doing no harm, but having no effect but to generate a bit more scheduling code.

The code on the right seems to assume that it takes 20ms for the Tank RobotDrive icon to return, when in reality, it is closer to 1ms. That means your loop will finish really quickly and not do what you want. Place a 20ms delay into your loop, similar to how you did the code on the left.

As for the error messages, that is most likely because you have already opened the RobotDrive with PWM 1 and 2 elsewhere in your program, such as in Begin.

While it is possible to open and close the autonomous resources directly like this, it is more common to open them all in Begin and store them in a named registry. Then in autonomous and elsewhere, you retrieve them by name. Those icons are next to the Open in the palette.

Greg McKaskle

cammy:) 18-01-2013 16:18

Re: Basic Autonomous Structures
 
ohh.... thank you! That helps so much. :)

so just making sure... I should take out the 50 millisecond wait from the main one and add a 20 millisecond wait in the SubVI. and also taking out the open and close part.

well, thanks :) it really helps!

Greg McKaskle 18-01-2013 21:11

Re: Basic Autonomous Structures
 
Those are the suggestions.

Good luck.
Greg McKaskle

Doc Wu 19-01-2013 00:28

Re: Basic Autonomous Structures
 
Quote:

Originally Posted by Greg McKaskle (Post 1218235)
Those are the suggestions.

Good luck.
Greg McKaskle

Rather than reinvent the wheel, I'd also recommend looking at the examples in the Default Robot Project. There are two ways of doing a simple autonomous there inside disabled structures. All you need to do to play with them is enable them and change them to do what you need.

Once you understand what is happening there, you can emulate what they did when you write your own code.


All times are GMT -5. The time now is 10:48.

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