Esempio n. 1
0
                takeoff = 1 - takeoff
                sender.takeoff(takeoff)
        if e != None:
            sender.emergency(e)
        if c == 1:
            sender.resettrim()
            print "Resetting trim"
        if n == 1:
            sender.confignavdata()
        if v != None:
            if v == 1:
                global record
                record = 1 - record
                sender.recordvideo(record)
        if m == 1:
            sender.magcalib()
            print "Calib mag"
        ud = pressed[pygame.K_UP] - pressed[pygame.K_DOWN]
        lr = pressed[pygame.K_LEFT] - pressed[pygame.K_RIGHT]
        rot = pressed[pygame.K_a] - pressed[pygame.K_d]
        alt = pressed[pygame.K_w] - pressed[pygame.K_s]
        sender.command(ud, lr, rot, alt)
    else:
        sender.update()


pygame.init()
window = pygame.display.set_mode((100, 100))

messages.start(test, 30)
Esempio n. 2
0
#!/usr/bin/python
import messages

sender = messages.Sender()
def test():
    sender.takeoff(0)

messages.start(test, 30)
Esempio n. 3
0
async def start_bot(message: types.Message):
    await message.reply(messages.start(message.from_user),
                        reply_markup=types.ReplyKeyboardRemove())
Esempio n. 4
0
if __name__=="__main__":
    sender = messages.Sender()
    q = Queue.Queue()
    pipereader = PipeReader("fifo_ardrone_cmd", q)
    pipereader.start()
    def readpipe():
        try:
            r = q.get(False)
        except Queue.Empty:
            print "no message"
            sender.update()
        else:
            print "received", r
            if r == "T0":
                sender.takeoff(0)
            elif r == "T1":
                sender.takeoff(1)
            elif r == "E0":
                sender.emergency(0)
            elif r == "E1":
                sender.emergency(1)
            elif r[0] == "C":
                c = [float(a) for a in r[1:].split(',')]
                sender.command(c[0], c[1], c[2], c[3])
                sender.update()
    
    try:
        messages.start(readpipe, 30)
    except KeyboardInterrupt:
        pipereader.stop()