Skip to content

Instantly share code, notes, and snippets.

@patrickelectric
Last active November 1, 2019 02:47
Show Gist options
  • Select an option

  • Save patrickelectric/756d9756b37487eecaf236709d0eaab5 to your computer and use it in GitHub Desktop.

Select an option

Save patrickelectric/756d9756b37487eecaf236709d0eaab5 to your computer and use it in GitHub Desktop.
Ardupilot fake GPS with GPSInput module
#!/usr/bin/python
import time
import socket
import json
sockit = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sockit.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sockit.setblocking(0)
while True:
result = {}
result['lat'] = 1000000
result['lon'] = 1234567
result['fix_type'] = 3
result['hdop'] = 1.0
result['vdop'] = 1.0
result['satellites_visible'] = 7
result['ignore_flags'] = 8 | 16 | 32
result = json.dumps(result)
sockit.sendto(result.encode(), ('0.0.0.0', 25100))
time.sleep(0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment