|
Re: Drivetrain PID tuning
Quote:
Originally Posted by Jaci
Code:
float gyro_heading = ... your gyro code ...
float desired_heading = get_heading(time, profile);
float delta_angle = desired_heading - gyro_heading; // This is our error in alignment
float turn_power = 0.8 * (-1/80) * delta_angle; // Change these coefficients as required...
|
It might be helpful to slightly modify one line of code:
float delta_angle = desired_heading - gyro_heading; // This is our error in alignment
float delta_angle = MATH.IEEEremainder(desired_heading - gyro_heading,360); // This is our error in alignment
https://www.chiefdelphi.com/forums/s...3&postcount=36
https://msdn.microsoft.com/en-us/lib...vs.110%29.aspx
http://en.cppreference.com/w/cpp/numeric/math/remainder
Last edited by Ether : 31-12-2016 at 12:08.
Reason: added hyperlinks
|