Esempio n. 1
0
    async def send_kills(self):
        while True:
            if self.home_page_connection is None:
                js = Joystick()
                js.kill = True
                js.forward_back = 0
                js.left_right = 0
                self.lcm_.publish("/drive_control", js.encode())

            await asyncio.sleep(0.5)
Esempio n. 2
0
async def transmit_fake_joystick():
    while True:
        new_joystick = Joystick()
        new_joystick.forward_back = random.uniform(-1, 1)
        new_joystick.left_right = random.uniform(-1, 1)
        new_joystick.dampen = random.uniform(-1, 1)
        new_joystick.kill = False
        new_joystick.restart = False

        with await lock:
            lcm_.publish('/joystick', new_joystick.encode())

        print("Published new joystick\nfb: {}   lr: {}"
              .format(new_joystick.forward_back, new_joystick.left_right))
        await asyncio.sleep(0.5)