Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import math
- from bell.avr.mqtt.client import MQTTModule
- from bell.avr.mqtt.payloads import AvrPcmSetBaseColorPayload, AvrPcmSetServoAbsPayload, AvrAutonomousPayload
- from loguru import logger
- # Okay
- class Sandbox(MQTTModule):
- def __init__(self) -> None:
- super().__init__()
- logger.debug("Class initialized")
- self.enabled = False
- self.topic_map = {"avr/autonomous": self.on_autonomous_message}
- def on_autonomous_message(self, payload: AvrAutonomousPayload) -> None:
- self.enabled = payload["enable"]
- def autonomous_code(self) -> None:
- while self.enabled:
- box.send_message("avr/pcm/set_base_color", {"wrgb": [255, 255, 255, 255]})
- print("Autonomous Flight Enabled")
- time.sleep(1)
- if __name__ == "__main__":
- box = Sandbox()
- box.run_non_blocking()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement