Advertisement
Guest User

AVR Test Recon Path

a guest
Nov 18th, 2023
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | Software | 0 0
  1.     def recon_test(self, payload) -> None:
  2.         home_captured = False
  3.         armed = False
  4.         takeoff = False
  5.         land = False
  6.         path_completed = False
  7.         current_time = time.time()
  8.         while not path_completed:
  9.             if not home_captured:
  10.                 self.send_message(
  11.                     "avr/fcm/capture_home",
  12.                     {}
  13.                 )
  14.                 home_captured = True
  15.             if not armed:
  16.                 self.send_message(
  17.                     "avr/fcm/actions",
  18.                     {"action": "arm", "payload": {}}
  19.                 )
  20.                 armed = True
  21.             if not takeoff and time.time() - current_time > 1.0:
  22.                 self.send_message(
  23.                     "avr/fcm/actions",
  24.                     {"action": "takeoff", "payload": {"alt": 0.5}}
  25.                 )
  26.                 takeoff = True
  27.             if not land and time.time() - current_time > 5.0:
  28.                 self.send_message(
  29.                     "avr/fcm/actions",
  30.                     {
  31.                         "action": "land",
  32.                         "payload": {}
  33.                     }
  34.                 )
  35.                 land = True
  36.                 path_completed = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement