Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Gyro angle will not work with robot code (http://www.chiefdelphi.com/forums/showthread.php?t=113865)

AquaMorph 18-02-2013 14:24

Gyro angle will not work with robot code
 
3 Attachment(s)
I am trying to get an angle from the gyro and I am able to get the sample code to work. But when I try to use the sample code on the robot code it just outputs a constantly increasing number from 0-360. I attached the code below. Can anyone tell me why this is happening?

Mark McLeod 18-02-2013 15:16

Re: Gyro angle will not work with robot code
 
You didn't set the gyro gain. Try this:

AquaMorph 18-02-2013 17:40

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by Mark McLeod (Post 1235729)
You didn't set the gyro gain. Try this:

I copied your code and it is still constantly increase but this time by a smaller number.

Mark McLeod 18-02-2013 17:46

Re: Gyro angle will not work with robot code
 
The spec sheet for the gyro you are using should list a value for "voltage per degree of rotation per second", use the value they list for the gain.

When the cRIO is first booted, you know you must not touch the robot while the gyro initializes?
That's how it decides what zero is.

Ether 18-02-2013 17:53

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by AquaMorph (Post 1235828)
I copied your code and it is still constantly increase but this time by a smaller number.

How small? Is it of the order of 1 degree every 2 minutes or so? If so, that would be normal drift for KoP gyro.



AquaMorph 18-02-2013 18:13

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by Ether (Post 1235839)
How small? Is it of the order of 1 degree every 2 minutes or so? If so, that would be normal drift for KoP gyro.



It is to the forth decimal place and moving the gyro doesn't do anything.

Ether 18-02-2013 21:04

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by AquaMorph (Post 1235850)
It is to the forth decimal place and moving the gyro doesn't do anything.

Post a photo of how you have it wired. Show both the gyro end and the other end of the cable. Please use the macro setting on your camera for close-ups.



AquaMorph 19-02-2013 08:11

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by Ether (Post 1235937)
Post a photo of how you have it wired. Show both the gyro end and the other end of the cable. Please use the macro setting on your camera for close-ups.



I can't take a picture of it until tonight. However, I know the wiring is correct because I loaded the sample code on the robot and it ran fine and gave me the angles I wanted.

Ether 19-02-2013 11:22

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by AquaMorph (Post 1236177)
I can't take a picture of it until tonight. However, I know the wiring is correct because I loaded the sample code on the robot and it ran fine and gave me the angles I wanted.

We should have asked you right at the start what was your intended use for the gyro.

I just saw on another thread that you are intending to use the gyro for your shooter altitude angle.

I think you want a potentiometer or encoder instead.



AquaMorph 19-02-2013 11:58

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by Ether (Post 1236305)
We should have asked you right at the start what was your intended use for the gyro.

I just saw on another thread that you are intending to use the gyro for your shooter altitude angle.

I think you want a potentiometer or encoder instead.



I think an encoder would work best. I don't think a potentiometer came in the KOP. Do you have an idea of what would be best for a shooter that is going to only moving up and down in a range of 70 degrees?

Ether 19-02-2013 12:20

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by AquaMorph (Post 1236323)
I think an encoder would work best. I don't think a potentiometer came in the KOP. Do you have an idea of what would be best for a shooter that is going to only moving up and down in a range of 70 degrees?

That's a great application for a potentiometer. An encoder would also work.



AquaMorph 19-02-2013 12:30

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by Ether (Post 1236331)
That's a great application for a potentiometer. An encoder would also work.



I don't think I have potentiometer but I can play with an encoder.

Doc Wu 19-02-2013 22:35

Re: Gyro angle will not work with robot code
 
Quote:

Originally Posted by AquaMorph (Post 1236336)
I don't think I have potentiometer but I can play with an encoder.

You must have a Radio Shack or Fry's somewhere near you. Get a 5K or 10K Linear Taper Potentiometer. They're cheap and easy to wire up and get working.

mswalker 20-02-2013 09:21

Re: Gyro angle will not work with robot code
 
We have seen the constantly increasing gyro behavior which seems to be due to bad connections. Check that the connection to the analog board and the gyro itself are solid and don't have any wire "hairs" shorting. Also, as mentioned, check the datasheet for the gain. Our gyro (I think this year or last year KOP) has a gain of 0.007 instead of the 0.0125 of the examples.

tr6scott 24-02-2013 12:52

Re: Gyro angle will not work with robot code
 
http://www.chiefdelphi.com/forums/sh...42#post1239642

Please see this post, and see if this explains the issue.


All times are GMT -5. The time now is 12:02.

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