![]() |
gyro problem
I have the gyro on the analog input 01. i am using kevin's code with the gyro and adc enabled. i am getting a reading in the printf for both the rate and the angle. coding it is the trouble.
i am using mecanum programming i found from alan. it works very well on its own. Code:
/*******************suggestions? |
Re: gyro problem
Print out the pwm values to see if they correspond to what you are seeing or not. If so, your code is causing the pwm values to do weird things; if the pwm values are steady but the motors are doing weird things, that might point to a wiring problem.
Put printf's inside your conditionals (if(temp_gyro_angle <= -75)...) to see what is going on. You are increasing/decreasing 'turn' based on gyro. What type is turn? char? int? Is it static? If turn is a static char and you are increasing it by 15 38 times per second, it will overflow more than 2 times each second (15*38/256). |
Re: gyro problem
This may be a shot in the dark .... but try plugging the gyro into analog input 02. This fixed a problem we experienced with the gyro.
|
Re: gyro problem
thanks for the help. i wont really be able to check it until thursday at competition, so i want to make sure this is right.
turn is declared as a signed int. will this have the same affect? how would i go about fixing that? this gyro is completly new to me. |
Re: gyro problem
try using a feedback loop...a simple one would look like:
turn = turn - temp_gyro_angle / 15; or something like that. this will get you (theoretically) a robot that always points forward. you may want to make the ratio that you multiply temp_gyro_angle by higher or lower depending on how fast/slow you want it to correct. also, gnormhurst, he couldn't be overflowing because turn is set every step... |
Re: gyro problem
Quote:
|
Re: gyro problem
Quote:
|
Re: gyro problem
I think that you should use Get_Gyro_Angle() to get data from the gyro. That is how we used it. Also We had a similar problem with our field centric omni drive. It was caused by a division by 0. Good Luck from 1647
|
Re: gyro problem
Code:
signed int speed, turn, slide; |
Re: gyro problem
Quote:
Code:
// reset the loop counter |
| All times are GMT -5. The time now is 21:51. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi