I’m trying to write a program to get the percent of battery remaining on my drone (real drone not simulator). The battery.health event message seems to do what I want but everytime I call getState the output is always
OrderedDict([('state_of_health', 100)]) even when I leave drone running and the battery level obviously should not be 100%. Is this the correct way to get the amount of battery charge left on the drone?
import math import olympe import time from olympe.messages.battery import health, voltage, alert drone = olympe.Drone("192.168.42.1", loglevel=1) drone.connection() # display current battery life every 5 seconds, however this always returns # 100% even when I leave drone running. while True: print("Battery health before takeoff :", drone.get_state(health)) time.sleep(5) drone.disconnection()