(window.webpackJsonp=window.webpackJsonp||[]).push([[1051],{2182:function(t,s,a){"use strict";a.r(s);var n=a(18),e=Object(n.a)({},(function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"using-dronekit-to-communicate-with-px4"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#using-dronekit-to-communicate-with-px4"}},[t._v("#")]),t._v(" Using DroneKit to communicate with PX4")]),t._v(" "),a("p",[a("a",{attrs:{href:"http://dronekit.io",target:"_blank",rel:"noopener noreferrer"}},[t._v("DroneKit"),a("OutboundLink")],1),t._v(" helps you create powerful apps for UAVs. These apps run on a UAV’s Companion Computer, and augment the autopilot by performing tasks that are both computationally intensive and require a low-latency link (e.g. computer vision).")]),t._v(" "),a("p",[t._v("DroneKit and PX4 are currently working on getting full compatibility. As of DroneKit-python 2.2.0 there is basic support for mission handling and vehicle monitoring.")]),t._v(" "),a("h2",{attrs:{id:"setting-up-dronekit-with-px4"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#setting-up-dronekit-with-px4"}},[t._v("#")]),t._v(" Setting up DroneKit with PX4")]),t._v(" "),a("p",[t._v("Start by installing DroneKit-python from the current master.")]),t._v(" "),a("div",{staticClass:"language-sh extra-class"},[a("pre",{pre:!0,attrs:{class:"language-sh"}},[a("code",[a("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" clone https://github.com/dronekit/dronekit-python.git\n"),a("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("cd")]),t._v(" ./dronekit-python\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sudo")]),t._v(" python setup.py build\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sudo")]),t._v(" python setup.py "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("install")]),t._v("\n")])])]),a("p",[t._v("Create a new python file and import DroneKit, pymavlink and basic modules")]),t._v(" "),a("div",{staticClass:"language-C extra-class"},[a("pre",{pre:!0,attrs:{class:"language-c"}},[a("code",[a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Import DroneKit"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),t._v("Python")])]),t._v("\nfrom dronekit import connect"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Command"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" LocationGlobal\nfrom pymavlink import mavutil\nimport time"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" sys"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" argparse"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" math\n\n")])])]),a("p",[t._v("Connect to a MAVLink port of your drone or simulation (e.g. "),a("RouterLink",{attrs:{to:"/ko/simulation/jmavsim.html"}},[t._v("JMavSim")]),t._v(").")],1),t._v(" "),a("div",{staticClass:"language-C extra-class"},[a("pre",{pre:!0,attrs:{class:"language-c"}},[a("code",[a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Connect to the Vehicle")])]),t._v("\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Connecting"')]),t._v("\nconnection_string "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'127.0.0.1:14540'")]),t._v("\nvehicle "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("connect")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("connection_string"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wait_ready"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("True"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n")])])]),a("p",[t._v("Display some basic status information")]),t._v(" "),a("div",{staticClass:"language-C extra-class"},[a("pre",{pre:!0,attrs:{class:"language-c"}},[a("code",[a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Display basic vehicle state")])]),t._v("\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" Type: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_vehicle_type\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" Armed: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("armed\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" System status: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("system_status"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("state\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" GPS: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gps_0\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" Alt: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("location"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("global_relative_frame"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt\n")])])]),a("h2",{attrs:{id:"full-mission-example"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#full-mission-example"}},[t._v("#")]),t._v(" Full mission example")]),t._v(" "),a("p",[t._v("The following python script shows a full mission example using DroneKit and PX4. Mode switching is not yet fully supported from DroneKit, we therefor send our own custom mode switching commands.")]),t._v(" "),a("div",{staticClass:"language-C extra-class"},[a("pre",{pre:!0,attrs:{class:"language-c"}},[a("code",[t._v("################################################################################################\n# @File DroneKitPX4"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("py\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Example usage of DroneKit with PX4")])]),t._v("\n#\n# @author Sander Smeets "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("sander@droneslab"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("com"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n#\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Code partly based on "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("DroneKit")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("c"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" Copyright "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("2015")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("2016")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),t._v("D Robotics"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")])])]),t._v("\n################################################################################################\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Import DroneKit"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),t._v("Python")])]),t._v("\nfrom dronekit import connect"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Command"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" LocationGlobal\nfrom pymavlink import mavutil\nimport time"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" sys"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" argparse"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" math\n\n\n################################################################################################\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Settings")])]),t._v("\n################################################################################################\n\nconnection_string       "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'127.0.0.1:14540'")]),t._v("\nMAV_MODE_AUTO   "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("https")]),a("span",{pre:!0,attrs:{class:"token expression"}},[a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")])]),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//github.com/PX4/Firmware/blob/master/Tools/mavlink_px4.py")])]),t._v("\n\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Parse connection argument")])]),t._v("\nparser "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" argparse"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("ArgumentParser")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nparser"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add_argument")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"-c"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"--connect"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" help"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"connection string"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nargs "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" parser"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("parse_args")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" args"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("connect"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n    connection_string "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" args"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("connect\n\n\n################################################################################################\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Init")])]),t._v("\n################################################################################################\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Connect to the Vehicle")])]),t._v("\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Connecting"')]),t._v("\nvehicle "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("connect")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("connection_string"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wait_ready"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("True"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\ndef "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("PX4setMode")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("mavMode"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n    vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_master"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mav"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("command_long_send")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_master"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("target_system"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_master"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("target_component"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n                                               mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_CMD_DO_SET_MODE"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n                                               mavMode"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n                                               "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n\n\ndef "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("get_location_offset_meters")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("original_location"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" dNorth"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" dEast"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" alt"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n    "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('""')]),t._v('"\n    Returns a LocationGlobal object containing the latitude'),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("longitude `dNorth` and `dEast` metres from the\n    specified `original_location`"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v(" The returned Location adds the entered `alt` value to the altitude of the `original_location`"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("\n    The function is useful when you want to move the vehicle around specifying locations relative to\n    the current vehicle position"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("\n    The algorithm is relatively accurate over small "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("distances")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),t._v("m within "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("km"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" except close to the poles"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("\n    For more information see"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n    http"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//gis.stackexchange.com/questions/2951/algorithm-for-offsetting-a-latitude-longitude-by-some-amount-of-meters")]),t._v("\n    "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('""')]),t._v('"\n    earth_radius'),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("6378137.0")]),t._v(" #Radius of "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"spherical"')]),t._v(" earth\n    "),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Coordinate offsets in radians")])]),t._v("\n    dLat "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" dNorth"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("earth_radius\n    dLon "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" dEast"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("earth_radius"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("math"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("cos")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("math"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("pi"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("original_location"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lat"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("180")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n    "),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("New position in decimal degrees")])]),t._v("\n    newlat "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" original_location"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lat "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("dLat "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("180")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("math"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("pi"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n    newlon "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" original_location"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lon "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("dLon "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("180")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("math"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("pi"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n    "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("LocationGlobal")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("newlat"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" newlon"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("original_location"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("alt"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n\n\n\n\n################################################################################################\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Listeners")])]),t._v("\n################################################################################################\n\nhome_position_set "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" False\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Create a message listener "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" home position fix")])]),t._v("\n@vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("on_message")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'HOME_POSITION'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ndef "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("listener")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("self"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" home_position"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n    global home_position_set\n    home_position_set "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" True\n\n\n\n################################################################################################\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Start mission example")])]),t._v("\n################################################################################################\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("wait")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" a home position lock")])]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("while")]),t._v(" not home_position_set"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n    print "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Waiting for home position..."')]),t._v("\n    time"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sleep")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Display basic vehicle state")])]),t._v("\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" Type: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_vehicle_type\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" Armed: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("armed\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" System status: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("system_status"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("state\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" GPS: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gps_0\nprint "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('" Alt: %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("location"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("global_relative_frame"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Change to AUTO mode")])]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("PX4setMode")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("MAV_MODE_AUTO"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ntime"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sleep")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Load commands")])]),t._v("\ncmds "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("commands\ncmds"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("clear")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\nhome "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("location"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("global_relative_frame\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("takeoff")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("to "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),t._v(" meters")])]),t._v("\nwp "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("get_location_offset_meters")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("home"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\ncmd "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("Command")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_FRAME_GLOBAL_RELATIVE_ALT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_CMD_NAV_TAKEOFF"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lat"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lon"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ncmds"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cmd"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("move")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),t._v(" meters north")])]),t._v("\nwp "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("get_location_offset_meters")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\ncmd "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("Command")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_FRAME_GLOBAL_RELATIVE_ALT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_CMD_NAV_WAYPOINT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lat"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lon"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ncmds"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cmd"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("move")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),t._v(" meters east")])]),t._v("\nwp "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("get_location_offset_meters")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\ncmd "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("Command")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_FRAME_GLOBAL_RELATIVE_ALT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_CMD_NAV_WAYPOINT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lat"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lon"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ncmds"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cmd"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("move")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),t._v(" meters south")])]),t._v("\nwp "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("get_location_offset_meters")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\ncmd "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("Command")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_FRAME_GLOBAL_RELATIVE_ALT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_CMD_NAV_WAYPOINT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lat"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lon"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ncmds"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cmd"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("move")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),t._v(" meters west")])]),t._v("\nwp "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("get_location_offset_meters")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\ncmd "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("Command")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_FRAME_GLOBAL_RELATIVE_ALT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_CMD_NAV_WAYPOINT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lat"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lon"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ncmds"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cmd"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("land")])]),t._v("\nwp "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("get_location_offset_meters")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("home"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\ncmd "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("Command")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_FRAME_GLOBAL_RELATIVE_ALT"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mavutil"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mavlink"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MAV_CMD_NAV_LAND"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lat"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("lon"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" wp"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("alt"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ncmds"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cmd"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Upload mission")])]),t._v("\ncmds"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("upload")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ntime"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sleep")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Arm vehicle")])]),t._v("\nvehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("armed "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" True\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("monitor")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("mission execution")])]),t._v("\nnextwaypoint "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("commands"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("next\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("while")]),t._v(" nextwaypoint "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("len")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("commands"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n    "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("commands"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("next "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" nextwaypoint"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n        display_seq "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("commands"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("next"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n        print "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Moving to waypoint %s"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" display_seq\n        nextwaypoint "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("commands"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("next\n    time"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sleep")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("wait")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" the vehicle to land")])]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("while")]),t._v(" vehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("commands"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("next "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n    time"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sleep")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Disarm vehicle")])]),t._v("\nvehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("armed "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" False\ntime"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sleep")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token macro property"}},[a("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token expression"}},[t._v("Close vehicle object before exiting script")])]),t._v("\nvehicle"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("close")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\ntime"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("sleep")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n")])])])])}),[],!1,null,null,null);s.default=e.exports}}]);