Reading logging data over Bluetooth

Firmware/software/electronics/mechanics
Post Reply
ECiocca
Beginner
Posts: 6
Joined: Wed May 30, 2018 9:51 pm

Reading logging data over Bluetooth

Post by ECiocca »

Hello All,

I am trying to read some sensor data for external sensors I have added to my CF2.0. I have verified that the sensors are working as expected, and when using the VM/Python Client the logged variables are showing as expected. However when I try to access the logging variables (any of them, or the TOC) on my own client I am getting blank data.
I am using Unity3D/c#/a startech BLE c# driver to do communication with the drone. It seems to work fine for sending commands. But, for example, when I send the command "50-01" (port 5, channel 0, command 1 = Get TOC Info) I am expecting a response with 8 bytes including data about the TOC length, CRC, etc. Instead it is reading 20 bytes of zeroes:
06-12 15:26:02.056 310 1394 I UnityBleBridge: onCharacteristicRead() : 00000202-1c7f-4f9e-947b-43b7c00a9a08
06-12 15:26:02.100 310 474 I Unity : Data: (20) 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

Does anyone have any clues about what's going on here?
Thank you!
Eric
ECiocca
Beginner
Posts: 6
Joined: Wed May 30, 2018 9:51 pm

Re: Reading logging data over Bluetooth

Post by ECiocca »

Following up:

I modified the firmware to create my own CRTP channel at 0x0A which returns only the sensor data I'm looking for. When I trigger that and read the response I get the same thing (20 0's of data, then 9 0's of data, then another few 20 0's). It seems almost as though another process is filling the outbound queue with garbage?
whoenig
Expert
Posts: 395
Joined: Mon Oct 27, 2014 2:55 am

Re: Reading logging data over Bluetooth

Post by whoenig »

I am not sure about BLE and your setup, but in general the communication with the CF is fully asynchronous, i.e., whenever you will send a request it might be answered in a future request. A simple test would be to repeat sending your request (and receiving responses) to see if you get a valid response sometimes.

You should also consider using one of the existing libraries instead, as the communication is complex. There is crazyflie_cpp (which I author) and also a crazyserver that provides a REST API (https://github.com/mikehamer/crazyserver).
Post Reply