Esempio n. 1
0
    def my_handler(channel, data):
        msg = SimHandler.decode(data)
        global channelName
        global timestamp
        global handler
        global parameters

        channelName = channel
        timestamp = str(msg.timestamp)
        handler = str(msg.handler)
        parameters = str(msg.parameters)
Esempio n. 2
0
 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())
Esempio n. 3
0
 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())