![]() |
No Signal From Gyro
First, thanks in advance for taking the time to read this. Here is our problem. For the past week we have been trying to use a gyro to help our robot go strait in autonomous control. We have 2 Gyros and we wrote the code for the EDU bot for initial testing and have 2 working gyro control codes. So we thought it was time to impliment them into our competition bot from last year. Basically we just copied the code from the EDU bot into the User_Autonomous function in user_routine_fast.c on our competion. Here is 1 version of the code we put in that worked perfectly on the EDU bot:
Code:
//CODE OMMITTED FOR POSTING PURPOSESThanks again for your time. |
Re: No Signal From Gyro
Your analog I/O should already be setup in User_Initialization() in the user_routines.c file by the statement:
Set_Number_of_Analog_Channels(SIXTEEN_ANALOG); I think Get_Analog_Value returns "unsigned int" if I recall correctly, so you might want to typecast the call to “(long int)”. Will you be at the SBPLI mini-comp tomorrow? If so look me up and I'll help you debug the gyro input. |
Re: No Signal From Gyro
Quote:
2.) We have tried to type cast it to every variable known to c =P it would just be gyro_input = (long int)(Get_Analog_Value(rc_ana_in01)); right? 3.) Nah, we wanted to go to the mini-comp but could not afford the cost of a bus since the district busses would still be on duty. |
Re: No Signal From Gyro
This is going to sound a bit whacked, but try getting rid of:
Generate_Pwms(pwm13,pwm14,pwm15,pwm16); and try just mapping your motor outputs to pwm's 9-12 or anything but 13-16 I think we ran into something similar last year and finally tracked it down to using the Get_Analog function in conjunction with the Generate_Pwms In the FRC, PWM 13-16 aren't output from the same microprocessor as the others and this seems to create some kind of conflict. Eric |
Re: No Signal From Gyro
Quote:
Does the gyro still give you a proper reading on the Edu controller? Just to make sure it didn't develop a loose connection (although doubtful since you tried both). What model gyro are you testing? If your team meets after school I could take a late lunch or drop by after work (in Bethpage) if you can't isolate the problem. I hate the thought of you giving up the gyro after you got it working on the Edu. |
Re: No Signal From Gyro
We use analog feedback for our arm, and a gyro to control turns
on our robot. The cast on the GetAnalogValue() call is not required, because the routine is declared somewhere, but the cast for arguments to printf is, because "char" will otherwise get pushed on the stack, for efficiency purposes, I presume. We have the "generate pwms" call commented out in our code, and use only the "normal" pwm outputs, it being general policy to comment out anything that might be considered "exotic" and a cause of possible trouble. I think that the "Keeper of the magic 8 ball" has it right on this question... Pitch the "generate pwms" and go for the normal pwm outputs. |
Re: No Signal From Gyro
Ok, here is the latest updates from our Attempts at getting a signal from the Gyro. Here is all our autonomous code is:
Code:
I also remember right before the 2004 competition FIRST released an unpdate for the controller that we never did.... did that have anything to do with analog inputs? PS. Currently we are meeting after school on Fridays @ 2:00pm, and we sometimes meet during the week just to work on some small things, so if we cant get it working soon maby it would be best if you stop by and have someone who really knowns what they are doing (ie. not ne one from our team) look at it. |
Re: No Signal From Gyro
...hmmmm, I know you're only posting part of the file, but have you #included:
ifi_aliases.h ifi_defaults.h and ifi_utilities.h at the top of the file? Without them you're missing the function prototype and definitions for Get_Analog_Value(rc_ana_in01) .....just a thought...cause that'll hose it up I don't see any problem with your print, but I would make gyro_input an unsigned int to match the return type in the function prototype. Hope that helps, Eric |
Re: No Signal From Gyro
The RC firmware update innovation-FIRST posted doesn't affect this problem. That had to do with initializing PWM & RELAY values when changing modes.
Nothing looks bad in your code and the failure to typecast in this one case shouldn’t be noticable, so lets go deeper. I’ve attached an entire FRC project from the default code with two analog read statements added to Process_Data_From_Master_uP() for no other reason than that routine was handy (I posted just that routine below-those are the only changes made to the default code). Test with the whole project to eliminate the chance that something elsewhere in your code is causing the problem as Eric says. You'll see one statement reads from analog input 1, the other from analog input 16. I tested with our gyro on input 1 and with a potentiometer on input 16. You don’t need to have a pot handy. The Get_Analog_Input will return “1023” if nothing is attached to the input pins, and if you connect the “SIG” and “BLK” pins with a paperclip you’ll get a reading of zero. Try testing with this. You can just IFI_Load the .hex file or recompile the whole project if you like. Code:
void Process_Data_From_Master_uP(void)Quote:
1) If both analog inputs = 0 no matter what, even disconnected, that means bad FRC analog inputs, ergo the FRC hates you. 2) If the pot works, but the gyro doesn’t then the gyro hates you. 3) If they both work then something else in the code hates you. P.S. Friday afternoons are good for me. Clear it with your advisor first then PM me directions both to the school and where I find the team at school. I'll be coming south on the SOB |
Re: No Signal From Gyro
Quote:
....anyway, your plan is a good one Mark. They'll get to the bottom of this and love that little gyro chip ;) Eric |
Re: No Signal From Gyro
Ok, the 2 differences in my code from yours is that
1.) I used global variables instead of local ones for gyro input. 2.) and I did not initialize them to anything anywhere I don't know if that will cause any problems....but what I did notice was that the analog inputs gave 0 when nothing was connected to them, which makes me think the FRC is messed .... but what makes me think its only semi-messed is that when we hooked up a pot we were getting a reading from 0-6 corrosponding with the position of the "turny thing" on the pot. I thought that it SHOULD display 0-1023 like a good 10 bit unsigned integer, so either our pot doesnt like numbers above 6 or the FRC is broken. I will load the code next available chance and tell you the results. But really, thanks for caring! =) Its always good to know that if you have no clue what you are doing there is someone out there. |
Re: No Signal From Gyro
Quote:
The rest of your description doesn't sound good for the FRC, but run through the test. If the problem looks like the FRC, drop in reads and do the open/closed pin test on all the other analog inputs to see if they're all blown. Also, test the range of your pot on the EDU to see if it behaves properly there. I'll bring my own pot on Friday if the problem doesn't get solved by then. |
Re: No Signal From Gyro
OK, the mentor said it is OK for you to stop by on Friday. I PMed you the exact directions and everything else you need to get into the building.
|
| All times are GMT -5. The time now is 20:12. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi