drone: Move flight and led from control to modules

This commit is contained in:
Arthur Golubtsov
2020-06-03 10:45:08 +03:00
parent faca42f41f
commit ffa6404bdb
3 changed files with 4 additions and 5 deletions

View File

@@ -1 +0,0 @@
__all__ = ['FlightLib', 'LedLib']

View File

@@ -29,7 +29,7 @@ arming = rospy.ServiceProxy('/mavros/cmd/arming', CommandBool)
landing = rospy.ServiceProxy('/land', Trigger)
emergency_land = rospy.ServiceProxy('/emergency_land', Trigger)
services_list = ['/navigate', '/set_position', '/set_rates', '/mavros/set_mode',
services_list = ['/navigate', '/set_position', '/set_rates', '/mavros/set_mode',
'/get_telemetry', '/mavros/cmd/arming', '/land', '/mavros/param/get']
logger.info("Proxy services inited")

View File

@@ -205,7 +205,7 @@ def strip_off():
def led_thread():
global mode
logger.info("Starting LedLib thread")
logger.info("Starting led control thread")
iteration = 0
while True:
if mode == "rainbow":
@@ -242,7 +242,7 @@ def led_thread():
# init
def init_led(led_pin = LED_PIN):
def init(led_pin = LED_PIN):
global strip
strip = Adafruit_NeoPixel(LED_COUNT, led_pin, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
strip.begin()
@@ -252,7 +252,7 @@ def init_led(led_pin = LED_PIN):
if __name__ == '__main__':
init_led()
init()
try:
rainbow()
except KeyboardInterrupt: