Skip to content

Instantly share code, notes, and snippets.

@timtrueman
Created August 22, 2011 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timtrueman/1161599 to your computer and use it in GitHub Desktop.
Save timtrueman/1161599 to your computer and use it in GitHub Desktop.
def sendThrottle(self, throttle):
data_selection_packet = "DATA0\x19\x00\x00\x00" # throttle
data = pack('ffffffff', throttle, throttle, throttle, throttle, throttle, throttle, throttle, throttle)
data_selection_packet += data
self.sock.sendto(data_selection_packet,(safe_get_ip_address(),49000))
def sendJoystick(self, joystick, rudder):
data_selection_packet = "DATA0\x08\x00\x00\x00" # joystick
data = pack('ffffffff', joystick[1], joystick[0], rudder, 0, 0, 0, 0, 0)
data_selection_packet += data
self.sock.sendto(data_selection_packet,(safe_get_ip_address(),49000))
def sendGearBrakes(self, gear, brakes):
data_selection_packet = "DATA0\x0E\x00\x00\x00" # gear/brakes
data = pack('ffffffff', gear, brakes, brakes, brakes, 0, 0, 0, 0)
data_selection_packet += data
self.sock.sendto(data_selection_packet,(safe_get_ip_address(),49000))
def sendFlaps(self, flaps):
data_selection_packet = "DATA0\x0D\x00\x00\x00" # flaps
data = pack('ffffffff', flaps, flaps, flaps, flaps, flaps, flaps, flaps, flaps)
data_selection_packet += data
self.sock.sendto(data_selection_packet,(safe_get_ip_address(),49000))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment