Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Would Someone mind looking over my autonomous. (http://www.chiefdelphi.com/forums/showthread.php?t=94305)

j.cole 04-04-2011 18:19

Would Someone mind looking over my autonomous.
 
I'm not sure if what I'm doing is right at all because I have no robot to test it with but here it is. Before I split every command into its own while loop the robot was giving me some weird outputs with the arm always going to where I want it to go at first and then sometimes driving the full 3 seconds and sometimes not driving till the arm stopped.

WizenedEE 04-04-2011 18:36

Re: Would Someone mind looking over my autonomous.
 
  • Neither the top triplet nor the bottom triplet of while loops has a delay in them
  • You may want to change those waits to the other kind of wait (wait until next multiple), becuase that's more accurate.
  • The top triplet of loops will all execute at the same time; put a wire between them or use a sequence structure
  • You may want to combine all of the stages of the top 9 loops into one, so they stay synchronized.
  • When you stop on the last loop, you probably want to just put a false constant for the while loop so that it never ends; that way, the motors kept getting written to and don't give errors
  • In the bottom loop, why do you write to a global and then immediately read it again instead of just using a wire?
  • Check to see if there's a better way to calibrate the encoders than to just add a constant, but there may not be.
  • To make it more readable, you may want to replace some of those one-input-one-output case structures with selects
  • Instead of putting a not in the wire and then having a case structure, you could just swich around the cases. Again, not that important.
  • Comments might be nice, but again not too important
  • Your code is extremely clean, I'm impressed... I just punch the built in clean up button and live with it :)

That's everything I could find. Good luck with it though!

j.cole 04-04-2011 19:27

Re: Would Someone mind looking over my autonomous.
 
1 Attachment(s)
  • Fixed idk how I missed that
  • Ill stick with the normal Waits for now unless I get a problem.
  • Put them in a sequence structure
  • I had problems when I did that also this way I have more customization.
  • Did that
  • That was to 1.clean it up and 2.It was done in teleop where I call those values in weird places. (I assume your talking about the Rotate Max/Min)
  • That's there to make a physical 90 deg into a virtual 90 deg
  • That's how it is in teleop I like consistency.
  • Consistency
  • I've been told and I try.
  • I'm really anal about it and I spend almost twice as much time cleaning code as I do writing it. An NI rep was checking out my code and added some things that weren't perfectly wired I was twitching till I fixed it. You should see my teleop

vhcook 04-04-2011 19:56

Re: Would Someone mind looking over my autonomous.
 
- If you're controlling your while loop exit condition entirely by the iteration number, why not use a for loop instead?

- Regarding the top nine loops, I think what you might really want to do here is combine your left three loops into one loop, then do the same thing with the middle three and the right three. Based on what you're doing with the iteration counter and the stop button, you seem to want each vertical trio to iterate at the same speed and terminate at the same time. Combining them would reduce the amount of CPU utilization involved as you wouldn't be running multiple waits and multiple instances of the same floating point arithmetic at once. On the other hand, if you're not entirely sure that you really want the timings identical, this may be your best bet.

- Similarly, rather than doing the floating point math on your loop control constants every pass, you could do that outside the loop and pass the value inside on a wire. You could also use a single constant and explain the math it came from in a comment. This isn't going to be terribly important unless you find you're using too much CPU, but every little bit helps.

j.cole 05-04-2011 23:01

Re: Would Someone mind looking over my autonomous.
 
-Its just the way the tutorial says to do it and if it aint broken (to my knowledge) why fix it

-I tried that and with PiD it doesn't like to work all of the time(at least I think that's what is happening) It won't run anything else until the PiD setpoints are met.

-As in first comment

mesamb1 06-04-2011 13:57

Re: Would Someone mind looking over my autonomous.
 
I sympathize with your clean code and the NI rep. I make all of my students clean up their code so often they complain labview is more about being organized then knowing computes(but with good comments they can fine problems right away :) ) .

Our team did PID controllers for giggles this season. I am a C.S. and Math person working with a professional automation engineering mentor, so nerdy enough to read the NI manual on PID. The controller actually wants a percent. It just the difference between set point, and process variables(there is more then that, but it is a little more complicated then you can explain over a forum). I dont think it will help your drive issues, but if you send the PID a percent and give it a range between 100 to -100 then divide by 100 you will get a much better motor curve.

How did you go about setting your PID gains?

Please combine those three sets of loops, there is no reason you should separate them, and your timing becomes precise, and since your not driving off of floor sensors then you need that to be right!

The variables could cause the sporadic driving. I do not think they are, but what will save you a lot of trouble is if you place the arm movement part in a subvi. then call the subvi with the the two set points that you want in the arcade drive loop(the subvi will make your telop cleaner too!!)

As a member of the smoky mountain planning committee I hope you had a great time!! thanks for coming to Knoxville!

Travis Hoffman 06-04-2011 14:17

Re: Would Someone mind looking over my autonomous.
 
Thanks to all so far for providing help. Jordan is the hardest-working programming student we have in these here parts, and he's learned far more about LabVIEW than I'd ever care to learn. I'm expecting him to teach me and other NEOFRA students and mentors this offseason, once he's done figuring it all out. :p

Until then, I shall remain comfortably in my faster compile and download C++ fantasy land! Tra la la....

j.cole 06-04-2011 15:41

Re: Would Someone mind looking over my autonomous.
 
Yeah she helped me a lot and I appreciate all her work it was just kinda throwing me off. She spent a lot of time over with us lookin at the code.

I never thought of leaving it at 100 & -100 but that's a good idea. I haven't had any problems with accuracy but if I do I'll keep that in mind.

I made a graph on the front panel of the teleop with the setpoint and the process variable. Then we had a mentor there that could look at the graph and figure out what needed to change in our gains also we left out a I because it's dangerous and unnecessary. So basically its a visual tune.

As of now I'd rather not recombine them because I wanna see if it works first.

That's what I'm thinking for why I'd rather not recombine them.

Knoxville was a lot of fun and I think all of the teams were surprised at how smoothly everything was going I think all of our other students said they liked it too. I'd like to go back in the future but it probably won't happen while I'm a student.

mesamb1 06-04-2011 16:06

Re: Would Someone mind looking over my autonomous.
 
Well thank you so much for joining us for our rookie regional. Glad to hear you guys liked it!!

I, personally, had expected multiple field failures, but the nice thing about being week 5 is that the field techs have all of that stuff under control.

[Travis Hoffman, you have a great student! it is really done well and is particularly ambitious with out a labview mentor, but I shake my fist at your c++ compiler]

I would argue about the I variable(if it was giving dangerous results, you could be seeing some round off errors there), but that is as good as anyway to tune it.

If you have the time tonight(you may be swamped). In a very separate folder from your normal code(careful not to get a dependency error in your main code) just recreate your autonomous code in a subvi(just download the file you uploaded with a new name, and create a global variable file in the folder). then get rid of all of the motor references, and just set the arm to always be where it is desired. Then graph the drive output. It is not slick but it will give you a timing idea of how long things are being run. If your code is waiting for a variable, not running at the same time, ect. that will show up in the graphs. Far from the way you SHOULD test it, but it is a sans-robot way you CAN test it

Travis Hoffman 06-04-2011 17:33

Re: Would Someone mind looking over my autonomous.
 
Quote:

Originally Posted by mesamb1 (Post 1050371)

[Travis Hoffman, you have a great student! it is really done well and is particularly ambitious with out a labview mentor, but I shake my fist at your c++ compiler]

Jordan is on Team 379. I just hang out at their shop and harass them from time to time.

You were right about the "great student" part, however. :)

j.cole 12-04-2011 15:36

Re: Would Someone mind looking over my autonomous.
 
1 Attachment(s)
Thanks for all the help guys i prolly shouldave listened to you guys in the first place about combining the while loops because I was having trouble on thursday and the NI Rep (i never got his name cool dude, are all NI reps awesome?) told me to combine them and it worked. Aside from that it works as it should (it likes to veer right but that's a physical problem)


All times are GMT -5. The time now is 09:25.

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