hitechnic Gyro sensor (NGY1044) noise

Discussion specific to the intelligent brick, sensors, motors, and more.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: hitechnic Gyro sensor (NGY1044) noise

Post by HaWe »

I'm trying...
aswin0
Posts: 201
Joined: 29 Sep 2010, 06:58

Re: hitechnic Gyro sensor (NGY1044) noise

Post by aswin0 »

Doc,

I looked at your code. The offset might be a float, but it's value is the result of a operation on integers. So it's value might be truncated.

Aswin
My blog: nxttime.wordpress.com
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: hitechnic Gyro sensor (NGY1044) noise

Post by HaWe »

I tried everything with float arithmetics, but still had big issues.

Now I tried it again other way round, I changed the code:
I dropped all averages, instead truncated the GyroValues back to int.
And I have no idea why, but it works, if offset has been formerly calibrated under "running motor conditions".

Drift is currently 1° per 10 minutes (freshly calibrated) up to 15° per hour (not recalibrated) when the robot is standing still (maybe of earth rotation? anyway, still room to improve a little),
heading calculation is exactly 360 when turning the robot 360°

The code gives you a way to reset the GyroInegral to zero for manually adjusting to compass values and to recalibrate during runtime if one needs to.

Now this is the current code, also using a first step to odometry - maybe it's useful for one or another:

Edit:
no way, now the rotation angles are not indicated correctly any longer - turning counter clockwise it always shows zero, althogh clockwise it's quite good..
Really weird and insane .
Last edited by HaWe on 13 Aug 2011, 11:57, edited 2 times in total.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: hitechnic Gyro sensor (NGY1044) noise

Post by HaWe »

mattallen37 wrote:You should also note, that some "drift" is actually very correct. The earth rotates 360*/24 hours (once a day). That means that you should see a "drift" of 1 degree every 4 minutes.
I just came upon this issue in a different discussion. As I was talking about the drift while the robot is standing still or going straight ahead, there is no other rotation influence to the gyro than just earth rotation.
Earth rotation is far less than 1° (0.004°) per second.
The sensitivity of the gyro is 1° per second - so 0.004° per second means, you're getting the gyro integer value 0 for angular speed all over the time, and if you're integrating 0 it will always stay 0 for the rotated angle in perpetuity.

But also in case of rotating the robot: any rotation time is usually far below 20 seconds, far too short that the gyro heading may be influenced by earth rotation during this short time.

Now if earth rotation is always below the measurement sensitivity it can't cause or influence the gyro drift of several degrees per hour in any way,
and IF there is a gyro drift of several degrees as always observed at the gyro, it may have many causes, but not earth rotation in any respect (CMIIW).
So I'm curious what actually this insane drift really causes.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: hitechnic Gyro sensor (NGY1044) noise

Post by HaWe »

I wrote:Now if earth rotation is always below the measurement sensitivity it can't cause or influence the gyro drift of several degrees per hour in any way,
and IF there is a gyro drift of several degrees as always observed at the gyro, it may have many causes, but not earth rotation in any respect (CMIIW).
So I'm curious what actually this insane drift really causes.
as this problem has been updated by EV3 gyro drift issues, I'm still curious what this is really about...
aswin0
Posts: 201
Joined: 29 Sep 2010, 06:58

Re: hitechnic Gyro sensor (NGY1044) noise

Post by aswin0 »

mattallen37 wrote:You should also note, that some "drift" is actually very correct. The earth rotates 360*/24 hours (once a day). That means that you should see a "drift" of 1 degree every 4 minutes.
This is not correct. That is, this is only correct if you live on the north or south pole.
On the equator the rotation of the earth has become a linear motion, the rotational speed is zero on the equator. The rotational speed in the XY-plane equals sin(lattitude)*360/24 hours, where lattitude is the latitude of the place your living.
If you have a three axis gyro then thinks are even more complex. Then the rotation of the earth is measured in the XY-plane on the pole. On the equator it is measured over the ZY-plane.
doc-helmut wrote: I just came upon this issue in a different discussion. As I was talking about the drift while the robot is standing still or going straight ahead, there is no other rotation influence to the gyro than just earth rotation.
Earth rotation is far less than 1° (0.004°) per second.
The sensitivity of the gyro is 1° per second - so 0.004° per second means, you're getting the gyro integer value 0 for angular speed all over the time, and if you're integrating 0 it will always stay 0 for the rotated angle in perpetuity.
Also this is not correct. A gyro sensor is noisy. This means that If the true rotation is zero that a non biased gyro will on average return a value of zero. But taken a lot of individual measurements there will also be a number some values of 1 and -1, and even some of 2 or minus 2. On average there will be just as much positives as negatives. Now if the true rotation is 0.5 then the average value of this perfect but noisy sensor will also be 0.5. even when 0.5 is below the sensor resolution of 1 in this example. This is because in this case the sensor will return equally often a 1 and a zero etc. So averaging multiple measurements can increase the resolution of the output far beond the resolution of the sensor itself. In theory even the earth rotation could be measured. However you should calibrate the sensor on the equator and measure the rotation on the north pole :-)
But is is very true that in practice the effect of the earth rotation can be neglected.
doc-helmut wrote: So I'm curious what actually this insane drift really causes.
Here are some common causes:
- bias is not stable. The bias of a cold sensor differs from that if a warmer sensor. Bias can also change with the sample speed due to this. The bias of the hitechnic gyro also changes with current level. This can be seen very clearly by taking two measurements one with a NXT morot running and one without.
- inaccuracy in the calculated bias. The calculated bias can differ from the true bias. This error adds up due to integration. A common mistake is to round up the bias to the resolution of the sensor. Then one uses a bias of 622 when it really is 622.3.
- Numeric inaccuracy of the computer, software or program. Convert the values to floating points before substracting the bias (that should also be expressed as a floating point value).
- errors in the timing.

The HiTechnic gyro sensor has a particularly unstable bias level. I think that this is partly due to the fact that is an analogue sensor as this makes the sensor sensitive to changes in voltage. Digital gyro's have a more stable bias level, but also these sensors should first warm up and be queried using a constant sample speed to get some decent measurements. But at least the digital sensors are not affected by running NXT motors.
My blog: nxttime.wordpress.com
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: hitechnic Gyro sensor (NGY1044) noise

Post by HaWe »

aswin, thank you for your very good and clear explanation! :)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: hitechnic Gyro sensor (NGY1044) noise

Post by mattallen37 »

Aswin, if the measurement axis is perpendicular to the rotation axis of the earth, then it doesn't matter where on the earth you are. The earth still rotates 1 degree every 4 minutes, regardless of where you are standing. In order for a gyro to measure the earth's rotation at 0.25 degrees per minute, the gyro would need to be completely perpendicular to the earth's rotation (not compared to gravity i.e. up/down from where you're standing).

Edit: I wasn't clear about this when I first mentioned it.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: hitechnic Gyro sensor (NGY1044) noise

Post by gloomyandy »

Note sure if you have seen this, but if not you may find it interesting....
http://www.pabr.org/copernitron/copernitron.en.html
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 10 guests