Go to Post anything is possible with dedication. - [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 08-05-2005, 21:48
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Concept of PID explained

Quote:
Originally Posted by billbo911
Besides, I know many of you will have input as to why it will or will not work and, I'm hoping, ways to improve it. So here goes:
Your computed values for a PID system are best declared as int to avoid problems with overflow when assigning variables. For instance, in the assignment:
PosError3 = (p3_y - PosFdbk1);
a value larger than 127 can produce a negative result when stored in PosError3, providing for undesired behavior of the control system.

The same goes for DriveCmd3, in the assignment
DrvCmd3 = (127 + PosError3);
in general, although this instance might not be producing undesired results.

Your code implements a P control system, providing for two discrete
signals for smaller values of the error and an upper bound for large values of the error. It is suitable for a system that has a lot of friction, for instance something driven by a screw. The mechanical friction provides any required damping in this case. Our robot, this year, had this kind of drive system for the arm, and as a result we used a P control system with a one stage minimum for small errors. The Fisher Price motors were prone to smoke and it was better to have them "jump into the window," so to speak, and then be cleanly shut off. If they sat stalled they could burn up, and we did smoke one of the 6 volt motors this way.

You shift the value returned by Get_Analog_Value down by two bits, losing two bits of precision in the deal. This loss of precision can be a problem when implementing the arithmetic in a full PID control system, especially when doing subtraction involved in the D and I signals. It is better practice to shift the 8 bit values returned from the OI up by two bits, although for your specific code it is of no concern.

If your system does not have enough mechanical friction to damp oscillation, you will need to implement at least the D control signal. You can also scale and apply limits to the P, I and D signals imdependently before adding them. This allows you to easily tune each signal, without affecting the others. You will know if this is an issue when you try your code out on a given mechanical system. If you can't get rid of oscillation you will need to add a D signal, back down on the gain of the P signal, or both.

It is best to take care of the dead band of a given victor, and the conversion to an 8 bit unsigned value for the pwm controller, somewhat separately from the PID code after the full blown PID signal has been developed. The dead band of a victor can change when swapping a part, or if "recalibration" should occur (students can do that sort of thing). You can easily measure the minimum and maximum pwm signals that do not activate the motor, and update them in this section of the code without changing the PID control code above it.

Ultimately, every system is different, and the things that you need to do in order to control it can be, as a result, different. There is no limit to the phase space for being creative.

Have fun,
Eugene

Last edited by eugenebrooks : 08-05-2005 at 22:27.
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
PID cmd_drive can't drive straight? gnormhurst Programming 4 18-02-2005 01:54
Drive Straight C Code using Encoders without PID? Chris_Elston Programming 17 15-02-2005 23:41
All-Time PID Drive with Hall-effects: Coming along very nicely jdong Programming 6 05-02-2005 19:39
Whegs, PID, and climbing phrontist Technical Discussion 9 02-05-2004 00:21
PID control loops - closed loop feedback KenWittlief Technical Discussion 56 26-04-2004 21:27


All times are GMT -5. The time now is 01: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