Go to Post The highest seeded alliance is always placed in the red zone by the computer. In fact, its a great communist conspiracy to mold the mind of teenagers into equating Reds with winners. - Btower [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-01-2014, 17:21
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Labview Autonomous Help!

If you try to run your drivetrain using timing, even if you take battery voltage into account, you aren't going to get very accurate results. If you are trying to drive a certain distance, the best way to do it is to use the encoders that come attached to most drivetrain gearboxes to calculate distance. Then use PID to control how far you go. That's going to give much more accurate results than what your trying to do with battery voltage, and from a coding standpoint is probably much easier to implement.
Reply With Quote
  #2   Spotlight this post!  
Unread 12-01-2014, 18:17
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Labview Autonomous Help!

Quote:
Originally Posted by Pault View Post
If you try to run your drivetrain using timing, even if you take battery voltage into account, you aren't going to get very accurate results. If you are trying to drive a certain distance, the best way to do it is to use the encoders that come attached to most drivetrain gearboxes to calculate distance. Then use PID to control how far you go. That's going to give much more accurate results than what your trying to do with battery voltage, and from a coding standpoint is probably much easier to implement.
Thanks! Could you maybe attach a pic of the type of code I would need?
I've never used PID. What is it?
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***


Last edited by alexander.h : 12-01-2014 at 18:22.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-01-2014, 21:21
Aaron.Graeve Aaron.Graeve is offline
Registered User
FRC #1477 (Texas Torque)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: College Station, Texas
Posts: 103
Aaron.Graeve is a name known to allAaron.Graeve is a name known to allAaron.Graeve is a name known to allAaron.Graeve is a name known to allAaron.Graeve is a name known to allAaron.Graeve is a name known to all
Re: Labview Autonomous Help!

PID is a general control loop for getting a physical action to a particular point. By using a sensor on the moving part, the code compares the current position of the part to where it is supposed to be (the error), how long the part is taking to get there (the cumulative sum of the error), and how quickly the part is moving (the derivative of the error with respect to time) and uses these to calculate a new value for the controlling motor to be powered. For an closed-loop autonomous drivetrain, you would almost certainly need to use an encoder on the wheels (two really, one for each side so the robot goes relatively straight). There are many papers published here on Chief Delphi and all over the net about this. Since the loop is updating many times a second, it can very quickly adjust to changing conditions or resistance. Control loops are, in my opinion, the biggest difference programming-wise between good and great teams. You may find them useful even in teleop if there is a mechanism that needs to be held at a particular angle.

Message me if you have any more questions.
__________________

2016:
Alamo, Bayou, and Lone Star Regional FTAA
2015:
Dallas, Alamo, Bayou, and Lone Star Regional FTAA
2014:
Alamo, Dallas, and Lone Star Regional FTAA
Alamo Regional Robot Inspector
2013:
Einstein Champion and 2013 World Champion (Thanks 1241 & 610), Galileo Division Champion, Razorback Regional Winner, Alamo Regional Semifinalist, Bayou Regional Semifinalist, Lone Star Regional Quarterfinialist
2012:
Curie Division Semifinalist, Lone Star Regional Finalist, Bayou Regional Winner, Alamo Regional Winner
Reply With Quote
  #4   Spotlight this post!  
Unread 14-01-2014, 19:05
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Labview Autonomous Help!

Sorry it took me a while to get back to you. It's build season

Unfortunately I don't have any existing example code to show you (this is my team's first year using LabVIEW), and I definitely don't have the time to make it for you (again, it's build season), but I can help point you in the right direction. To learn about encoders, my best recommendation would be to look it up in the LabVIEW example finder. They are a bit more complex than other sensors, but you should be able to manage it.

PID is a form of closed loop programming; in other words, it allows you to take in feedback from a sensor and use it to achieve a certain goal. In this case, you will be using it to move your drivetrain motors (the output) until the average value of your 2 encoders (the input) reaches a certain distance (the set point). It does this using a fairly simple set of equations, labeled:

Proportional
Integral
Differential

The is an equation to determine each of these values using the input, set point, occasionally time, and the P/I/D gains. The proportional gain is represented by kP, integral gain by kI, and differential gain by kD. These numbers are simply used as a weight; the final product of each equation is multiplied by its respective gain in order to make it more or less powerful. Once you have calculated your P, I, and D values, you add them together, and send the sum to the output (in this case, you would run each of your drivetrain motors at (P+I+D)% power.

So you might find yourself asking what these 3 equations that I have been talking about are. But I don't have the time to explain all of them, and you probably wouldn't have the time to fully understand my explanation. So instead, I am only going to describe P. In most cases, you actually don't even need to use I and D; just set their gains equal to 0 and pretend they don't exist. That is what I recommend you do for your drivetrain. If you are interested in learning about I and D, there are tons of resources out on the internet for you. So, the equation for P is:

P = (setpoint - input) * kP

It's a pretty basic equation. Essentially what this means is that the further away you are from the setpoint, the faster you will go. That's really all there is too it. There are no secret fancy tricks or anything like that.

The final thing you need to know is how do you determine your kP value. And this answer is guess and check. If your robot starts violently oscillating back and forth, your kP is too high. If it moves to slowly and/or never actually reaches the setpoint, your kP is too low. Once you figure out an acceptable value, you are good to go.

By the way, don't think that you have to go off and code all this math by yourself. There is a PID function built into LabVIEW. Just wire in your setpoint, input, and PID gains, and wire the output to each of your drivetrain motor controllers. All the math will happen in the background so you don't have to worry about it.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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