![]() |
Gyro Turning in Auto Mode
We trying to manipulate the kp so that we turn slow at the beginning then increase the speed of rotation when we approach the angle we want. It works kinda of just spins way to fast at the beginning of the rotate. Suggestions?
Code:
|
Re: Gyro Turning in Auto Mode
Quote:
Also, in the first if statement, you did not cover the angle == 70 case; you'd probably be better off with a simple else. You also give it a larger number at the beginning, which is what I would expect that you want, but does not agree with the description at the top. Try changing the > to a < in the if and see if that's what you wanted. |
Re: Gyro Turning in Auto Mode
Yes we are using a sampleRobot. The code works just not as expected. We want to have to robot turn and correct itself. If we were to put an else code something like:
Code:
else if (angle == 70) {We are trying to make the robot correct itself because the robot turns to fast. That's the point of changing the KP. If the angle is high KP should be low such that the robot turns slow. As the angle approaches the set angle we change KP to a bigger number such that the robot moves fast enough to turn it. Also to note when we rotate the robot it returns a negative value. If we were to say: Code:
if(angle > - 70){ |
Re: Gyro Turning in Auto Mode
It sounds like you might get what you want if you just limit the maximum turn rate. Compute Kp * angle and clip it at 0.6, or 0.4, or whatever works for you.
If you are having problems with the turn command not being enough to get the heading all the way to the target, you could add some Integral to the equation of control. That's what it's for. |
Re: Gyro Turning in Auto Mode
Quote:
|
| All times are GMT -5. The time now is 10:08 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi