def stopWork(self): lc = lcm.LCM("udpm://239.255.76.67:7667?ttl=1") msg = SimHandler() msg.timestamp = int(time.time() * 1000000) msg.parameters = str("") msg.handler = -2 lc.publish("SIMULATOR", msg.encode())
def controlVer(self, value): lc = lcm.LCM("udpm://239.255.76.67:7667?ttl=1") msg = SimHandler() dictValue = eval("{\"horizontal\" : 0, \"vertical\" : 0}") dictValue["vertical"] = (value / 100.0 - 0.5) * 2 jsonValue = JSONEncoder().encode(dictValue) msg.timestamp = int(time.time() * 1000000) msg.parameters = jsonValue msg.handler = 1 lc.publish("SIMULATOR", msg.encode())