The next stage of this is to start getting some sensor data from the CF. I'm mainly after the accelerometer, gyros and altimeter/magnometer. I've trawled through almost all threads on this topic and I've tried out some sample code too but I still haven't managed to figure it out. I've pasted the results from my code tests below. All I'm after here is a stream of data for each of the sensors that I can use. This will enable me to add some cool new features (like orientating the quad in the same direction that my tablet is facing).
The code example to add accelerometer logging on the python API wiki and it come up with the following:
Code: Select all
DEBUG:cflib.crazyflie.toc:[2]: Done!
INFO:cflib.crazyflie:Param TOC finished updating
INFO:cflib.crazyflie:Callback->Connection setup finished [radio://0/10/250K]
WARNING:cflib.crazyflie.toc:Unable to find variable [acc.x]
WARNING:cflib.crazyflie.log:Log: acc.x not in TOC, this block cannot be used!
acc.x/y/z not found in log TOC
Code: Select all
INFO:cflib.crazyflie:Callback->Connection setup finished [radio://0/10/250K]
WARNING:cflib.crazyflie:Exception while doing callback on port [2]
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cflib/crazyflie/__init__.py", line 334, in run
cb[4](pk)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cflib/crazyflie/toc.py", line 199, in _new_packet_cb
self._toc_fetch_finished()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cflib/crazyflie/toc.py", line 151, in _toc_fetch_finished
self.finishedCallback()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cflib/crazyflie/__init__.py", line 136, in _param_toc_updated_cb
self.connectSetupFinished.call(self.link_uri)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cflib/utils/callbacks.py", line 56, in call
cb(*args)
File "test log.py", line 48, in connected
gyrolog = self.crazyflie.log._new_packet_cb(gyroconf)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cflib/crazyflie/log.py", line 273, in _new_packet_cb
chan = packet.channel
AttributeError: LogConfig instance has no attribute 'channel'
Code: Select all
INFO:cflib.crazyflie:Param TOC finished updating
INFO:cflib.crazyflie:Callback->Connection setup finished [radio://0/10/250K]
INFO:root:printing the TOC
INFO:root:name=stabilizer.thrust, index=4, pytype=<H, ctype=uint16_t
INFO:root:name=stabilizer.yaw, index=3, pytype=<f, ctype=float
INFO:root:name=stabilizer.roll, index=1, pytype=<f, ctype=float
INFO:root:name=stabilizer.pitch, index=2, pytype=<f, ctype=float
INFO:root:name=motor.m4, index=5, pytype=<i, ctype=int32_t
INFO:root:name=motor.m1, index=6, pytype=<i, ctype=int32_t
INFO:root:name=motor.m3, index=8, pytype=<i, ctype=int32_t
INFO:root:name=motor.m2, index=7, pytype=<i, ctype=int32_t
INFO:root:name=pm.vbat, index=0, pytype=<f, ctype=float