Skip to content

Instantly share code, notes, and snippets.

@dimaxano
Created September 18, 2020 08:44
Show Gist options
  • Save dimaxano/8735bccc8c4be8906801e0a47f5f66ab to your computer and use it in GitHub Desktop.
Save dimaxano/8735bccc8c4be8906801e0a47f5f66ab to your computer and use it in GitHub Desktop.
import inspect
import sys
import os
import time
connection_string = "udp:127.0.0.1:14551"
# connection_string = "/dev/ttyACM0"
# Import DroneKit-Python
from dronekit import connect, VehicleMode
# Connect to the Vehicle.
print("Connecting to vehicle on: %s" % (connection_string,))
vehicle = connect(connection_string, wait_ready=True, source_system=17, source_component=240)
i = 0
while i != 100:
msg = vehicle.message_factory.vision_position_estimate_encode(int(time.time()*1e7),0,0,0,0,0,0)
print(msg)
vehicle.send_mavlink(msg)
time.sleep(1)
i+=1
# Close vehicle object before exiting script
vehicle.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment