Page 1 of 1

Error in Sensor readings?

Posted: Wed Apr 15, 2015 8:52 am
by jmelo
Hello,

In order to statistically characterize the crazyfle sensor readings, I was collecting a large number of sensor readings from both the accelerometers and gyroscopes. However I figure out that I am having several "faulty" measurements. Or maybe its the case that I am doing something wrong.

I want to read both accelerometer and gyroscope every 10ms. To enable logging of the desired values doing the following:

Code: Select all

self.imuData = LogConfig("", 10)
self.imuData.add_variable("acc.x", "float")
self.imuData.add_variable("acc.y", "float")
self.imuData.add_variable("acc.z", "float")
self.imuData.add_variable("gyro.x", "float")
self.imuData.add_variable("gyro.y", "float")
self.imuData.add_variable("gyro.z", "float")
self.crazyflie.log.add_config(self.imuData)
  
if self.imuData.valid:
            self.imuDatafhandler = open("imudata.csv", 'w')
            self.imuDatafhandler.write("time, gyro.y, gyro.x, gyro.z, acc.x, acc.y, acc.z\n")

            self.imuData.data_received_cb.add_callback(self.logIMUData)
Any my data_received callback is like:

Code: Select all

def logIMUData(self, timestamp, data, logconf):
        
        imuStrKey = ""
        imuStrValue = str(timestamp)
        for key, value in data.iteritems():
            imuStrKey = imuStrKey + ", " + key
            imuStrValue = imuStrValue + ", " + str(value)
        self.imuDatafhandler.write(imuStrValue + "\n")    
        logger.debug(imuStrKey)
I obtain the readings for the accelerometer in all the three axes with no problem. However, for the gyro I obtain a lot of what I call "faulty" readings, as sometimes some of the values are just "0.0", which is obviously wrong. Like this:
  • time, gyro.y, gyro.x, gyro.z, acc.x, acc.y, acc.z
    1228878, 0.06103515625, 0.0, 0.1220703125, 0.007080078125, -0.01220703125, 0.99072265625
    1228888, -0.06103515625, -0.1220703125, 0.06103515625, 0.00732421875, -0.01171875, 0.989990234375
    1228898, 0.0, 0.1220703125, -0.06103515625, 0.0078125, -0.01220703125, 0.99267578125
    1228908, 0.0, -0.1220703125, 0.18310546875, 0.00732421875, -0.01171875, 0.99169921875
    1228918, 0.1220703125, 0.06103515625, -0.06103515625, 0.007568359375, -0.01123046875, 0.9912109375
    1228928, 0.06103515625, -0.1220703125, 0.18310546875, 0.0078125, -0.009521484375, 0.989990234375
    1228938, 0.0, 0.0, 0.1220703125, 0.009033203125, -0.0107421875, 0.989501953125
    1228948, -0.1220703125, 0.0, 0.06103515625, 0.008544921875, -0.011962890625, 0.98974609375
    1228958, -0.1220703125, 0.06103515625, 0.0, 0.0078125, -0.01171875, 0.988037109375
I obtained a lot of measurements, around 170K readings, and figured out that there is an error rate on roughly 10% on measurements from gyro.X, gyro.Y and gyroZ, but the errors are independent on the three axes.

Any idea what is going on? Am I doing something terrible wrong?

Thanks in advance,
Jose

Re: Error in Sensor readings?

Posted: Wed Apr 22, 2015 9:39 am
by jmelo
Hi everyone,

It's me again. I made small changes in the firmware, making the quaternions available for logging, but I am having the same problem here. Several readings for the quaternions come "faulty" with several readings coming with values that are not supposed to (i.e. <1 or >1). Any help? Please?

Re: Error in Sensor readings?

Posted: Wed Apr 22, 2015 11:34 am
by tobias
I don't think the gyro values are wrong but because of quantization. The value is converted from a 16bit value and that is why you see 0.0 sometimes.

Re: Error in Sensor readings?

Posted: Thu Sep 24, 2015 5:03 pm
by OrenDevine
The error in reading the measurements will not be due to the quantization error, as you are discussing. Any other noise may be there. just check if your firmware codes are compatible with your hardware.Sometimes drivers of the hardware of different versions creates the problem.