|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#7
|
|||
|
|||
|
Re: Concept of PID explained
Quote:
The range of the expression assigned to it is larger. When you assign 254, for instance, and read the value back from PosError3, you will get -2, not the value intended. Looking at your code, it looks like the result would be a pwm signal in the dead band, instead of full forward. Assigning 128 will be read as -128, and in this case your code will cause the motor to go full speed in the wrong direction. In the case of DrvCmd3, you have the same problem, but you are saved by the fact that the computer takes the misinterpreted 8 bits and blindly shoves them into the unsigned char, pwm03, so the result is the one you expect. As I noted, the issue a visible bug for PosError3, but does not manifest itself as a bug for DrvCmd3. If you, or someone else, were to modify the code to somehow test the value of DrvCmd3 and manipulate it before assigning it to pwm03, the additional bug would surface. A table of widths, and range, of integer types on the robot controller can be found in "An introduction to C programming for FIRST robotics applications." See "C programming for the robot controller" at the web address http://srvhsrobotics.org/index.php?g...tarticle&cat=2 for the latest version. I hope this is helpful... Eugene Last edited by eugenebrooks : 09-05-2005 at 02:07. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |