Trigger a signal to take range measurement each time pic is taken

Discussions about the AI-deck
Post Reply
bot-motion
Beginner
Posts: 4
Joined: Mon Mar 08, 2021 8:16 pm
Location: Frankfurt, Germany
Contact:

Trigger a signal to take range measurement each time pic is taken

Post by bot-motion »

Hello,

to gather data for a machine learning project sometime down the road I'm trying to build an app that syncs measurements taken by the multiranger deck with image capture by the AI deck. In detail it

* streams images to the desktop via NINA wifi (that's simply the example provided - check :) )
* adds a timestamp to the pic and stream it along (build that later)
* whenever a new pic has been transferred from the GAP to the NINA, triggers the CF platform to take measurements with the multiranger deck and forward that data with a timestamp to the desktop. (the last part is simple too)

Question: how do I best build this notification/trigger from AI deck to CF?

The GAP and the CF platform are connected by UART. The doc also mentions that NINA has a UART, but it seems not connected to the platform. Is that correct?

Then the only way to do it would be to notify the CF platform in the GAP app when the pic is taken and about to be transferred to the NINA, what do you think?

Thank you very much in advance for any thoughts!
arnaud
Bitcraze
Posts: 2459
Joined: Tue Feb 06, 2007 12:36 pm

Re: Trigger a signal to take range measurement each time pic is taken

Post by arnaud »

Hi,

I have not used much (ie. at all) the AI deck but I know pretty well the Crazyflie so I can try to help with some pointers.

There is a UART connection between the Crazyflie and the GAP8 but unfortunatly in version 1.0 of the deck, only the way from the GAP8 to the Crazyflie work. On version 1.1 of the deck both direction works.

Anyway, GAP8-to-Crazyflie is what you need. So the way I would go would be:
- Send a byte to the Crazyflie over the UART when a picture is taken (this could be a sample number for example)
- In the Crazyflie, you can create an app that receive the byte from the GAP8, samples the required multiranger sensors, and make the measuremetns and the sample number available as log variable
- On the PC, the log variables are logged fast enough so that the change of sample number can be detected and the ranges acquired.

There is some variation possible, for example instead of log variables, you can use the app channel to transfer the samples back, the log variables tends to be a bit easier (but slightly less efficient) to use.

Some interesting links and note:
- The app layer doc. Making an app is the easiest way to add code to the Crazyflie
- Unfortunately we curently read bytes coming from the gap8 in the firmware, so this line will need to be commented out and replaced with a vTaskDelay(): https://github.com/bitcraze/crazyflie-f ... deck.c#L98. Though, this line is a good example of how to get data from the gap8. In the future we likely need to implement some kind of API to make the communication more streamlined.
- The push demo is a good example of how to access and use the multiranger deck from an app: https://github.com/bitcraze/crazyflie-f ... _push_demo
Post Reply