|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
Gyro PID Programming
Hello,
I am attempting to use a PID loop to force the robot into the 0 degrees starting position at a click of a button. [+] At first, I created a PIDController and initialized it with the Gyro object as the PIDSource, and my own object with a custom PIDWrite routine which consists of: Code:
void PIDWrite(float Output)
{
Drive->TankDrive(Output, -Output); //This makes the robot turn around
}
[+] I then decided to write my own PIDGet() too. All the routine does is get the raw angle, scale it to a value from -1.0 to 1.0 and return it. (I am under the impression that the Output and Source variables should be scaled to the same range, please tell me if this is wrong.) After scaling both the Output and Source vars, setting the setpoint to 0.0 (the starting position at which the gyro was reset) and enabling the PID Controller, nothing happens Please tell me if you can find anything wrong with what I did, and thanks in advance. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|