|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Basic Autonomous Structures
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... 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! ![]() |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
||||
|
||||
|
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! |
|
#4
|
|||
|
|||
|
Re: Basic Autonomous Structures
Those are the suggestions.
Good luck. Greg McKaskle |
|
#5
|
|||||
|
|||||
|
Re: Basic Autonomous Structures
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|