Firmware and Python Library

Post Reply
Posts: 3
Joined: Tue Jan 22, 2019 8:43 am
Location: Canada

Firmware and Python Library

Post by droneEnthusiast » Wed Jun 05, 2019 4:30 pm

Hi all,

I was wondering if I were to add a function in crtp_commander_high_level.c, I understand how to build the code and flash the crazyflie. However, I'm a bit confused on how I can modify in order to use this C function in a python script?

Another related question is how can I access the pmGetBatteryVoltage() function in pm_stm32f4.c from a python script? I would like to monitor the battery level as the crazyflie is in flight.

Any suggestions are greatly appreciated! Thanks!

Posts: 1999
Joined: Tue Feb 06, 2007 12:36 pm

Re: Firmware and Python Library

Post by arnaud » Wed Jun 12, 2019 9:34 am


If you add a function in the high level commander, you need to add a packet decoding for it so that this function can be called when a packet is sent to the Crazyflie: ... vel.c#L262

In the lib, you can then add a function that generates this packet and send it over the radio: ...

Generally, there will be one file in the python lib talking to one file in the firmware, packet will be encoded on one side and decoded on the other side. This is the case with the high level commander.

As for the pmGetBatteryVoltage(), this is something that would typically be available as a log variable. In that case it is available as the variable "pm.vbat": ... 2f4.c#L388.

Post Reply