![]() |
Gyro Programming
Hi, how are you?
I am trying to get gyros to work and I never programmed the sensor before, so I made use of the FIRST programming guide to implement gyros in the autonomous period. Quote:
However, when we tested it on the robot, it immediately made a sharp turn. In order to see what is happening with the angle values, I created an if statement Quote:
Any help would be appreciated, Thank you! :] |
Re: Gyro Programming
Code:
if (angle<0.5)then the angle will be larger then 0.5, when that happens, the robot will just sit where it is without moving ( like you said) What I would do is make a PID controller (I don't know how to use WPI's) sortof like this: Code:
float desiredHeading = 0;The real advantage of this method as opposed to the wpi example is that you can set any heading you want (At least within the range of - 360 to 360) Just remember to tune the PID :D |
Re: Gyro Programming
oh wow O.O XD Thank you so much!!!
|
Re: Gyro Programming
Quote:
I fixed a small error in the code, i forgot the denominator in the fmod operator. (360, by the way) |
| All times are GMT -5. The time now is 01:09. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi