예제 #1
0
                prev_angy = new_angy
                prev_angt = new_angt

                # stefie10:  Make sure this still exists and works in the refactor!

                if shouldILand():
                    print "Landing because a safety check failed."
                    break

            except:
                print "BOARD ERRORS!!!!!!!!!!!!!!"
                print "BOARD ERRORS!!!!!!!!!!!!!!"
                print "BOARD ERRORS!!!!!!!!!!!!!!"
                print "BOARD ERRORS!!!!!!!!!!!!!!"
                print "BOARD ERRORS!!!!!!!!!!!!!!"
                print "BOARD ERRORS!!!!!!!!!!!!!!"
                sys.exit()
                # stefie10: None of your code will be called after
                # sys.exit, so this is nonsensical.  it is almost
                # always better to raise an exception or break out of
                # the loop to close the board, to try to do a clean
                # exit.
                board.close()

        board.sendCMD(8, MultiWii.SET_RAW_RC, cmds)
        board.receiveDataPacket()
        time.sleep(0.01)

    print "Shutdown Recieved"
    board.disarm()
def main():
    board = MW('/dev/ttyUSB0')
    data = board.getData(MW.ANALOG)
    print 'BATTERY VOLTAGE IS\t{}v'.format(voltage(data))
    board.close()