Error in Sensor readings?
Posted: Wed Apr 15, 2015 8:52 am
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:
Any my data_received callback is like:
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:
Any idea what is going on? Am I doing something terrible wrong?
Thanks in advance,
Jose
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)
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)
- 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
Any idea what is going on? Am I doing something terrible wrong?
Thanks in advance,
Jose