Page 1 of 1
API for reading battery status
Posted: Thu Nov 05, 2020 3:47 pm
I would like to know what would I need to put in a Python script to get the current battery status of a drone. Thank you!
Re: API for reading battery status
Posted: Fri Nov 06, 2020 9:21 am
The battery status is expose as log variables in the "pm? log group.
- pm.batteryLevel is the battery level from 0 to 100
- pm.state indicates if the battery is charging or discharging
- pm.vbat is the battery voltage in volts
There is examples in the python lib project that shows how to read log variables from a python script.
Most information about the Crazyflie are available as log variables. You can see all of the existing log variables in the client "LogTOC" tab. You can also plot the variables in the plotter in order to see the real time values.