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 was getting unexpected results, and It turned out that the Gyro's PIDGet() was actually returning the raw angle and not a value scaled from -1.0 to 1.0
[+] 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.