Hello Tello Pilot!
Join our DJI Tello community & remove this banner.
Sign up

How to extract specific values from Tello state response

Joined
Dec 4, 2019
Messages
7
Reaction score
0
Hello everyone. I am trying to extract low temperature, high temperature, battery status values from the drone state response to set a condition like if the battery is less than 20%, the drone should land or if the temperature is high the drone should land. Currently, the response is displayed on TextView. Please tell me how to extract the values and set the condition. Please find the below screenshot
response.jpg
 

pgminin

Well-known member
Joined
Jan 7, 2019
Messages
96
Reaction score
95
You can extract values from a string using regular expressions.
In Python I do like this:

#convert udp state to a string
tello_udp_state=str(self.state_read.state)
#extract all numeric values using a regular expression
tello_udp_state_values=re.findall(r"[-+]?\d*\.\d+|\d+",tello_udp_state)
#take the number you need
battery=tello_udp_state_values[17]
 

New Threads

Members online

Forum statistics

Threads
5,111
Messages
36,952
Members
13,814
Latest member
EldoradoGuy