示例#1
0
    def __init__(self):
        self.motors = Motors()
        #self.marg = MARG()
        # not sure if I want this here, but will add for now
        self.server = Server()

        self.prev_msg = b''
示例#2
0
def api():
    with Server() as s:
        yield s.init()
示例#3
0
    speeds = []

    if (len(msg) != 4):
        return
    for i in msg:
        if (i == 49):
            speeds.append(10)
        else:
            speeds.append(0)
    print(speeds)
    return speeds


if __name__ == "__main__":

    server = Server()
    # eventually just run Quadcopter class and it will create a server and motors inside its init(?)
    motors = Motors()
    # set motor ESC PPMs to 0 so that the motors will not move no matter what
    motors.turn_off()

    server.start_server()
    server.accept_connections()
    server.listen_in_parallel()
    print("hello")

    # now here, decipher whatever the client sends so that the pi can run the motors
    initialized = False
    while not initialized:
        if (server.client_msg == b'1000'):
            initialized = True