|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Problems with using 330's goal tracking code
Thanks for the tuning procedure, Jacob! I will definitely try your suggestion! I'm really concerned that I have a bug in my code somewhere that I'm not seeing. Before I assume that it is a tuning problem, I really would like a fresh set of eyes to take a look at my code and see if there is anything fishy.
Your advice is great Jacob! Thanks for the quick reply...i'm actually loosing sleep over this code! Last edited by windell747 : 12-02-2009 at 06:55. |
|
#2
|
|||
|
|||
|
Re: Problems with using 330's goal tracking code
Someone else may be able to tell you exactly what to change, but I don't see it. What I'd do is modify the code to plot your process variable and your output against time. If you post that, people can tell you much more about your system.
To get the plot, take the vision value you are trying to center and bundle it with the output of the PID. Then wire the cluster to a waveform chart. Next you "bump" the system. Start with the target in the center and move it to one side pretty quickly and hold it there until the control system moves to that area. Do this again to the other side. You may need to increase the X scale or even the history length to log enough data. Greg McKaskle |
|
#3
|
||||||
|
||||||
|
Re: Problems with using 330's goal tracking code
Jacob's recommendation on tuning P first is exactly what you should do. We've used PID controllers for the past 5 years, and used just P control on almost all of them. There are several good white papers on CD about PID, including one by Matt Krass. Greg's suggestion of plotting the values is a good one. One way to get the step input is to change the setpoint. See also, the following excerpt from the PID article on wikipedia: http://en.wikipedia.org/wiki/PID_con...#Manual_tuning. Once you understand the manual process, you could try to play around with autotuning: http://forums.usfirst.org/showthread.php?t=10555
The example was optimized for driving on the regolith, so there's a few things you'd probably want to change for driving a turret. The first thing I'd do is remove the PID rate limiter. This was designed to keep the wheels from slipping. Hopefully your turret doesn't have that problem. Leaving that in there will slow down the response and make it more likely to oscillate. I'd also replace the robot drive VIs with the motor control VIs. Since you aren't using the features of robot drive, I'd go with the lower overhead. You mentioned using a Victor speed controller. I'd highly recommend using a jaguar. It will give a more linear response (PID is designed for linear systems). It also gives you much better slow speed control, which will help in reducing the oscillations. http://forums.usfirst.org/showthread.php?t=10182 |
|
#4
|
|||
|
|||
|
Re: Problems with using 330's goal tracking code
Thanks for the replies Joe and Greg! Since you guys haven't mentioned anything about the layout of my code, can I assume that you think my code layout is correct, but I need to adjust the PID gains? I just want to validate my code before I start tuning.
Right now I'm testing the code by having it turn the bot towards the goal to ensure that the code is written correctly. I understand that I'll need to change the gains for the turret application, but it will be nice to know that the gains is all i need to change. When I ran the code out of the box from the team 330 posting, I figured that since our bots are similar in size, mass and drive configuration (tank drive) that their PID gains would be close to what I would want. So when I saw the bot oscillating, I immediately thought that it was a code problem. Just for confirmation, the out of the box gains in the program was proportional=0.5, derivative=integral=0.0. Thanks! Last edited by windell747 : 12-02-2009 at 16:39. |
|
#5
|
||||||
|
||||||
|
Re: Problems with using 330's goal tracking code
Quote:
|
|
#6
|
|||
|
|||
|
Re: Problems with using 330's goal tracking code
No worries, Joe! Thanks for the reply! is it possible to get an example set of gains from you so that I have something to start with that will tell me weather or not the code is correct and that the problem is only with tuning? Maybe not your best set of parameters, but something that converges to no error over time. That way if mine doesn't converge then I know something is wrong.
I'm a fulltime engineering student and although I would like to mentor the team all day and get things just right, I have to do my studies too so it is hard sometimes to find the time to tune things from scratch. Again im not asking for competition gains, but something that will guarantee converge. Thanks! |
|
#7
|
|||
|
|||
|
Re: Problems with using 330's goal tracking code
Thanks for your help! It looks like I was able to get the response to converge. here are my gains for anyone interested. x-axis
0.003,I0.5. y-axis: P0.015,I0.70. derivative terms 0. max x=0.45,max y=0.7I'm trying to plot the x and y axis outputs to a graph but im having some trouble. I'm using the plot waveform and feeding to the input a get waveform time array, but im not getting the correct data types. Can anyone briefly explain the process to do this? Thanks! |
|
#8
|
|||
|
|||
|
Re: Problems with using 330's goal tracking code
One of the easiest ways to do this is to:
1. Go to your Front Panel 2. Select Express->Graph Indicators->XY Graph (aka Express XY Graph) 3. On the block diagram, wire your X and Y inputs 4. Double click the Build XY Graph on the block diagram and turn off Clear Data on Each Call. -Nate |
|
#9
|
|||
|
|||
|
Re: Problems with using 330's goal tracking code
how do you put time values for the x variable each iteration? I guess I could just put a counter that increments, but im not sure how to do this either. I would like to not use a for loop. Any suggestions?
Last edited by windell747 : 15-02-2009 at 23:04. |
|
#10
|
|||
|
|||
|
Re: Problems with using 330's goal tracking code
Sorry, I assumed you wanted an XY plot (plotting one variable against another). If you have two independent variables to plot, then use a Chart.
Bundle the two values (presumably X and Y) together and then wire to the Chart terminal. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems with tracking | Shinsa | Programming | 2 | 07-02-2010 14:35 |
| Using kevin's code for driving and camera tracking | razzoc | Programming | 3 | 18-02-2007 08:50 |
| Enabling Multiple Light Tracking Using Kevin's Code | Mitch | Programming | 7 | 05-02-2007 06:17 |
| problems using gyro/adc code with camera default code | tanstaafl | Programming | 7 | 22-01-2006 23:09 |
| Problems tracking with CMUCam2 in LabVIEW | PhilBot | LabView and Data Acquisition | 5 | 17-01-2006 20:42 |