How to receive and parse messages from UART in APP layer? #1105
-
Hello, I indeed notice some suggestions on similar question, such as https://www.bitcraze.io/documentation/repository/crazyflie-lib-python/master/development/uart_communication/. But this tutorial is for someone who wants to control crazyflie bu UART on Raspberry Pi. I also found a tutorial about Serial input basics on Arduino, https://forum.arduino.cc/t/serial-input-basics-updated/382007. But it doesn't work on APP layer. For my problem, I don't need Raspberry Pi to control the crazyflie since its only task is to send coordinate information. And all the control commands will be executed on APP Layer by Crazybolt itself. So, my question is how to receive and parse messages from UART in APP layer? Actually, I have successfully implemented these examples: app_hello_world, app_push_demo. Could you please give me some advice on this? Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi! Indeed I would advise this tutorial that you already have given. It is for CRTP connection, so you can do anything with it that you want. In your case, I would recommend setting up a logging parameter in the app layer and read it out in the cflib logging retrieval. Then you'll only read out the logging from the bolt, but you can still control the bolt from the app layer alone. However, the top solution will block any other CRTP connections from other sources like your computer, as there can only be a 1-1 connection with crtp... So perhaps that is also another reason to go more low level. As you have already seen in the tutorial explained before, that the abbrivation CPX comes up. That stands for Crazyflie Packet exchange and that is actually a package protocol that wraps the messages in packages and makes sure it reads it out at the end. that is very flexible and can be used for simple messages as well. For instance, we use it for the AIdeck video streaming example, where the package only contains the image information. This is an uart information sending example of the AIdeck with CPX, which perhaps something that you can look at for some inspiration: https://www.bitcraze.io/documentation/repository/aideck-gap8-examples/master/other-examples/stm_gap8_cpx/. If you want to go one step lower (and since you only have 2 values that might be fine), then I thinkt that the uart simple example of the AIdeck still exists:
Anyway, it would be easier to use the first 2 option as there is already a message protocol to use instead of making it yourself, especially since you are sending 2 values and not 1. |
Beta Was this translation helpful? Give feedback.
-
Hello,
The product page for the board can be found here: https://www.luckfox.com/Luckfox-Pico-Mini-B, and in the wiki here: https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-UART. With the goal of using the Luckfox board (onboard the drone since it's tiny) as the "client" for the drone, as if it was a PC connecting over Crazyradio, using serial communication instead of CR. In particular we have the following questions:
|
Beta Was this translation helpful? Give feedback.
Hi! Indeed I would advise this tutorial that you already have given. It is for CRTP connection, so you can do anything with it that you want. In your case, I would recommend setting up a logging parameter in the app layer and read it out in the cflib logging retrieval. Then you'll only read out the logging from the bolt, but you can still control the bolt from the app layer alone.
However, the top solution will block any other CRTP connections from other sources like your computer, as there can only be a 1-1 connection with crtp... So perhaps that is also another reason to go more low level.
As you have already seen in the tutorial explained before, that the abbrivation CPX comes up. That…