![]() |
Help wiring gyro, then programming... please.
hey guys.
I'm trying to get our gyro working but having no success... First thing I tried was to plug it in the PWM ports on the sidecar, to no avail, then plugging to the digital I/O on the sidecar, again to no avail... Today tried plugging to analog I/O on cRio yet again to no avail... Well, perhaps we did something wrong... When plugged into PWM or digital I/O it gave us something like -1.81546 or some number like that, and that number would fluctuate a tiny bit, maybe get up to around -1.9 and down to -1.7, it would be fluctuating while the thing was perfectly still... Then upon moving bot or spinning it, number wouldn't really change except those small fluxes between -1.9 and -1.7... When we plugged into the Analog I/O it was telling us Gyro : -Infinity Really? Negative infinity? So... Are we time traveling? Or... You get the idea :) help us figure out exactly where it plugs in and then how to get a simple readout from it in Java, please and thanks so much in advance. PS : WE DID READ DOCUMENTS! So at least we tried to help our selves before coming on here :) |
Re: Help wiring gyro, then programming... please.
look at the 2010 Sensor Manual which I have uploaded here http://www.chiefdelphi.com/forums/sh...ad.php?t=89450
Make sure you have connected the proper contacts on the gyro for analog output to the PWM wire, then make sure you have correctly plugged it into the Analog break-out. Are you using one of the example programs? |
Re: Help wiring gyro, then programming... please.
That is the same manual I used to figure out how to plug the gyro in in the first place. :O
We currently have the wires connected to the "Rate" contacts... I assumed that was the correct one for some reason... Should it be connected to "Temp" for simple "Get current angle in comparson with a previously specified state" outputs? We have tried sample code and also setting the Gyro's output to a line on the FRC Driver Station. Thanks for a quick response. |
Re: Help wiring gyro, then programming... please.
No, connected to 'Rate' is correct. One test is useful to ensure the 'magic smoke' wasn't released by any of your previous efforts. Wire the 5v supply and ground to a regulated power supply. Then measure the voltage from the Rate wire. It should be around 2.5 v when not moving. Then rotate the gyro horizontally as the little circle with arrow shows. You should see the voltage change proportional to the speed at which you move the sensor. If this works, the magic smoke is still inside. Carefully connect to the Analog Break-out, looking at the diagram to indicate where the signal (white) wire goes.
In the code, make sure that in whatever language you use, you have declared the correct slot and port. Good luck! |
Re: Help wiring gyro, then programming... please.
Can we use DSC for the regulated power supply and multimeter to test rate wire? Thanks again
|
Re: Help wiring gyro, then programming... please.
Quote:
|
Re: Help wiring gyro, then programming... please.
Quote:
Ahh.... Lesson learned. Thank you for the input. Good thing is we have an unused gyro from last year somewhere around here so if that is the case, all is not lost. Thank you. |
Re: Help wiring gyro, then programming... please.
We have tested both the same and a different gyro on the Analog breakout, made sure it's wire correctly (in relation to 5v Ground and Sig wiring)
And whenever we try to get a readout it's saying some numbers in the negative range - around -.8 something.... It will change a small amount but it refuses to go positive. Also if we jsut unplug the gyro and run code it gives us the same numbers! We are using Java and could not find any sample code, so.. Gyro is on slot 1 of analog input on slot 1 of the cRIO private Gyro gyro = new Gyro(1, 1); then used outputs gyro.getAngle(); assigned to Driver Station user message line 3.. which gave us the negative numbers... What are we doing wrong? Thanks in advance! |
Re: Help wiring gyro, then programming... please.
Can you print that to the debug console instead? That will reduce the number of variables that could go wrong.
|
Re: Help wiring gyro, then programming... please.
We tried that too and got similar readings.
Thanks for response of course. |
Re: Help wiring gyro, then programming... please.
Are you printing out the value using:
Code:
void PrintfLine(Line line, const char *writeFmt, ...); |
Re: Help wiring gyro, then programming... please.
We're using Java, though.
System.out.println("gyroAngle: " + gyro.getAngle()); userMessages.println(DriverStationLCD.Line.kUser3, 1, "gyroAngle: " + gyro.getAngle()); That's our current code. |
Re: Help wiring gyro, then programming... please.
That looks alright. Do you have any other analog sensors on the robot that works just to prove that the code reading an analog channel works? I suggest to check the wiring again to make sure everything is connected properly. If you make your own PWM cable, make sure the connectivity is good. If you are reading the same random values with the sensor plugged in or unplugged, that really means there was no connection to the analog channel.
|
Re: Help wiring gyro, then programming... please.
Quote:
|
Re: Help wiring gyro, then programming... please.
I don't know much about Java either, but according the the WPILib sources, the gyro initialization is done in its constructor. So the moment you created the gyro object, it should be ready to use.
|
Re: Help wiring gyro, then programming... please.
Okay,
tested the spliced PWM (needed a female/female) and each connection is fine from end to end. Then tried putting the gyro on the analog breakout, and checking volts and it seems to be about right, it was 2.5 then increased when I turned in the indicated direction... So it IS something with our code? Waiting for the main programmed to get here with his laptop, we will look at the code then... Perhaps we are doing something wrong, somewhere... |
Re: Help wiring gyro, then programming... please.
In your java proram you need to
a- disable the watchdog b- reset the gyro c- enable the watchdog in this order - the command gyro.reset() takes time. |
| All times are GMT -5. The time now is 07:15. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi