Error in Sensor readings?

Post here to get support
Post Reply
jmelo
Beginner
Posts: 4
Joined: Thu Apr 09, 2015 10:03 am

Error in Sensor readings?

Post 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
jmelo
Beginner
Posts: 4
Joined: Thu Apr 09, 2015 10:03 am

Re: Error in Sensor readings?

Post 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?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Error in Sensor readings?

Post 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.
Attachments
Plotted gyro values
Plotted gyro values
OrenDevine
Beginner
Posts: 1
Joined: Thu Sep 24, 2015 4:27 pm

Re: Error in Sensor readings?

Post 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.
Post Reply