MCPcopy Create free account
hub / github.com/dronekit/dronekit-python / DroneDelivery

Class DroneDelivery

examples/drone_delivery/drone_delivery.py:200–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198
199
200class DroneDelivery(object):
201 def __init__(self, drone):
202 self.drone = drone
203 self.templates = Templates(self.drone.home_coords)
204
205 @cherrypy.expose
206 def index(self):
207 return self.templates.index()
208
209 @cherrypy.expose
210 def command(self):
211 return self.templates.command(self.drone.get_location())
212
213 @cherrypy.expose
214 @cherrypy.tools.json_out()
215 def vehicle(self):
216 return dict(position=self.drone.get_location())
217
218 @cherrypy.expose
219 def track(self, lat=None, lon=None):
220 # Process POST request from Command
221 # Sending MAVLink packet with goto instructions
222 if(lat is not None and lon is not None):
223 self.drone.goto([lat, lon], True)
224
225 return self.templates.track(self.drone.get_location())
226
227
228# Connect to the Vehicle

Callers 1

_run_serverMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected