Send message to custom System Task

Firmware/software/electronics/mechanics
Post Reply
traffens
Beginner
Posts: 21
Joined: Sun Sep 26, 2021 9:01 pm

Send message to custom System Task

Post by traffens »

Good evening!

I've successfully created my own system task, and i'm attempting to implement a "pairing" sequence for the CrazyFlie. I'm able to send messages to the client through the drone's firmware, but now im looking to send messages the other way.
For example, if I wanted to send a simple "hello!" message to the drone, what would be the best way to go about this? Is there an "easy way" to go about creating the message where the packet construction is done for me?

Something tells me i'm going to have to construct the message myself and split it into <40byte packets.
jonasdn
Expert
Posts: 132
Joined: Mon Mar 01, 2021 3:13 pm

Re: Send message to custom System Task

Post by jonasdn »

Hi,

You can construct packets using the CRTPPacket class in the cflib and send them with for instance the send_packet method on the Crazyflie class.

See the API reference for guidance: https://www.bitcraze.io/documentation/r ... api/cflib/

And to see how this packets get deconstructed you can look in the firmware for instance in param.c to see how packets to the CRTP_PORT_PARAM is treated.

For extra information see: https://www.bitcraze.io/documentation/r ... reas/crtp/
traffens
Beginner
Posts: 21
Joined: Sun Sep 26, 2021 9:01 pm

Re: Send message to custom System Task

Post by traffens »

im really not seeing a way to send messages FROM the client TO the crazyflie.

The only place i can really find some good info is radiodriver.py on the client side. So if i'm making my own python script, do you think i'll need to import radiodriver and use their radio/packet handling functions?

We already have a swarm capability as well as end-to-end encryption. Something tells me i'm going to have to completely integrate the radiodriver for us to truly be able to send custom stuff to the drone.
jonasdn
Expert
Posts: 132
Joined: Mon Mar 01, 2021 3:13 pm

Re: Send message to custom System Task

Post by jonasdn »

You can check this PR where I want to add new API for parameters, it sends message from the client to the crazyflie: https://github.com/bitcraze/crazyflie-l ... n/pull/280

And a branch that accepts them: https://github.com/bitcraze/crazyflie-f ... f858d4R204
traffens
Beginner
Posts: 21
Joined: Sun Sep 26, 2021 9:01 pm

Re: Send message to custom System Task

Post by traffens »

you're the best, thank you
Post Reply