|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
|||
|
|||
|
Re: PID cmd_drive can't drive straight?
Yes, we saw something similar. Our solution was to set the velocity for the startup, is several steps to ramp up the speed, then when the distance is close, switch to position.
It is common for PID implementations to inhibit accumulating an integral of the error when the output is clamped to a limit (high or low). You can put in code like: Code:
// Only integrate if not driving at a limit
if ((motor_info[motor].pwm < (MAX_PWM-PWM_ZERO)) &&
(motor_info[motor].pwm > (MIN_PWM-PWM_ZERO))){
motor_info[motor].vel_error_i += motor_info[motor].vel_error;
}
Last edited by Don Reid : 12-02-2005 at 12:05. Reason: Quote code |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 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 |
| Globe gear box | Pat Roche | Motors | 9 | 25-05-2004 22:50 |
| What is wrong with this code???? It won't Compile and I don't know why? Please Help | CrashZero | Programming | 23 | 26-03-2004 09:44 |
| "Motors and Drive train edition" of Fresh From the Forum | Ken Leung | CD Forum Support | 6 | 29-01-2002 12:32 |