Go to Post If you never takes steps to solve problems you cannot just complain that they exist. - Wayne C. [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-01-2011, 20:46
iv1777 iv1777 is offline
Registered User
FRC #1777
 
Join Date: Jan 2011
Location: Overland Park
Posts: 18
iv1777 is an unknown quantity at this point
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
  #2   Spotlight this post!  
Unread 18-01-2011, 20:51
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
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?
__________________
Jon Mittelman

Senior Judge Advisor New England & Israel 2014-2015
Infinite Loop Mentor 2011-2015
TechnoTicks Mentor 2000-2011
Championship Chairman's Award 2009 Team236 TechnoTicks
Judge 2010-2015 Championships
Senior Judge Advisor New England District Championship 2014-2015
Judge Advisor Tel Aviv Regional 2007-2015
Judge Advisor Pine Tree Regional 2013
Maine Regional Planning Committee
New England District Planning Committee
Lead Inspector Microsoft Tel Aviv Regional 2006-2008
Judge & Lead Inspector GM/Technion Tel Aviv Regional 2006
Judge UTC Hartford Regional 2006
  #3   Spotlight this post!  
Unread 18-01-2011, 21:01
iv1777 iv1777 is offline
Registered User
FRC #1777
 
Join Date: Jan 2011
Location: Overland Park
Posts: 18
iv1777 is an unknown quantity at this point
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.
  #4   Spotlight this post!  
Unread 18-01-2011, 21:46
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
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!
__________________
Jon Mittelman

Senior Judge Advisor New England & Israel 2014-2015
Infinite Loop Mentor 2011-2015
TechnoTicks Mentor 2000-2011
Championship Chairman's Award 2009 Team236 TechnoTicks
Judge 2010-2015 Championships
Senior Judge Advisor New England District Championship 2014-2015
Judge Advisor Tel Aviv Regional 2007-2015
Judge Advisor Pine Tree Regional 2013
Maine Regional Planning Committee
New England District Planning Committee
Lead Inspector Microsoft Tel Aviv Regional 2006-2008
Judge & Lead Inspector GM/Technion Tel Aviv Regional 2006
Judge UTC Hartford Regional 2006
  #5   Spotlight this post!  
Unread 18-01-2011, 22:01
iv1777 iv1777 is offline
Registered User
FRC #1777
 
Join Date: Jan 2011
Location: Overland Park
Posts: 18
iv1777 is an unknown quantity at this point
Re: Help wiring gyro, then programming... please.

Can we use DSC for the regulated power supply and multimeter to test rate wire? Thanks again
  #6   Spotlight this post!  
Unread 18-01-2011, 22:01
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 673
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Help wiring gyro, then programming... please.

Quote:
Originally Posted by iv1777 View Post
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...
What?! Plugging the gyro into the PWM port? I hope you did not fry it. Gyro is an analog sensor, so it should be connected to an analog channel. A few years back, because of mis-communication, one of the members of our team hooked the two encoders to the PWM ports and fried them both. That was hard to debug until we put an oscilloscope on the encoders and saw nothing there. So please don't try things out by hooking them to random ports.
__________________
  #7   Spotlight this post!  
Unread 18-01-2011, 22:09
iv1777 iv1777 is offline
Registered User
FRC #1777
 
Join Date: Jan 2011
Location: Overland Park
Posts: 18
iv1777 is an unknown quantity at this point
Re: Help wiring gyro, then programming... please.

Quote:
Originally Posted by mikets View Post
What?! Plugging the gyro into the PWM port? I hope you did not fry it. Gyro is an analog sensor, so it should be connected to an analog channel. A few years back, because of mis-communication, one of the members of our team hooked the two encoders to the PWM ports and fried them both. That was hard to debug until we put an oscilloscope on the encoders and saw nothing there. So please don't try things out by hooking them to random ports.

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.
  #8   Spotlight this post!  
Unread 21-01-2011, 17:15
iv1777 iv1777 is offline
Registered User
FRC #1777
 
Join Date: Jan 2011
Location: Overland Park
Posts: 18
iv1777 is an unknown quantity at this point
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!
  #9   Spotlight this post!  
Unread 21-01-2011, 17:40
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 673
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
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.
__________________

Last edited by mikets : 21-01-2011 at 17:44.
  #10   Spotlight this post!  
Unread 21-01-2011, 17:45
iv1777 iv1777 is offline
Registered User
FRC #1777
 
Join Date: Jan 2011
Location: Overland Park
Posts: 18
iv1777 is an unknown quantity at this point
Re: Help wiring gyro, then programming... please.

We tried that too and got similar readings.
Thanks for response of course.
  #11   Spotlight this post!  
Unread 21-01-2011, 17:54
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 673
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Help wiring gyro, then programming... please.

Are you printing out the value using:
Code:
void PrintfLine(Line line, const char *writeFmt, ...);
Can you paste your line of code here?
__________________
  #12   Spotlight this post!  
Unread 21-01-2011, 18:02
iv1777 iv1777 is offline
Registered User
FRC #1777
 
Join Date: Jan 2011
Location: Overland Park
Posts: 18
iv1777 is an unknown quantity at this point
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.
  #13   Spotlight this post!  
Unread 21-01-2011, 18:14
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 673
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
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.
__________________
  #14   Spotlight this post!  
Unread 21-01-2011, 19:00
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Help wiring gyro, then programming... please.

Quote:
Originally Posted by iv1777 View Post
We are using Java and could not find any sample code, so..
I don't know the proper Java way to do a gyro, but if it's anything like the C++ or LabVIEW way you probably need to do some initialization before you can read from it. I only have LabVIEW installed to look at here. With luck, someone will be able to point you to the appropriate Java examples.
  #15   Spotlight this post!  
Unread 21-01-2011, 20:04
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 673
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
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.
__________________
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 07:15.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi