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

How to extract specific values from Tello state response

sarathp@tello

Member
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
 
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 Posts

Members online

No members online now.

Forum statistics

Threads
5,690
Messages
39,934
Members
17,023
Latest member
Repiv

New Posts