def command_thread_wrapper_function (distance):
    while True:
        # Step 1: Get range
        for i in range (0, configuration.config['num_directions']):
            print "Command_Thread::::Tian:: i = ", i, "distance[i] = ", distance[i]
        # Step 2: Come up with commands
        # Step 3: Issue commands
        operations.hover()
Beispiel #2
0
def main ():
    loop = 0
    #Step 1: Initialzation
    initialization.initialize()
    #Step 2: Departure
    operations.take_off()
    #while True :
    while (loop < 300): #time for a loop: 0.15s
        loop += 1
        #Step 2: Detect Range
#        for i in range(0, range_sensor.num_directions):
#            distance[i] = range_sensor.detect_range(i)
        distance[4] = range_sensor.detect_range(4)
        time.sleep(0.05)
        #Step 3: Analyze Range
#        if (distance[4] > 180):
#            #operations.hover()
#            operations.move_backward()
#        elif (distance[4] < 180):
#            #operations.hover()
#            operations.move_backward()
#        else:
#            #operations.hover()
#            operations.move_backward()
        #Step 4: Generate Next Command
        if (loop < 50):
            operations.hover()
        elif (loop < 100):
            operations.move_backward()
        elif (loop < 150):
            operations.hover()
        elif (loop < 200):
            operations.move_backward()
        elif (loop < 250):
            operations.drop()
        else :
            operations.drop()
    cleanup.cleanup()