id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
235,700 | ArduPilot/MAVProxy | MAVProxy/mavproxy.py | main_loop | def main_loop():
'''main processing loop'''
global screensaver_cookie
if not mpstate.status.setup_mode and not opts.nowait:
for master in mpstate.mav_master:
if master.linknum != 0:
break
print("Waiting for heartbeat from %s" % master.address)
se... | python | def main_loop():
'''main processing loop'''
global screensaver_cookie
if not mpstate.status.setup_mode and not opts.nowait:
for master in mpstate.mav_master:
if master.linknum != 0:
break
print("Waiting for heartbeat from %s" % master.address)
se... | [
"def",
"main_loop",
"(",
")",
":",
"global",
"screensaver_cookie",
"if",
"not",
"mpstate",
".",
"status",
".",
"setup_mode",
"and",
"not",
"opts",
".",
"nowait",
":",
"for",
"master",
"in",
"mpstate",
".",
"mav_master",
":",
"if",
"master",
".",
"linknum",... | main processing loop | [
"main",
"processing",
"loop"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/mavproxy.py#L842-L946 |
235,701 | ArduPilot/MAVProxy | MAVProxy/mavproxy.py | set_mav_version | def set_mav_version(mav10, mav20, autoProtocol, mavversionArg):
'''Set the Mavlink version based on commandline options'''
# if(mav10 == True or mav20 == True or autoProtocol == True):
# print("Warning: Using deprecated --mav10, --mav20 or --auto-protocol options. Use --mavversion instead")
#sanity c... | python | def set_mav_version(mav10, mav20, autoProtocol, mavversionArg):
'''Set the Mavlink version based on commandline options'''
# if(mav10 == True or mav20 == True or autoProtocol == True):
# print("Warning: Using deprecated --mav10, --mav20 or --auto-protocol options. Use --mavversion instead")
#sanity c... | [
"def",
"set_mav_version",
"(",
"mav10",
",",
"mav20",
",",
"autoProtocol",
",",
"mavversionArg",
")",
":",
"# if(mav10 == True or mav20 == True or autoProtocol == True):",
"# print(\"Warning: Using deprecated --mav10, --mav20 or --auto-protocol options. Use --mavversion instead\"... | Set the Mavlink version based on commandline options | [
"Set",
"the",
"Mavlink",
"version",
"based",
"on",
"commandline",
"options"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/mavproxy.py#L988-L1011 |
235,702 | ArduPilot/MAVProxy | MAVProxy/mavproxy.py | MPState.mav_param | def mav_param(self):
'''map mav_param onto the current target system parameters'''
compid = self.settings.target_component
if compid == 0:
compid = 1
sysid = (self.settings.target_system, compid)
if not sysid in self.mav_param_by_sysid:
self.mav_param_by_s... | python | def mav_param(self):
'''map mav_param onto the current target system parameters'''
compid = self.settings.target_component
if compid == 0:
compid = 1
sysid = (self.settings.target_system, compid)
if not sysid in self.mav_param_by_sysid:
self.mav_param_by_s... | [
"def",
"mav_param",
"(",
"self",
")",
":",
"compid",
"=",
"self",
".",
"settings",
".",
"target_component",
"if",
"compid",
"==",
"0",
":",
"compid",
"=",
"1",
"sysid",
"=",
"(",
"self",
".",
"settings",
".",
"target_system",
",",
"compid",
")",
"if",
... | map mav_param onto the current target system parameters | [
"map",
"mav_param",
"onto",
"the",
"current",
"target",
"system",
"parameters"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/mavproxy.py#L245-L253 |
235,703 | ArduPilot/MAVProxy | MAVProxy/modules/lib/win_layout.py | get_wx_window_layout | def get_wx_window_layout(wx_window):
'''get a WinLayout for a wx window'''
dsize = wx.DisplaySize()
pos = wx_window.GetPosition()
size = wx_window.GetSize()
name = wx_window.GetTitle()
return WinLayout(name, pos, size, dsize) | python | def get_wx_window_layout(wx_window):
'''get a WinLayout for a wx window'''
dsize = wx.DisplaySize()
pos = wx_window.GetPosition()
size = wx_window.GetSize()
name = wx_window.GetTitle()
return WinLayout(name, pos, size, dsize) | [
"def",
"get_wx_window_layout",
"(",
"wx_window",
")",
":",
"dsize",
"=",
"wx",
".",
"DisplaySize",
"(",
")",
"pos",
"=",
"wx_window",
".",
"GetPosition",
"(",
")",
"size",
"=",
"wx_window",
".",
"GetSize",
"(",
")",
"name",
"=",
"wx_window",
".",
"GetTit... | get a WinLayout for a wx window | [
"get",
"a",
"WinLayout",
"for",
"a",
"wx",
"window"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/win_layout.py#L35-L41 |
235,704 | ArduPilot/MAVProxy | MAVProxy/modules/lib/win_layout.py | set_wx_window_layout | def set_wx_window_layout(wx_window, layout):
'''set a WinLayout for a wx window'''
try:
wx_window.SetSize(layout.size)
wx_window.SetPosition(layout.pos)
except Exception as ex:
print(ex) | python | def set_wx_window_layout(wx_window, layout):
'''set a WinLayout for a wx window'''
try:
wx_window.SetSize(layout.size)
wx_window.SetPosition(layout.pos)
except Exception as ex:
print(ex) | [
"def",
"set_wx_window_layout",
"(",
"wx_window",
",",
"layout",
")",
":",
"try",
":",
"wx_window",
".",
"SetSize",
"(",
"layout",
".",
"size",
")",
"wx_window",
".",
"SetPosition",
"(",
"layout",
".",
"pos",
")",
"except",
"Exception",
"as",
"ex",
":",
"... | set a WinLayout for a wx window | [
"set",
"a",
"WinLayout",
"for",
"a",
"wx",
"window"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/win_layout.py#L43-L49 |
235,705 | ArduPilot/MAVProxy | MAVProxy/modules/lib/win_layout.py | set_layout | def set_layout(wlayout, callback):
'''set window layout'''
global display_size
global window_list
global loaded_layout
global pending_load
global vehiclename
#if not wlayout.name in window_list:
# print("layout %s" % wlayout)
if not wlayout.name in window_list and loaded_layout is... | python | def set_layout(wlayout, callback):
'''set window layout'''
global display_size
global window_list
global loaded_layout
global pending_load
global vehiclename
#if not wlayout.name in window_list:
# print("layout %s" % wlayout)
if not wlayout.name in window_list and loaded_layout is... | [
"def",
"set_layout",
"(",
"wlayout",
",",
"callback",
")",
":",
"global",
"display_size",
"global",
"window_list",
"global",
"loaded_layout",
"global",
"pending_load",
"global",
"vehiclename",
"#if not wlayout.name in window_list:",
"# print(\"layout %s\" % wlayout)",
"if"... | set window layout | [
"set",
"window",
"layout"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/win_layout.py#L51-L66 |
235,706 | ArduPilot/MAVProxy | MAVProxy/modules/lib/win_layout.py | layout_filename | def layout_filename(fallback):
'''get location of layout file'''
global display_size
global vehiclename
(dw,dh) = display_size
if 'HOME' in os.environ:
dirname = os.path.join(os.environ['HOME'], ".mavproxy")
if not os.path.exists(dirname):
try:
os.mkdir(di... | python | def layout_filename(fallback):
'''get location of layout file'''
global display_size
global vehiclename
(dw,dh) = display_size
if 'HOME' in os.environ:
dirname = os.path.join(os.environ['HOME'], ".mavproxy")
if not os.path.exists(dirname):
try:
os.mkdir(di... | [
"def",
"layout_filename",
"(",
"fallback",
")",
":",
"global",
"display_size",
"global",
"vehiclename",
"(",
"dw",
",",
"dh",
")",
"=",
"display_size",
"if",
"'HOME'",
"in",
"os",
".",
"environ",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | get location of layout file | [
"get",
"location",
"of",
"layout",
"file"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/win_layout.py#L68-L88 |
235,707 | ArduPilot/MAVProxy | MAVProxy/modules/lib/win_layout.py | save_layout | def save_layout(vehname):
'''save window layout'''
global display_size
global window_list
global vehiclename
if display_size is None:
print("No layouts to save")
return
vehiclename = vehname
fname = layout_filename(False)
if fname is None:
print("No file to save l... | python | def save_layout(vehname):
'''save window layout'''
global display_size
global window_list
global vehiclename
if display_size is None:
print("No layouts to save")
return
vehiclename = vehname
fname = layout_filename(False)
if fname is None:
print("No file to save l... | [
"def",
"save_layout",
"(",
"vehname",
")",
":",
"global",
"display_size",
"global",
"window_list",
"global",
"vehiclename",
"if",
"display_size",
"is",
"None",
":",
"print",
"(",
"\"No layouts to save\"",
")",
"return",
"vehiclename",
"=",
"vehname",
"fname",
"=",... | save window layout | [
"save",
"window",
"layout"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/win_layout.py#L90-L115 |
235,708 | ArduPilot/MAVProxy | MAVProxy/modules/lib/win_layout.py | load_layout | def load_layout(vehname):
'''load window layout'''
global display_size
global window_list
global loaded_layout
global pending_load
global vehiclename
if display_size is None:
pending_load = True
return
vehiclename = vehname
fname = layout_filename(True)
if fname i... | python | def load_layout(vehname):
'''load window layout'''
global display_size
global window_list
global loaded_layout
global pending_load
global vehiclename
if display_size is None:
pending_load = True
return
vehiclename = vehname
fname = layout_filename(True)
if fname i... | [
"def",
"load_layout",
"(",
"vehname",
")",
":",
"global",
"display_size",
"global",
"window_list",
"global",
"loaded_layout",
"global",
"pending_load",
"global",
"vehiclename",
"if",
"display_size",
"is",
"None",
":",
"pending_load",
"=",
"True",
"return",
"vehiclen... | load window layout | [
"load",
"window",
"layout"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/win_layout.py#L117-L148 |
235,709 | ArduPilot/MAVProxy | MAVProxy/modules/lib/wxsettings_ui.py | TabbedDialog.on_apply | def on_apply(self, event):
'''called on apply'''
for label in self.setting_map.keys():
setting = self.setting_map[label]
ctrl = self.controls[label]
value = ctrl.GetValue()
if str(value) != str(setting.value):
oldvalue = setting.value
... | python | def on_apply(self, event):
'''called on apply'''
for label in self.setting_map.keys():
setting = self.setting_map[label]
ctrl = self.controls[label]
value = ctrl.GetValue()
if str(value) != str(setting.value):
oldvalue = setting.value
... | [
"def",
"on_apply",
"(",
"self",
",",
"event",
")",
":",
"for",
"label",
"in",
"self",
".",
"setting_map",
".",
"keys",
"(",
")",
":",
"setting",
"=",
"self",
".",
"setting_map",
"[",
"label",
"]",
"ctrl",
"=",
"self",
".",
"controls",
"[",
"label",
... | called on apply | [
"called",
"on",
"apply"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxsettings_ui.py#L42-L54 |
235,710 | ArduPilot/MAVProxy | MAVProxy/modules/lib/wxsettings_ui.py | TabbedDialog.on_save | def on_save(self, event):
'''called on save button'''
dlg = wx.FileDialog(None, self.settings.get_title(), '', "", '*.*',
wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
if dlg.ShowModal() == wx.ID_OK:
self.settings.save(dlg.GetPath()) | python | def on_save(self, event):
'''called on save button'''
dlg = wx.FileDialog(None, self.settings.get_title(), '', "", '*.*',
wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
if dlg.ShowModal() == wx.ID_OK:
self.settings.save(dlg.GetPath()) | [
"def",
"on_save",
"(",
"self",
",",
"event",
")",
":",
"dlg",
"=",
"wx",
".",
"FileDialog",
"(",
"None",
",",
"self",
".",
"settings",
".",
"get_title",
"(",
")",
",",
"''",
",",
"\"\"",
",",
"'*.*'",
",",
"wx",
".",
"FD_SAVE",
"|",
"wx",
".",
... | called on save button | [
"called",
"on",
"save",
"button"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxsettings_ui.py#L56-L61 |
235,711 | ArduPilot/MAVProxy | MAVProxy/modules/lib/wxsettings_ui.py | TabbedDialog.on_load | def on_load(self, event):
'''called on load button'''
dlg = wx.FileDialog(None, self.settings.get_title(), '', "", '*.*', wx.FD_OPEN)
if dlg.ShowModal() == wx.ID_OK:
self.settings.load(dlg.GetPath())
# update the controls with new values
for label in self.setting_map.... | python | def on_load(self, event):
'''called on load button'''
dlg = wx.FileDialog(None, self.settings.get_title(), '', "", '*.*', wx.FD_OPEN)
if dlg.ShowModal() == wx.ID_OK:
self.settings.load(dlg.GetPath())
# update the controls with new values
for label in self.setting_map.... | [
"def",
"on_load",
"(",
"self",
",",
"event",
")",
":",
"dlg",
"=",
"wx",
".",
"FileDialog",
"(",
"None",
",",
"self",
".",
"settings",
".",
"get_title",
"(",
")",
",",
"''",
",",
"\"\"",
",",
"'*.*'",
",",
"wx",
".",
"FD_OPEN",
")",
"if",
"dlg",
... | called on load button | [
"called",
"on",
"load",
"button"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxsettings_ui.py#L63-L76 |
235,712 | ArduPilot/MAVProxy | MAVProxy/modules/lib/wxsettings_ui.py | TabbedDialog.add_text | def add_text(self, setting, width=300, height=100, multiline=False):
'''add a text input line'''
tab = self.panel(setting.tab)
if multiline:
ctrl = wx.TextCtrl(tab, -1, "", size=(width,height), style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
else:
ctrl = wx.TextCtrl(ta... | python | def add_text(self, setting, width=300, height=100, multiline=False):
'''add a text input line'''
tab = self.panel(setting.tab)
if multiline:
ctrl = wx.TextCtrl(tab, -1, "", size=(width,height), style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
else:
ctrl = wx.TextCtrl(ta... | [
"def",
"add_text",
"(",
"self",
",",
"setting",
",",
"width",
"=",
"300",
",",
"height",
"=",
"100",
",",
"multiline",
"=",
"False",
")",
":",
"tab",
"=",
"self",
".",
"panel",
"(",
"setting",
".",
"tab",
")",
"if",
"multiline",
":",
"ctrl",
"=",
... | add a text input line | [
"add",
"a",
"text",
"input",
"line"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxsettings_ui.py#L109-L116 |
235,713 | ArduPilot/MAVProxy | MAVProxy/modules/lib/wxsettings_ui.py | TabbedDialog.add_choice | def add_choice(self, setting, choices):
'''add a choice input line'''
tab = self.panel(setting.tab)
default = setting.value
if default is None:
default = choices[0]
ctrl = wx.ComboBox(tab, -1, choices=choices,
value = str(default),
... | python | def add_choice(self, setting, choices):
'''add a choice input line'''
tab = self.panel(setting.tab)
default = setting.value
if default is None:
default = choices[0]
ctrl = wx.ComboBox(tab, -1, choices=choices,
value = str(default),
... | [
"def",
"add_choice",
"(",
"self",
",",
"setting",
",",
"choices",
")",
":",
"tab",
"=",
"self",
".",
"panel",
"(",
"setting",
".",
"tab",
")",
"default",
"=",
"setting",
".",
"value",
"if",
"default",
"is",
"None",
":",
"default",
"=",
"choices",
"["... | add a choice input line | [
"add",
"a",
"choice",
"input",
"line"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxsettings_ui.py#L118-L127 |
235,714 | ArduPilot/MAVProxy | MAVProxy/modules/lib/wxsettings_ui.py | TabbedDialog.add_intspin | def add_intspin(self, setting):
'''add a spin control'''
tab = self.panel(setting.tab)
default = setting.value
(minv, maxv) = setting.range
ctrl = wx.SpinCtrl(tab, -1,
initial = default,
min = minv,
... | python | def add_intspin(self, setting):
'''add a spin control'''
tab = self.panel(setting.tab)
default = setting.value
(minv, maxv) = setting.range
ctrl = wx.SpinCtrl(tab, -1,
initial = default,
min = minv,
... | [
"def",
"add_intspin",
"(",
"self",
",",
"setting",
")",
":",
"tab",
"=",
"self",
".",
"panel",
"(",
"setting",
".",
"tab",
")",
"default",
"=",
"setting",
".",
"value",
"(",
"minv",
",",
"maxv",
")",
"=",
"setting",
".",
"range",
"ctrl",
"=",
"wx",... | add a spin control | [
"add",
"a",
"spin",
"control"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxsettings_ui.py#L129-L138 |
235,715 | ArduPilot/MAVProxy | MAVProxy/modules/lib/wxsettings_ui.py | TabbedDialog.add_floatspin | def add_floatspin(self, setting):
'''add a floating point spin control'''
from wx.lib.agw.floatspin import FloatSpin
tab = self.panel(setting.tab)
default = setting.value
(minv, maxv) = setting.range
ctrl = FloatSpin(tab, -1,
value = default,
... | python | def add_floatspin(self, setting):
'''add a floating point spin control'''
from wx.lib.agw.floatspin import FloatSpin
tab = self.panel(setting.tab)
default = setting.value
(minv, maxv) = setting.range
ctrl = FloatSpin(tab, -1,
value = default,
... | [
"def",
"add_floatspin",
"(",
"self",
",",
"setting",
")",
":",
"from",
"wx",
".",
"lib",
".",
"agw",
".",
"floatspin",
"import",
"FloatSpin",
"tab",
"=",
"self",
".",
"panel",
"(",
"setting",
".",
"tab",
")",
"default",
"=",
"setting",
".",
"value",
... | add a floating point spin control | [
"add",
"a",
"floating",
"point",
"spin",
"control"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxsettings_ui.py#L140-L156 |
235,716 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_agg.py | RendererAgg.draw_path | def draw_path(self, gc, path, transform, rgbFace=None):
"""
Draw the path
"""
nmax = rcParams['agg.path.chunksize'] # here at least for testing
npts = path.vertices.shape[0]
if (nmax > 100 and npts > nmax and path.should_simplify and
rgbFace is None and gc.get... | python | def draw_path(self, gc, path, transform, rgbFace=None):
"""
Draw the path
"""
nmax = rcParams['agg.path.chunksize'] # here at least for testing
npts = path.vertices.shape[0]
if (nmax > 100 and npts > nmax and path.should_simplify and
rgbFace is None and gc.get... | [
"def",
"draw_path",
"(",
"self",
",",
"gc",
",",
"path",
",",
"transform",
",",
"rgbFace",
"=",
"None",
")",
":",
"nmax",
"=",
"rcParams",
"[",
"'agg.path.chunksize'",
"]",
"# here at least for testing",
"npts",
"=",
"path",
".",
"vertices",
".",
"shape",
... | Draw the path | [
"Draw",
"the",
"path"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_agg.py#L128-L151 |
235,717 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_agg.py | RendererAgg.draw_mathtext | def draw_mathtext(self, gc, x, y, s, prop, angle):
"""
Draw the math text using matplotlib.mathtext
"""
if __debug__: verbose.report('RendererAgg.draw_mathtext',
'debug-annoying')
ox, oy, width, height, descent, font_image, used_characters = \... | python | def draw_mathtext(self, gc, x, y, s, prop, angle):
"""
Draw the math text using matplotlib.mathtext
"""
if __debug__: verbose.report('RendererAgg.draw_mathtext',
'debug-annoying')
ox, oy, width, height, descent, font_image, used_characters = \... | [
"def",
"draw_mathtext",
"(",
"self",
",",
"gc",
",",
"x",
",",
"y",
",",
"s",
",",
"prop",
",",
"angle",
")",
":",
"if",
"__debug__",
":",
"verbose",
".",
"report",
"(",
"'RendererAgg.draw_mathtext'",
",",
"'debug-annoying'",
")",
"ox",
",",
"oy",
",",... | Draw the math text using matplotlib.mathtext | [
"Draw",
"the",
"math",
"text",
"using",
"matplotlib",
".",
"mathtext"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_agg.py#L153-L166 |
235,718 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_agg.py | RendererAgg.draw_text | def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
"""
Render the text
"""
if __debug__: verbose.report('RendererAgg.draw_text', 'debug-annoying')
if ismath:
return self.draw_mathtext(gc, x, y, s, prop, angle)
flags = get_hinting_flag()... | python | def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
"""
Render the text
"""
if __debug__: verbose.report('RendererAgg.draw_text', 'debug-annoying')
if ismath:
return self.draw_mathtext(gc, x, y, s, prop, angle)
flags = get_hinting_flag()... | [
"def",
"draw_text",
"(",
"self",
",",
"gc",
",",
"x",
",",
"y",
",",
"s",
",",
"prop",
",",
"angle",
",",
"ismath",
"=",
"False",
",",
"mtext",
"=",
"None",
")",
":",
"if",
"__debug__",
":",
"verbose",
".",
"report",
"(",
"'RendererAgg.draw_text'",
... | Render the text | [
"Render",
"the",
"text"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_agg.py#L168-L194 |
235,719 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_agg.py | RendererAgg._get_agg_font | def _get_agg_font(self, prop):
"""
Get the font for text instance t, cacheing for efficiency
"""
if __debug__: verbose.report('RendererAgg._get_agg_font',
'debug-annoying')
key = hash(prop)
font = RendererAgg._fontd.get(key)
... | python | def _get_agg_font(self, prop):
"""
Get the font for text instance t, cacheing for efficiency
"""
if __debug__: verbose.report('RendererAgg._get_agg_font',
'debug-annoying')
key = hash(prop)
font = RendererAgg._fontd.get(key)
... | [
"def",
"_get_agg_font",
"(",
"self",
",",
"prop",
")",
":",
"if",
"__debug__",
":",
"verbose",
".",
"report",
"(",
"'RendererAgg._get_agg_font'",
",",
"'debug-annoying'",
")",
"key",
"=",
"hash",
"(",
"prop",
")",
"font",
"=",
"RendererAgg",
".",
"_fontd",
... | Get the font for text instance t, cacheing for efficiency | [
"Get",
"the",
"font",
"for",
"text",
"instance",
"t",
"cacheing",
"for",
"efficiency"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_agg.py#L253-L277 |
235,720 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_agg.py | FigureCanvasAgg.draw | def draw(self):
"""
Draw the figure using the renderer
"""
if __debug__: verbose.report('FigureCanvasAgg.draw', 'debug-annoying')
self.renderer = self.get_renderer(cleared=True)
# acquire a lock on the shared font cache
RendererAgg.lock.acquire()
try:
... | python | def draw(self):
"""
Draw the figure using the renderer
"""
if __debug__: verbose.report('FigureCanvasAgg.draw', 'debug-annoying')
self.renderer = self.get_renderer(cleared=True)
# acquire a lock on the shared font cache
RendererAgg.lock.acquire()
try:
... | [
"def",
"draw",
"(",
"self",
")",
":",
"if",
"__debug__",
":",
"verbose",
".",
"report",
"(",
"'FigureCanvasAgg.draw'",
",",
"'debug-annoying'",
")",
"self",
".",
"renderer",
"=",
"self",
".",
"get_renderer",
"(",
"cleared",
"=",
"True",
")",
"# acquire a loc... | Draw the figure using the renderer | [
"Draw",
"the",
"figure",
"using",
"the",
"renderer"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_agg.py#L446-L459 |
235,721 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_console.py | ConsoleModule.vehicle_type_string | def vehicle_type_string(self, hb):
'''return vehicle type string from a heartbeat'''
if hb.type == mavutil.mavlink.MAV_TYPE_FIXED_WING:
return 'Plane'
if hb.type == mavutil.mavlink.MAV_TYPE_GROUND_ROVER:
return 'Rover'
if hb.type == mavutil.mavlink.MAV_TYPE_SURFAC... | python | def vehicle_type_string(self, hb):
'''return vehicle type string from a heartbeat'''
if hb.type == mavutil.mavlink.MAV_TYPE_FIXED_WING:
return 'Plane'
if hb.type == mavutil.mavlink.MAV_TYPE_GROUND_ROVER:
return 'Rover'
if hb.type == mavutil.mavlink.MAV_TYPE_SURFAC... | [
"def",
"vehicle_type_string",
"(",
"self",
",",
"hb",
")",
":",
"if",
"hb",
".",
"type",
"==",
"mavutil",
".",
"mavlink",
".",
"MAV_TYPE_FIXED_WING",
":",
"return",
"'Plane'",
"if",
"hb",
".",
"type",
"==",
"mavutil",
".",
"mavlink",
".",
"MAV_TYPE_GROUND_... | return vehicle type string from a heartbeat | [
"return",
"vehicle",
"type",
"string",
"from",
"a",
"heartbeat"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_console.py#L130-L151 |
235,722 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_console.py | ConsoleModule.update_vehicle_menu | def update_vehicle_menu(self):
'''update menu for new vehicles'''
self.vehicle_menu.items = []
for s in sorted(self.vehicle_list):
clist = self.module('param').get_component_id_list(s)
if len(clist) == 1:
name = 'SysID %u: %s' % (s, self.vehicle_name_by_sy... | python | def update_vehicle_menu(self):
'''update menu for new vehicles'''
self.vehicle_menu.items = []
for s in sorted(self.vehicle_list):
clist = self.module('param').get_component_id_list(s)
if len(clist) == 1:
name = 'SysID %u: %s' % (s, self.vehicle_name_by_sy... | [
"def",
"update_vehicle_menu",
"(",
"self",
")",
":",
"self",
".",
"vehicle_menu",
".",
"items",
"=",
"[",
"]",
"for",
"s",
"in",
"sorted",
"(",
"self",
".",
"vehicle_list",
")",
":",
"clist",
"=",
"self",
".",
"module",
"(",
"'param'",
")",
".",
"get... | update menu for new vehicles | [
"update",
"menu",
"for",
"new",
"vehicles"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_console.py#L165-L180 |
235,723 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_console.py | ConsoleModule.add_new_vehicle | def add_new_vehicle(self, hb):
'''add a new vehicle'''
if hb.type == mavutil.mavlink.MAV_TYPE_GCS:
return
sysid = hb.get_srcSystem()
self.vehicle_list.append(sysid)
self.vehicle_name_by_sysid[sysid] = self.vehicle_type_string(hb)
self.update_vehicle_menu() | python | def add_new_vehicle(self, hb):
'''add a new vehicle'''
if hb.type == mavutil.mavlink.MAV_TYPE_GCS:
return
sysid = hb.get_srcSystem()
self.vehicle_list.append(sysid)
self.vehicle_name_by_sysid[sysid] = self.vehicle_type_string(hb)
self.update_vehicle_menu() | [
"def",
"add_new_vehicle",
"(",
"self",
",",
"hb",
")",
":",
"if",
"hb",
".",
"type",
"==",
"mavutil",
".",
"mavlink",
".",
"MAV_TYPE_GCS",
":",
"return",
"sysid",
"=",
"hb",
".",
"get_srcSystem",
"(",
")",
"self",
".",
"vehicle_list",
".",
"append",
"(... | add a new vehicle | [
"add",
"a",
"new",
"vehicle"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_console.py#L182-L189 |
235,724 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_speech.py | SpeechModule.say_espeak | def say_espeak(self, text, priority='important'):
'''speak some text using espeak'''
from espeak import espeak
if self.settings.speech_voice:
espeak.set_voice(self.settings.speech_voice)
espeak.synth(text) | python | def say_espeak(self, text, priority='important'):
'''speak some text using espeak'''
from espeak import espeak
if self.settings.speech_voice:
espeak.set_voice(self.settings.speech_voice)
espeak.synth(text) | [
"def",
"say_espeak",
"(",
"self",
",",
"text",
",",
"priority",
"=",
"'important'",
")",
":",
"from",
"espeak",
"import",
"espeak",
"if",
"self",
".",
"settings",
".",
"speech_voice",
":",
"espeak",
".",
"set_voice",
"(",
"self",
".",
"settings",
".",
"s... | speak some text using espeak | [
"speak",
"some",
"text",
"using",
"espeak"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_speech.py#L71-L76 |
235,725 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_cmdlong.py | CmdlongModule.cmd_long | def cmd_long(self, args):
'''execute supplied command long'''
if len(args) < 1:
print("Usage: long <command> [arg1] [arg2]...")
return
command = None
if args[0].isdigit():
command = int(args[0])
else:
try:
command = ... | python | def cmd_long(self, args):
'''execute supplied command long'''
if len(args) < 1:
print("Usage: long <command> [arg1] [arg2]...")
return
command = None
if args[0].isdigit():
command = int(args[0])
else:
try:
command = ... | [
"def",
"cmd_long",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"print",
"(",
"\"Usage: long <command> [arg1] [arg2]...\"",
")",
"return",
"command",
"=",
"None",
"if",
"args",
"[",
"0",
"]",
".",
"isdigit",
"(",
")... | execute supplied command long | [
"execute",
"supplied",
"command",
"long"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_cmdlong.py#L316-L344 |
235,726 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_cmdlong.py | CmdlongModule.cmd_command_int | def cmd_command_int(self, args):
'''execute supplied command_int'''
if len(args) != 11:
print("num args{0}".format(len(args)))
print("Usage: command_int frame command current autocontinue param1 param2 param3 param4 x y z")
print("e.g. command_int GLOBAL_RELATIVE_ALT ... | python | def cmd_command_int(self, args):
'''execute supplied command_int'''
if len(args) != 11:
print("num args{0}".format(len(args)))
print("Usage: command_int frame command current autocontinue param1 param2 param3 param4 x y z")
print("e.g. command_int GLOBAL_RELATIVE_ALT ... | [
"def",
"cmd_command_int",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"11",
":",
"print",
"(",
"\"num args{0}\"",
".",
"format",
"(",
"len",
"(",
"args",
")",
")",
")",
"print",
"(",
"\"Usage: command_int frame command current ... | execute supplied command_int | [
"execute",
"supplied",
"command_int"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_cmdlong.py#L346-L407 |
235,727 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_sensors.py | SensorsModule.cmd_sensors | def cmd_sensors(self, args):
'''show key sensors'''
gps_heading = self.status.msgs['GPS_RAW_INT'].cog * 0.01
self.console.writeln("heading: %u/%u alt: %u/%u r/p: %u/%u speed: %u/%u thr: %u" % (
self.status.msgs['VFR_HUD'].heading,
gps_heading,
self.status... | python | def cmd_sensors(self, args):
'''show key sensors'''
gps_heading = self.status.msgs['GPS_RAW_INT'].cog * 0.01
self.console.writeln("heading: %u/%u alt: %u/%u r/p: %u/%u speed: %u/%u thr: %u" % (
self.status.msgs['VFR_HUD'].heading,
gps_heading,
self.status... | [
"def",
"cmd_sensors",
"(",
"self",
",",
"args",
")",
":",
"gps_heading",
"=",
"self",
".",
"status",
".",
"msgs",
"[",
"'GPS_RAW_INT'",
"]",
".",
"cog",
"*",
"0.01",
"self",
".",
"console",
".",
"writeln",
"(",
"\"heading: %u/%u alt: %u/%u r/p: %u/%u speed:... | show key sensors | [
"show",
"key",
"sensors"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_sensors.py#L50-L63 |
235,728 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_misseditor/me_defines.py | cmd_reverse_lookup | def cmd_reverse_lookup(command_name):
'''returns 0 if key not found'''
for key, value in miss_cmds.items():
if (value.upper() == command_name.upper()):
return key
return 0 | python | def cmd_reverse_lookup(command_name):
'''returns 0 if key not found'''
for key, value in miss_cmds.items():
if (value.upper() == command_name.upper()):
return key
return 0 | [
"def",
"cmd_reverse_lookup",
"(",
"command_name",
")",
":",
"for",
"key",
",",
"value",
"in",
"miss_cmds",
".",
"items",
"(",
")",
":",
"if",
"(",
"value",
".",
"upper",
"(",
")",
"==",
"command_name",
".",
"upper",
"(",
")",
")",
":",
"return",
"key... | returns 0 if key not found | [
"returns",
"0",
"if",
"key",
"not",
"found"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misseditor/me_defines.py#L17-L22 |
235,729 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_misseditor/me_defines.py | make_column_label | def make_column_label(command_name, description, default):
'''try to work out a reasonable column name from parameter description'''
for (pattern, label) in description_map:
if fnmatch.fnmatch(description, pattern):
return label
return default | python | def make_column_label(command_name, description, default):
'''try to work out a reasonable column name from parameter description'''
for (pattern, label) in description_map:
if fnmatch.fnmatch(description, pattern):
return label
return default | [
"def",
"make_column_label",
"(",
"command_name",
",",
"description",
",",
"default",
")",
":",
"for",
"(",
"pattern",
",",
"label",
")",
"in",
"description_map",
":",
"if",
"fnmatch",
".",
"fnmatch",
"(",
"description",
",",
"pattern",
")",
":",
"return",
... | try to work out a reasonable column name from parameter description | [
"try",
"to",
"work",
"out",
"a",
"reasonable",
"column",
"name",
"from",
"parameter",
"description"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misseditor/me_defines.py#L51-L56 |
235,730 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_misseditor/me_defines.py | get_column_labels | def get_column_labels(command_name):
'''return dictionary of column labels if available'''
cmd = cmd_reverse_lookup(command_name)
if cmd == 0:
return {}
labels = {}
enum = mavutil.mavlink.enums['MAV_CMD'][cmd]
for col in enum.param.keys():
labels[col] = make_column_label(command_... | python | def get_column_labels(command_name):
'''return dictionary of column labels if available'''
cmd = cmd_reverse_lookup(command_name)
if cmd == 0:
return {}
labels = {}
enum = mavutil.mavlink.enums['MAV_CMD'][cmd]
for col in enum.param.keys():
labels[col] = make_column_label(command_... | [
"def",
"get_column_labels",
"(",
"command_name",
")",
":",
"cmd",
"=",
"cmd_reverse_lookup",
"(",
"command_name",
")",
"if",
"cmd",
"==",
"0",
":",
"return",
"{",
"}",
"labels",
"=",
"{",
"}",
"enum",
"=",
"mavutil",
".",
"mavlink",
".",
"enums",
"[",
... | return dictionary of column labels if available | [
"return",
"dictionary",
"of",
"column",
"labels",
"if",
"available"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_misseditor/me_defines.py#L59-L68 |
235,731 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_tracker.py | TrackerModule.find_connection | def find_connection(self):
'''find an antenna tracker connection if possible'''
if self.connection is not None:
return self.connection
for m in self.mpstate.mav_master:
if 'HEARTBEAT' in m.messages:
if m.messages['HEARTBEAT'].type == mavutil.mavlink.MAV_TY... | python | def find_connection(self):
'''find an antenna tracker connection if possible'''
if self.connection is not None:
return self.connection
for m in self.mpstate.mav_master:
if 'HEARTBEAT' in m.messages:
if m.messages['HEARTBEAT'].type == mavutil.mavlink.MAV_TY... | [
"def",
"find_connection",
"(",
"self",
")",
":",
"if",
"self",
".",
"connection",
"is",
"not",
"None",
":",
"return",
"self",
".",
"connection",
"for",
"m",
"in",
"self",
".",
"mpstate",
".",
"mav_master",
":",
"if",
"'HEARTBEAT'",
"in",
"m",
".",
"mes... | find an antenna tracker connection if possible | [
"find",
"an",
"antenna",
"tracker",
"connection",
"if",
"possible"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_tracker.py#L52-L60 |
235,732 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_tracker.py | TrackerModule.cmd_tracker | def cmd_tracker(self, args):
'''tracker command parser'''
usage = "usage: tracker <start|set|arm|disarm|level|param|mode|position> [options]"
if len(args) == 0:
print(usage)
return
if args[0] == "start":
self.cmd_tracker_start()
elif args[0] ==... | python | def cmd_tracker(self, args):
'''tracker command parser'''
usage = "usage: tracker <start|set|arm|disarm|level|param|mode|position> [options]"
if len(args) == 0:
print(usage)
return
if args[0] == "start":
self.cmd_tracker_start()
elif args[0] ==... | [
"def",
"cmd_tracker",
"(",
"self",
",",
"args",
")",
":",
"usage",
"=",
"\"usage: tracker <start|set|arm|disarm|level|param|mode|position> [options]\"",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"usage",
")",
"return",
"if",
"args",
"[",
"0",
... | tracker command parser | [
"tracker",
"command",
"parser"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_tracker.py#L62-L87 |
235,733 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_tracker.py | TrackerModule.cmd_tracker_position | def cmd_tracker_position(self, args):
'''tracker manual positioning commands'''
connection = self.find_connection()
if not connection:
print("No antenna tracker found")
return
positions = [0, 0, 0, 0, 0] # x, y, z, r, buttons. only position[0] (yaw) and position[1... | python | def cmd_tracker_position(self, args):
'''tracker manual positioning commands'''
connection = self.find_connection()
if not connection:
print("No antenna tracker found")
return
positions = [0, 0, 0, 0, 0] # x, y, z, r, buttons. only position[0] (yaw) and position[1... | [
"def",
"cmd_tracker_position",
"(",
"self",
",",
"args",
")",
":",
"connection",
"=",
"self",
".",
"find_connection",
"(",
")",
"if",
"not",
"connection",
":",
"print",
"(",
"\"No antenna tracker found\"",
")",
"return",
"positions",
"=",
"[",
"0",
",",
"0",... | tracker manual positioning commands | [
"tracker",
"manual",
"positioning",
"commands"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_tracker.py#L89-L102 |
235,734 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_tracker.py | TrackerModule.cmd_tracker_calpress | def cmd_tracker_calpress(self, args):
'''calibrate barometer on tracker'''
connection = self.find_connection()
if not connection:
print("No antenna tracker found")
return
connection.calibrate_pressure() | python | def cmd_tracker_calpress(self, args):
'''calibrate barometer on tracker'''
connection = self.find_connection()
if not connection:
print("No antenna tracker found")
return
connection.calibrate_pressure() | [
"def",
"cmd_tracker_calpress",
"(",
"self",
",",
"args",
")",
":",
"connection",
"=",
"self",
".",
"find_connection",
"(",
")",
"if",
"not",
"connection",
":",
"print",
"(",
"\"No antenna tracker found\"",
")",
"return",
"connection",
".",
"calibrate_pressure",
... | calibrate barometer on tracker | [
"calibrate",
"barometer",
"on",
"tracker"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_tracker.py#L104-L110 |
235,735 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_tracker.py | TrackerModule.mavlink_packet | def mavlink_packet(self, m):
'''handle an incoming mavlink packet from the master vehicle. Relay it to the tracker
if it is a GLOBAL_POSITION_INT'''
if m.get_type() in ['GLOBAL_POSITION_INT', 'SCALED_PRESSURE']:
connection = self.find_connection()
if not connection:
... | python | def mavlink_packet(self, m):
'''handle an incoming mavlink packet from the master vehicle. Relay it to the tracker
if it is a GLOBAL_POSITION_INT'''
if m.get_type() in ['GLOBAL_POSITION_INT', 'SCALED_PRESSURE']:
connection = self.find_connection()
if not connection:
... | [
"def",
"mavlink_packet",
"(",
"self",
",",
"m",
")",
":",
"if",
"m",
".",
"get_type",
"(",
")",
"in",
"[",
"'GLOBAL_POSITION_INT'",
",",
"'SCALED_PRESSURE'",
"]",
":",
"connection",
"=",
"self",
".",
"find_connection",
"(",
")",
"if",
"not",
"connection",
... | handle an incoming mavlink packet from the master vehicle. Relay it to the tracker
if it is a GLOBAL_POSITION_INT | [
"handle",
"an",
"incoming",
"mavlink",
"packet",
"from",
"the",
"master",
"vehicle",
".",
"Relay",
"it",
"to",
"the",
"tracker",
"if",
"it",
"is",
"a",
"GLOBAL_POSITION_INT"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_tracker.py#L131-L139 |
235,736 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_graph.py | GraphModule.cmd_legend | def cmd_legend(self, args):
'''setup legend for graphs'''
if len(args) == 0:
for leg in self.legend.keys():
print("%s -> %s" % (leg, self.legend[leg]))
elif len(args) == 1:
leg = args[0]
if leg in self.legend:
print("Removing le... | python | def cmd_legend(self, args):
'''setup legend for graphs'''
if len(args) == 0:
for leg in self.legend.keys():
print("%s -> %s" % (leg, self.legend[leg]))
elif len(args) == 1:
leg = args[0]
if leg in self.legend:
print("Removing le... | [
"def",
"cmd_legend",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"for",
"leg",
"in",
"self",
".",
"legend",
".",
"keys",
"(",
")",
":",
"print",
"(",
"\"%s -> %s\"",
"%",
"(",
"leg",
",",
"self",
".",
"leg... | setup legend for graphs | [
"setup",
"legend",
"for",
"graphs"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_graph.py#L55-L69 |
235,737 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_gimbal.py | GimbalModule.cmd_gimbal_mode | def cmd_gimbal_mode(self, args):
'''control gimbal mode'''
if len(args) != 1:
print("usage: gimbal mode <GPS|MAVLink>")
return
if args[0].upper() == 'GPS':
mode = mavutil.mavlink.MAV_MOUNT_MODE_GPS_POINT
elif args[0].upper() == 'MAVLINK':
m... | python | def cmd_gimbal_mode(self, args):
'''control gimbal mode'''
if len(args) != 1:
print("usage: gimbal mode <GPS|MAVLink>")
return
if args[0].upper() == 'GPS':
mode = mavutil.mavlink.MAV_MOUNT_MODE_GPS_POINT
elif args[0].upper() == 'MAVLINK':
m... | [
"def",
"cmd_gimbal_mode",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
":",
"print",
"(",
"\"usage: gimbal mode <GPS|MAVLink>\"",
")",
"return",
"if",
"args",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"==",
"'GPS'",
":",
... | control gimbal mode | [
"control",
"gimbal",
"mode"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_gimbal.py#L58-L74 |
235,738 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_gimbal.py | GimbalModule.cmd_gimbal_roi | def cmd_gimbal_roi(self, args):
'''control roi position'''
latlon = None
try:
latlon = self.module('map').click_position
except Exception:
print("No map available")
return
if latlon is None:
print("No map click position available")
... | python | def cmd_gimbal_roi(self, args):
'''control roi position'''
latlon = None
try:
latlon = self.module('map').click_position
except Exception:
print("No map available")
return
if latlon is None:
print("No map click position available")
... | [
"def",
"cmd_gimbal_roi",
"(",
"self",
",",
"args",
")",
":",
"latlon",
"=",
"None",
"try",
":",
"latlon",
"=",
"self",
".",
"module",
"(",
"'map'",
")",
".",
"click_position",
"except",
"Exception",
":",
"print",
"(",
"\"No map available\"",
")",
"return",... | control roi position | [
"control",
"roi",
"position"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_gimbal.py#L76-L92 |
235,739 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_gimbal.py | GimbalModule.cmd_gimbal_roi_vel | def cmd_gimbal_roi_vel(self, args):
'''control roi position and velocity'''
if len(args) != 0 and len(args) != 3 and len(args) != 6:
print("usage: gimbal roivel [VEL_NORTH VEL_EAST VEL_DOWN] [ACC_NORTH ACC_EASY ACC_DOWN]")
return
latlon = None
vel = [0,0,0]
... | python | def cmd_gimbal_roi_vel(self, args):
'''control roi position and velocity'''
if len(args) != 0 and len(args) != 3 and len(args) != 6:
print("usage: gimbal roivel [VEL_NORTH VEL_EAST VEL_DOWN] [ACC_NORTH ACC_EASY ACC_DOWN]")
return
latlon = None
vel = [0,0,0]
... | [
"def",
"cmd_gimbal_roi_vel",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"0",
"and",
"len",
"(",
"args",
")",
"!=",
"3",
"and",
"len",
"(",
"args",
")",
"!=",
"6",
":",
"print",
"(",
"\"usage: gimbal roivel [VEL_NORTH VEL_E... | control roi position and velocity | [
"control",
"roi",
"position",
"and",
"velocity"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_gimbal.py#L94-L129 |
235,740 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_gimbal.py | GimbalModule.cmd_gimbal_rate | def cmd_gimbal_rate(self, args):
'''control gimbal rate'''
if len(args) != 3:
print("usage: gimbal rate ROLL PITCH YAW")
return
(roll, pitch, yaw) = (float(args[0]), float(args[1]), float(args[2]))
self.master.mav.gimbal_control_send(self.target_system,
... | python | def cmd_gimbal_rate(self, args):
'''control gimbal rate'''
if len(args) != 3:
print("usage: gimbal rate ROLL PITCH YAW")
return
(roll, pitch, yaw) = (float(args[0]), float(args[1]), float(args[2]))
self.master.mav.gimbal_control_send(self.target_system,
... | [
"def",
"cmd_gimbal_rate",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"3",
":",
"print",
"(",
"\"usage: gimbal rate ROLL PITCH YAW\"",
")",
"return",
"(",
"roll",
",",
"pitch",
",",
"yaw",
")",
"=",
"(",
"float",
"(",
"args... | control gimbal rate | [
"control",
"gimbal",
"rate"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_gimbal.py#L131-L141 |
235,741 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_gimbal.py | GimbalModule.cmd_gimbal_point | def cmd_gimbal_point(self, args):
'''control gimbal pointing'''
if len(args) != 3:
print("usage: gimbal point ROLL PITCH YAW")
return
(roll, pitch, yaw) = (float(args[0]), float(args[1]), float(args[2]))
self.master.mav.mount_control_send(self.target_system,
... | python | def cmd_gimbal_point(self, args):
'''control gimbal pointing'''
if len(args) != 3:
print("usage: gimbal point ROLL PITCH YAW")
return
(roll, pitch, yaw) = (float(args[0]), float(args[1]), float(args[2]))
self.master.mav.mount_control_send(self.target_system,
... | [
"def",
"cmd_gimbal_point",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"3",
":",
"print",
"(",
"\"usage: gimbal point ROLL PITCH YAW\"",
")",
"return",
"(",
"roll",
",",
"pitch",
",",
"yaw",
")",
"=",
"(",
"float",
"(",
"ar... | control gimbal pointing | [
"control",
"gimbal",
"pointing"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_gimbal.py#L143-L154 |
235,742 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_gimbal.py | GimbalModule.cmd_gimbal_status | def cmd_gimbal_status(self, args):
'''show gimbal status'''
master = self.master
if 'GIMBAL_REPORT' in master.messages:
print(master.messages['GIMBAL_REPORT'])
else:
print("No GIMBAL_REPORT messages") | python | def cmd_gimbal_status(self, args):
'''show gimbal status'''
master = self.master
if 'GIMBAL_REPORT' in master.messages:
print(master.messages['GIMBAL_REPORT'])
else:
print("No GIMBAL_REPORT messages") | [
"def",
"cmd_gimbal_status",
"(",
"self",
",",
"args",
")",
":",
"master",
"=",
"self",
".",
"master",
"if",
"'GIMBAL_REPORT'",
"in",
"master",
".",
"messages",
":",
"print",
"(",
"master",
".",
"messages",
"[",
"'GIMBAL_REPORT'",
"]",
")",
"else",
":",
"... | show gimbal status | [
"show",
"gimbal",
"status"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_gimbal.py#L156-L162 |
235,743 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_map/mp_slipmap_util.py | SlipFlightModeLegend.draw | def draw(self, img, pixmapper, bounds):
'''draw legend on the image'''
if self._img is None:
self._img = self.draw_legend()
w = self._img.shape[1]
h = self._img.shape[0]
px = 5
py = 5
img[py:py+h,px:px+w] = self._img | python | def draw(self, img, pixmapper, bounds):
'''draw legend on the image'''
if self._img is None:
self._img = self.draw_legend()
w = self._img.shape[1]
h = self._img.shape[0]
px = 5
py = 5
img[py:py+h,px:px+w] = self._img | [
"def",
"draw",
"(",
"self",
",",
"img",
",",
"pixmapper",
",",
"bounds",
")",
":",
"if",
"self",
".",
"_img",
"is",
"None",
":",
"self",
".",
"_img",
"=",
"self",
".",
"draw_legend",
"(",
")",
"w",
"=",
"self",
".",
"_img",
".",
"shape",
"[",
"... | draw legend on the image | [
"draw",
"legend",
"on",
"the",
"image"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/mp_slipmap_util.py#L349-L358 |
235,744 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_map/mp_slipmap_util.py | SlipThumbnail.draw | def draw(self, img, pixmapper, bounds):
'''draw the thumbnail on the image'''
if self.hidden:
return
thumb = self.img()
(px,py) = pixmapper(self.latlon)
# find top left
(w, h) = image_shape(thumb)
px -= w//2
py -= h//2
(px, py, sx, sy... | python | def draw(self, img, pixmapper, bounds):
'''draw the thumbnail on the image'''
if self.hidden:
return
thumb = self.img()
(px,py) = pixmapper(self.latlon)
# find top left
(w, h) = image_shape(thumb)
px -= w//2
py -= h//2
(px, py, sx, sy... | [
"def",
"draw",
"(",
"self",
",",
"img",
",",
"pixmapper",
",",
"bounds",
")",
":",
"if",
"self",
".",
"hidden",
":",
"return",
"thumb",
"=",
"self",
".",
"img",
"(",
")",
"(",
"px",
",",
"py",
")",
"=",
"pixmapper",
"(",
"self",
".",
"latlon",
... | draw the thumbnail on the image | [
"draw",
"the",
"thumbnail",
"on",
"the",
"image"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/mp_slipmap_util.py#L393-L412 |
235,745 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_terrain.py | TerrainModule.cmd_terrain | def cmd_terrain(self, args):
'''terrain command parser'''
usage = "usage: terrain <set|status|check>"
if len(args) == 0:
print(usage)
return
if args[0] == "status":
print("blocks_sent: %u requests_received: %u" % (
self.blocks_sent,
... | python | def cmd_terrain(self, args):
'''terrain command parser'''
usage = "usage: terrain <set|status|check>"
if len(args) == 0:
print(usage)
return
if args[0] == "status":
print("blocks_sent: %u requests_received: %u" % (
self.blocks_sent,
... | [
"def",
"cmd_terrain",
"(",
"self",
",",
"args",
")",
":",
"usage",
"=",
"\"usage: terrain <set|status|check>\"",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"usage",
")",
"return",
"if",
"args",
"[",
"0",
"]",
"==",
"\"status\"",
":",
... | terrain command parser | [
"terrain",
"command",
"parser"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_terrain.py#L32-L47 |
235,746 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_terrain.py | TerrainModule.cmd_terrain_check | def cmd_terrain_check(self, args):
'''check a piece of terrain data'''
if len(args) >= 2:
latlon = (float(args[0]), float(args[1]))
else:
try:
latlon = self.module('map').click_position
except Exception:
print("No map available"... | python | def cmd_terrain_check(self, args):
'''check a piece of terrain data'''
if len(args) >= 2:
latlon = (float(args[0]), float(args[1]))
else:
try:
latlon = self.module('map').click_position
except Exception:
print("No map available"... | [
"def",
"cmd_terrain_check",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
">=",
"2",
":",
"latlon",
"=",
"(",
"float",
"(",
"args",
"[",
"0",
"]",
")",
",",
"float",
"(",
"args",
"[",
"1",
"]",
")",
")",
"else",
":",
"try... | check a piece of terrain data | [
"check",
"a",
"piece",
"of",
"terrain",
"data"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_terrain.py#L49-L64 |
235,747 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_terrain.py | TerrainModule.idle_task | def idle_task(self):
'''called when idle'''
if self.current_request is None:
return
if time.time() - self.last_send_time < 0.2:
# limit to 5 per second
return
self.send_terrain_data() | python | def idle_task(self):
'''called when idle'''
if self.current_request is None:
return
if time.time() - self.last_send_time < 0.2:
# limit to 5 per second
return
self.send_terrain_data() | [
"def",
"idle_task",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_request",
"is",
"None",
":",
"return",
"if",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"last_send_time",
"<",
"0.2",
":",
"# limit to 5 per second",
"return",
"self",
".",
"sen... | called when idle | [
"called",
"when",
"idle"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_terrain.py#L134-L141 |
235,748 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_mode.py | ModeModule.unknown_command | def unknown_command(self, args):
'''handle mode switch by mode name as command'''
mode_mapping = self.master.mode_mapping()
mode = args[0].upper()
if mode in mode_mapping:
self.master.set_mode(mode_mapping[mode])
return True
return False | python | def unknown_command(self, args):
'''handle mode switch by mode name as command'''
mode_mapping = self.master.mode_mapping()
mode = args[0].upper()
if mode in mode_mapping:
self.master.set_mode(mode_mapping[mode])
return True
return False | [
"def",
"unknown_command",
"(",
"self",
",",
"args",
")",
":",
"mode_mapping",
"=",
"self",
".",
"master",
".",
"mode_mapping",
"(",
")",
"mode",
"=",
"args",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"if",
"mode",
"in",
"mode_mapping",
":",
"self",
".",... | handle mode switch by mode name as command | [
"handle",
"mode",
"switch",
"by",
"mode",
"name",
"as",
"command"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_mode.py#L41-L48 |
235,749 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_mode.py | ModeModule.cmd_guided | def cmd_guided(self, args):
'''set GUIDED target'''
if len(args) != 1 and len(args) != 3:
print("Usage: guided ALTITUDE | guided LAT LON ALTITUDE")
return
if len(args) == 3:
latitude = float(args[0])
longitude = float(args[1])
altitude... | python | def cmd_guided(self, args):
'''set GUIDED target'''
if len(args) != 1 and len(args) != 3:
print("Usage: guided ALTITUDE | guided LAT LON ALTITUDE")
return
if len(args) == 3:
latitude = float(args[0])
longitude = float(args[1])
altitude... | [
"def",
"cmd_guided",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
"and",
"len",
"(",
"args",
")",
"!=",
"3",
":",
"print",
"(",
"\"Usage: guided ALTITUDE | guided LAT LON ALTITUDE\"",
")",
"return",
"if",
"len",
"(",
"arg... | set GUIDED target | [
"set",
"GUIDED",
"target"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_mode.py#L50-L79 |
235,750 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_HIL.py | HILModule.check_sim_in | def check_sim_in(self):
'''check for FDM packets from runsim'''
try:
pkt = self.sim_in.recv(17*8 + 4)
except socket.error as e:
if not e.errno in [ errno.EAGAIN, errno.EWOULDBLOCK ]:
raise
return
if len(pkt) != 17*8 + 4:
# w... | python | def check_sim_in(self):
'''check for FDM packets from runsim'''
try:
pkt = self.sim_in.recv(17*8 + 4)
except socket.error as e:
if not e.errno in [ errno.EAGAIN, errno.EWOULDBLOCK ]:
raise
return
if len(pkt) != 17*8 + 4:
# w... | [
"def",
"check_sim_in",
"(",
"self",
")",
":",
"try",
":",
"pkt",
"=",
"self",
".",
"sim_in",
".",
"recv",
"(",
"17",
"*",
"8",
"+",
"4",
")",
"except",
"socket",
".",
"error",
"as",
"e",
":",
"if",
"not",
"e",
".",
"errno",
"in",
"[",
"errno",
... | check for FDM packets from runsim | [
"check",
"for",
"FDM",
"packets",
"from",
"runsim"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_HIL.py#L53-L90 |
235,751 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_HIL.py | HILModule.check_sim_out | def check_sim_out(self):
'''check if we should send new servos to flightgear'''
now = time.time()
if now - self.last_sim_send_time < 0.02 or self.rc_channels_scaled is None:
return
self.last_sim_send_time = now
servos = []
for ch in range(1,9):
se... | python | def check_sim_out(self):
'''check if we should send new servos to flightgear'''
now = time.time()
if now - self.last_sim_send_time < 0.02 or self.rc_channels_scaled is None:
return
self.last_sim_send_time = now
servos = []
for ch in range(1,9):
se... | [
"def",
"check_sim_out",
"(",
"self",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"now",
"-",
"self",
".",
"last_sim_send_time",
"<",
"0.02",
"or",
"self",
".",
"rc_channels_scaled",
"is",
"None",
":",
"return",
"self",
".",
"last_sim_send_... | check if we should send new servos to flightgear | [
"check",
"if",
"we",
"should",
"send",
"new",
"servos",
"to",
"flightgear"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_HIL.py#L95-L112 |
235,752 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_HIL.py | HILModule.check_apm_out | def check_apm_out(self):
'''check if we should send new data to the APM'''
now = time.time()
if now - self.last_apm_send_time < 0.02:
return
self.last_apm_send_time = now
if self.hil_state_msg is not None:
self.master.mav.send(self.hil_state_msg) | python | def check_apm_out(self):
'''check if we should send new data to the APM'''
now = time.time()
if now - self.last_apm_send_time < 0.02:
return
self.last_apm_send_time = now
if self.hil_state_msg is not None:
self.master.mav.send(self.hil_state_msg) | [
"def",
"check_apm_out",
"(",
"self",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"now",
"-",
"self",
".",
"last_apm_send_time",
"<",
"0.02",
":",
"return",
"self",
".",
"last_apm_send_time",
"=",
"now",
"if",
"self",
".",
"hil_state_msg",
... | check if we should send new data to the APM | [
"check",
"if",
"we",
"should",
"send",
"new",
"data",
"to",
"the",
"APM"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_HIL.py#L115-L122 |
235,753 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_HIL.py | HILModule.convert_body_frame | def convert_body_frame(self, phi, theta, phiDot, thetaDot, psiDot):
'''convert a set of roll rates from earth frame to body frame'''
p = phiDot - psiDot*math.sin(theta)
q = math.cos(phi)*thetaDot + math.sin(phi)*psiDot*math.cos(theta)
r = math.cos(phi)*psiDot*math.cos(theta) - math.sin(p... | python | def convert_body_frame(self, phi, theta, phiDot, thetaDot, psiDot):
'''convert a set of roll rates from earth frame to body frame'''
p = phiDot - psiDot*math.sin(theta)
q = math.cos(phi)*thetaDot + math.sin(phi)*psiDot*math.cos(theta)
r = math.cos(phi)*psiDot*math.cos(theta) - math.sin(p... | [
"def",
"convert_body_frame",
"(",
"self",
",",
"phi",
",",
"theta",
",",
"phiDot",
",",
"thetaDot",
",",
"psiDot",
")",
":",
"p",
"=",
"phiDot",
"-",
"psiDot",
"*",
"math",
".",
"sin",
"(",
"theta",
")",
"q",
"=",
"math",
".",
"cos",
"(",
"phi",
... | convert a set of roll rates from earth frame to body frame | [
"convert",
"a",
"set",
"of",
"roll",
"rates",
"from",
"earth",
"frame",
"to",
"body",
"frame"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_HIL.py#L124-L129 |
235,754 | ArduPilot/MAVProxy | MAVProxy/modules/lib/mp_settings.py | MPSettings.append | def append(self, v):
'''add a new setting'''
if isinstance(v, MPSetting):
setting = v
else:
(name,type,default) = v
label = name
tab = None
if len(v) > 3:
label = v[3]
if len(v) > 4:
tab = v[4... | python | def append(self, v):
'''add a new setting'''
if isinstance(v, MPSetting):
setting = v
else:
(name,type,default) = v
label = name
tab = None
if len(v) > 3:
label = v[3]
if len(v) > 4:
tab = v[4... | [
"def",
"append",
"(",
"self",
",",
"v",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"MPSetting",
")",
":",
"setting",
"=",
"v",
"else",
":",
"(",
"name",
",",
"type",
",",
"default",
")",
"=",
"v",
"label",
"=",
"name",
"tab",
"=",
"None",
"if... | add a new setting | [
"add",
"a",
"new",
"setting"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_settings.py#L80-L101 |
235,755 | ArduPilot/MAVProxy | MAVProxy/modules/lib/mp_settings.py | MPSettings.get | def get(self, name):
'''get a setting'''
if not name in self._vars:
raise AttributeError
setting = self._vars[name]
return setting.value | python | def get(self, name):
'''get a setting'''
if not name in self._vars:
raise AttributeError
setting = self._vars[name]
return setting.value | [
"def",
"get",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"name",
"in",
"self",
".",
"_vars",
":",
"raise",
"AttributeError",
"setting",
"=",
"self",
".",
"_vars",
"[",
"name",
"]",
"return",
"setting",
".",
"value"
] | get a setting | [
"get",
"a",
"setting"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_settings.py#L134-L139 |
235,756 | ArduPilot/MAVProxy | MAVProxy/modules/lib/mp_settings.py | MPSettings.command | def command(self, args):
'''control options from cmdline'''
if len(args) == 0:
self.show_all()
return
if getattr(self, args[0], [None]) == [None]:
print("Unknown setting '%s'" % args[0])
return
if len(args) == 1:
self.show(args[... | python | def command(self, args):
'''control options from cmdline'''
if len(args) == 0:
self.show_all()
return
if getattr(self, args[0], [None]) == [None]:
print("Unknown setting '%s'" % args[0])
return
if len(args) == 1:
self.show(args[... | [
"def",
"command",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"self",
".",
"show_all",
"(",
")",
"return",
"if",
"getattr",
"(",
"self",
",",
"args",
"[",
"0",
"]",
",",
"[",
"None",
"]",
")",
"==",
"[",... | control options from cmdline | [
"control",
"options",
"from",
"cmdline"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_settings.py#L158-L169 |
235,757 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_arm.py | ArmModule.all_checks_enabled | def all_checks_enabled(self):
''' returns true if the UAV is skipping any arming checks'''
arming_mask = int(self.get_mav_param("ARMING_CHECK",0))
if arming_mask == 1:
return True
for bit in arming_masks.values():
if not arming_mask & bit and bit != 1:
... | python | def all_checks_enabled(self):
''' returns true if the UAV is skipping any arming checks'''
arming_mask = int(self.get_mav_param("ARMING_CHECK",0))
if arming_mask == 1:
return True
for bit in arming_masks.values():
if not arming_mask & bit and bit != 1:
... | [
"def",
"all_checks_enabled",
"(",
"self",
")",
":",
"arming_mask",
"=",
"int",
"(",
"self",
".",
"get_mav_param",
"(",
"\"ARMING_CHECK\"",
",",
"0",
")",
")",
"if",
"arming_mask",
"==",
"1",
":",
"return",
"True",
"for",
"bit",
"in",
"arming_masks",
".",
... | returns true if the UAV is skipping any arming checks | [
"returns",
"true",
"if",
"the",
"UAV",
"is",
"skipping",
"any",
"arming",
"checks"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_arm.py#L144-L152 |
235,758 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_param.py | ParamState.handle_px4_param_value | def handle_px4_param_value(self, m):
'''special handling for the px4 style of PARAM_VALUE'''
if m.param_type == mavutil.mavlink.MAV_PARAM_TYPE_REAL32:
# already right type
return m.param_value
is_px4_params = False
if m.get_srcComponent() in [mavutil.mavlink.MAV_C... | python | def handle_px4_param_value(self, m):
'''special handling for the px4 style of PARAM_VALUE'''
if m.param_type == mavutil.mavlink.MAV_PARAM_TYPE_REAL32:
# already right type
return m.param_value
is_px4_params = False
if m.get_srcComponent() in [mavutil.mavlink.MAV_C... | [
"def",
"handle_px4_param_value",
"(",
"self",
",",
"m",
")",
":",
"if",
"m",
".",
"param_type",
"==",
"mavutil",
".",
"mavlink",
".",
"MAV_PARAM_TYPE_REAL32",
":",
"# already right type",
"return",
"m",
".",
"param_value",
"is_px4_params",
"=",
"False",
"if",
... | special handling for the px4 style of PARAM_VALUE | [
"special",
"handling",
"for",
"the",
"px4",
"style",
"of",
"PARAM_VALUE"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_param.py#L28-L64 |
235,759 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_param.py | ParamState.param_help_download | def param_help_download(self):
'''download XML files for parameters'''
files = []
for vehicle in ['APMrover2', 'ArduCopter', 'ArduPlane', 'ArduSub', 'AntennaTracker']:
url = 'http://autotest.ardupilot.org/Parameters/%s/apm.pdef.xml' % vehicle
path = mp_util.dot_mavproxy("... | python | def param_help_download(self):
'''download XML files for parameters'''
files = []
for vehicle in ['APMrover2', 'ArduCopter', 'ArduPlane', 'ArduSub', 'AntennaTracker']:
url = 'http://autotest.ardupilot.org/Parameters/%s/apm.pdef.xml' % vehicle
path = mp_util.dot_mavproxy("... | [
"def",
"param_help_download",
"(",
"self",
")",
":",
"files",
"=",
"[",
"]",
"for",
"vehicle",
"in",
"[",
"'APMrover2'",
",",
"'ArduCopter'",
",",
"'ArduPlane'",
",",
"'ArduSub'",
",",
"'AntennaTracker'",
"]",
":",
"url",
"=",
"'http://autotest.ardupilot.org/Par... | download XML files for parameters | [
"download",
"XML",
"files",
"for",
"parameters"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_param.py#L121-L137 |
235,760 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_param.py | ParamState.param_help_tree | def param_help_tree(self):
'''return a "help tree", a map between a parameter and its metadata. May return None if help is not available'''
if self.xml_filepath is not None:
print("param: using xml_filepath=%s" % self.xml_filepath)
path = self.xml_filepath
else:
... | python | def param_help_tree(self):
'''return a "help tree", a map between a parameter and its metadata. May return None if help is not available'''
if self.xml_filepath is not None:
print("param: using xml_filepath=%s" % self.xml_filepath)
path = self.xml_filepath
else:
... | [
"def",
"param_help_tree",
"(",
"self",
")",
":",
"if",
"self",
".",
"xml_filepath",
"is",
"not",
"None",
":",
"print",
"(",
"\"param: using xml_filepath=%s\"",
"%",
"self",
".",
"xml_filepath",
")",
"path",
"=",
"self",
".",
"xml_filepath",
"else",
":",
"if"... | return a "help tree", a map between a parameter and its metadata. May return None if help is not available | [
"return",
"a",
"help",
"tree",
"a",
"map",
"between",
"a",
"parameter",
"and",
"its",
"metadata",
".",
"May",
"return",
"None",
"if",
"help",
"is",
"not",
"available"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_param.py#L142-L170 |
235,761 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_param.py | ParamState.param_apropos | def param_apropos(self, args):
'''search parameter help for a keyword, list those parameters'''
if len(args) == 0:
print("Usage: param apropos keyword")
return
htree = self.param_help_tree()
if htree is None:
return
contains = {}
for ... | python | def param_apropos(self, args):
'''search parameter help for a keyword, list those parameters'''
if len(args) == 0:
print("Usage: param apropos keyword")
return
htree = self.param_help_tree()
if htree is None:
return
contains = {}
for ... | [
"def",
"param_apropos",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"\"Usage: param apropos keyword\"",
")",
"return",
"htree",
"=",
"self",
".",
"param_help_tree",
"(",
")",
"if",
"htree",
"is",
"None... | search parameter help for a keyword, list those parameters | [
"search",
"parameter",
"help",
"for",
"a",
"keyword",
"list",
"those",
"parameters"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_param.py#L175-L191 |
235,762 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_param.py | ParamModule.get_component_id_list | def get_component_id_list(self, system_id):
'''get list of component IDs with parameters for a given system ID'''
ret = []
for (s,c) in self.mpstate.mav_param_by_sysid.keys():
if s == system_id:
ret.append(c)
return ret | python | def get_component_id_list(self, system_id):
'''get list of component IDs with parameters for a given system ID'''
ret = []
for (s,c) in self.mpstate.mav_param_by_sysid.keys():
if s == system_id:
ret.append(c)
return ret | [
"def",
"get_component_id_list",
"(",
"self",
",",
"system_id",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"(",
"s",
",",
"c",
")",
"in",
"self",
".",
"mpstate",
".",
"mav_param_by_sysid",
".",
"keys",
"(",
")",
":",
"if",
"s",
"==",
"system_id",
":",
"... | get list of component IDs with parameters for a given system ID | [
"get",
"list",
"of",
"component",
"IDs",
"with",
"parameters",
"for",
"a",
"given",
"system",
"ID"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_param.py#L371-L377 |
235,763 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_param.py | ParamModule.get_sysid | def get_sysid(self):
'''get sysid tuple to use for parameters'''
component = self.target_component
if component == 0:
component = 1
return (self.target_system, component) | python | def get_sysid(self):
'''get sysid tuple to use for parameters'''
component = self.target_component
if component == 0:
component = 1
return (self.target_system, component) | [
"def",
"get_sysid",
"(",
"self",
")",
":",
"component",
"=",
"self",
".",
"target_component",
"if",
"component",
"==",
"0",
":",
"component",
"=",
"1",
"return",
"(",
"self",
".",
"target_system",
",",
"component",
")"
] | get sysid tuple to use for parameters | [
"get",
"sysid",
"tuple",
"to",
"use",
"for",
"parameters"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_param.py#L398-L403 |
235,764 | ArduPilot/MAVProxy | MAVProxy/modules/lib/optparse_gui/__init__.py | OptionParser.parse_args | def parse_args( self, args = None, values = None ):
'''
multiprocessing wrapper around _parse_args
'''
q = multiproc.Queue()
p = multiproc.Process(target=self._parse_args, args=(q, args, values))
p.start()
ret = q.get()
p.join()
return ret | python | def parse_args( self, args = None, values = None ):
'''
multiprocessing wrapper around _parse_args
'''
q = multiproc.Queue()
p = multiproc.Process(target=self._parse_args, args=(q, args, values))
p.start()
ret = q.get()
p.join()
return ret | [
"def",
"parse_args",
"(",
"self",
",",
"args",
"=",
"None",
",",
"values",
"=",
"None",
")",
":",
"q",
"=",
"multiproc",
".",
"Queue",
"(",
")",
"p",
"=",
"multiproc",
".",
"Process",
"(",
"target",
"=",
"self",
".",
"_parse_args",
",",
"args",
"="... | multiprocessing wrapper around _parse_args | [
"multiprocessing",
"wrapper",
"around",
"_parse_args"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/optparse_gui/__init__.py#L206-L215 |
235,765 | ArduPilot/MAVProxy | MAVProxy/modules/lib/optparse_gui/__init__.py | OptionParser._parse_args | def _parse_args( self, q, args, values):
'''
This is the heart of it all - overrides optparse.OptionParser.parse_args
@param arg is irrelevant and thus ignored,
it is here only for interface compatibility
'''
if wx.GetApp() is None:
self.app = wx.App( F... | python | def _parse_args( self, q, args, values):
'''
This is the heart of it all - overrides optparse.OptionParser.parse_args
@param arg is irrelevant and thus ignored,
it is here only for interface compatibility
'''
if wx.GetApp() is None:
self.app = wx.App( F... | [
"def",
"_parse_args",
"(",
"self",
",",
"q",
",",
"args",
",",
"values",
")",
":",
"if",
"wx",
".",
"GetApp",
"(",
")",
"is",
"None",
":",
"self",
".",
"app",
"=",
"wx",
".",
"App",
"(",
"False",
")",
"# preprocess command line arguments and set to defau... | This is the heart of it all - overrides optparse.OptionParser.parse_args
@param arg is irrelevant and thus ignored,
it is here only for interface compatibility | [
"This",
"is",
"the",
"heart",
"of",
"it",
"all",
"-",
"overrides",
"optparse",
".",
"OptionParser",
".",
"parse_args"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/optparse_gui/__init__.py#L217-L261 |
235,766 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | DNFZ.distance_from | def distance_from(self, lat, lon):
'''get distance from a point'''
lat1 = self.pkt['I105']['Lat']['val']
lon1 = self.pkt['I105']['Lon']['val']
return mp_util.gps_distance(lat1, lon1, lat, lon) | python | def distance_from(self, lat, lon):
'''get distance from a point'''
lat1 = self.pkt['I105']['Lat']['val']
lon1 = self.pkt['I105']['Lon']['val']
return mp_util.gps_distance(lat1, lon1, lat, lon) | [
"def",
"distance_from",
"(",
"self",
",",
"lat",
",",
"lon",
")",
":",
"lat1",
"=",
"self",
".",
"pkt",
"[",
"'I105'",
"]",
"[",
"'Lat'",
"]",
"[",
"'val'",
"]",
"lon1",
"=",
"self",
".",
"pkt",
"[",
"'I105'",
"]",
"[",
"'Lon'",
"]",
"[",
"'val... | get distance from a point | [
"get",
"distance",
"from",
"a",
"point"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L65-L69 |
235,767 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | DNFZ.randpos | def randpos(self):
'''random initial position'''
self.setpos(gen_settings.home_lat, gen_settings.home_lon)
self.move(random.uniform(0, 360), random.uniform(0, gen_settings.region_width)) | python | def randpos(self):
'''random initial position'''
self.setpos(gen_settings.home_lat, gen_settings.home_lon)
self.move(random.uniform(0, 360), random.uniform(0, gen_settings.region_width)) | [
"def",
"randpos",
"(",
"self",
")",
":",
"self",
".",
"setpos",
"(",
"gen_settings",
".",
"home_lat",
",",
"gen_settings",
".",
"home_lon",
")",
"self",
".",
"move",
"(",
"random",
".",
"uniform",
"(",
"0",
",",
"360",
")",
",",
"random",
".",
"unifo... | random initial position | [
"random",
"initial",
"position"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L75-L78 |
235,768 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | DNFZ.ground_height | def ground_height(self):
'''return height above ground in feet'''
lat = self.pkt['I105']['Lat']['val']
lon = self.pkt['I105']['Lon']['val']
global ElevationMap
ret = ElevationMap.GetElevation(lat, lon)
ret -= gen_settings.wgs84_to_AMSL
return ret * 3.2807 | python | def ground_height(self):
'''return height above ground in feet'''
lat = self.pkt['I105']['Lat']['val']
lon = self.pkt['I105']['Lon']['val']
global ElevationMap
ret = ElevationMap.GetElevation(lat, lon)
ret -= gen_settings.wgs84_to_AMSL
return ret * 3.2807 | [
"def",
"ground_height",
"(",
"self",
")",
":",
"lat",
"=",
"self",
".",
"pkt",
"[",
"'I105'",
"]",
"[",
"'Lat'",
"]",
"[",
"'val'",
"]",
"lon",
"=",
"self",
".",
"pkt",
"[",
"'I105'",
"]",
"[",
"'Lon'",
"]",
"[",
"'val'",
"]",
"global",
"Elevatio... | return height above ground in feet | [
"return",
"height",
"above",
"ground",
"in",
"feet"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L80-L87 |
235,769 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | DNFZ.move | def move(self, bearing, distance):
'''move position by bearing and distance'''
lat = self.pkt['I105']['Lat']['val']
lon = self.pkt['I105']['Lon']['val']
(lat, lon) = mp_util.gps_newpos(lat, lon, bearing, distance)
self.setpos(lat, lon) | python | def move(self, bearing, distance):
'''move position by bearing and distance'''
lat = self.pkt['I105']['Lat']['val']
lon = self.pkt['I105']['Lon']['val']
(lat, lon) = mp_util.gps_newpos(lat, lon, bearing, distance)
self.setpos(lat, lon) | [
"def",
"move",
"(",
"self",
",",
"bearing",
",",
"distance",
")",
":",
"lat",
"=",
"self",
".",
"pkt",
"[",
"'I105'",
"]",
"[",
"'Lat'",
"]",
"[",
"'val'",
"]",
"lon",
"=",
"self",
".",
"pkt",
"[",
"'I105'",
"]",
"[",
"'Lon'",
"]",
"[",
"'val'"... | move position by bearing and distance | [
"move",
"position",
"by",
"bearing",
"and",
"distance"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L93-L98 |
235,770 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | Aircraft.update | def update(self, deltat=1.0):
'''fly a square circuit'''
DNFZ.update(self, deltat)
self.dist_flown += self.speed * deltat
if self.dist_flown > self.circuit_width:
self.desired_heading = self.heading + 90
self.dist_flown = 0
if self.getalt() < self.ground_h... | python | def update(self, deltat=1.0):
'''fly a square circuit'''
DNFZ.update(self, deltat)
self.dist_flown += self.speed * deltat
if self.dist_flown > self.circuit_width:
self.desired_heading = self.heading + 90
self.dist_flown = 0
if self.getalt() < self.ground_h... | [
"def",
"update",
"(",
"self",
",",
"deltat",
"=",
"1.0",
")",
":",
"DNFZ",
".",
"update",
"(",
"self",
",",
"deltat",
")",
"self",
".",
"dist_flown",
"+=",
"self",
".",
"speed",
"*",
"deltat",
"if",
"self",
".",
"dist_flown",
">",
"self",
".",
"cir... | fly a square circuit | [
"fly",
"a",
"square",
"circuit"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L180-L189 |
235,771 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | BirdOfPrey.update | def update(self, deltat=1.0):
'''fly circles, then dive'''
DNFZ.update(self, deltat)
self.time_circling += deltat
self.setheading(self.heading + self.turn_rate * deltat)
self.move(self.drift_heading, self.drift_speed)
if self.getalt() > self.max_alt or self.getalt() < sel... | python | def update(self, deltat=1.0):
'''fly circles, then dive'''
DNFZ.update(self, deltat)
self.time_circling += deltat
self.setheading(self.heading + self.turn_rate * deltat)
self.move(self.drift_heading, self.drift_speed)
if self.getalt() > self.max_alt or self.getalt() < sel... | [
"def",
"update",
"(",
"self",
",",
"deltat",
"=",
"1.0",
")",
":",
"DNFZ",
".",
"update",
"(",
"self",
",",
"deltat",
")",
"self",
".",
"time_circling",
"+=",
"deltat",
"self",
".",
"setheading",
"(",
"self",
".",
"heading",
"+",
"self",
".",
"turn_r... | fly circles, then dive | [
"fly",
"circles",
"then",
"dive"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L209-L224 |
235,772 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | BirdMigrating.update | def update(self, deltat=1.0):
'''fly in long curves'''
DNFZ.update(self, deltat)
if (self.distance_from_home() > gen_settings.region_width or
self.getalt() < self.ground_height() or
self.getalt() > self.ground_height() + 1000):
self.randpos()
self.... | python | def update(self, deltat=1.0):
'''fly in long curves'''
DNFZ.update(self, deltat)
if (self.distance_from_home() > gen_settings.region_width or
self.getalt() < self.ground_height() or
self.getalt() > self.ground_height() + 1000):
self.randpos()
self.... | [
"def",
"update",
"(",
"self",
",",
"deltat",
"=",
"1.0",
")",
":",
"DNFZ",
".",
"update",
"(",
"self",
",",
"deltat",
")",
"if",
"(",
"self",
".",
"distance_from_home",
"(",
")",
">",
"gen_settings",
".",
"region_width",
"or",
"self",
".",
"getalt",
... | fly in long curves | [
"fly",
"in",
"long",
"curves"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L234-L241 |
235,773 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | Weather.update | def update(self, deltat=1.0):
'''straight lines, with short life'''
DNFZ.update(self, deltat)
self.lifetime -= deltat
if self.lifetime <= 0:
self.randpos()
self.lifetime = random.uniform(300,600) | python | def update(self, deltat=1.0):
'''straight lines, with short life'''
DNFZ.update(self, deltat)
self.lifetime -= deltat
if self.lifetime <= 0:
self.randpos()
self.lifetime = random.uniform(300,600) | [
"def",
"update",
"(",
"self",
",",
"deltat",
"=",
"1.0",
")",
":",
"DNFZ",
".",
"update",
"(",
"self",
",",
"deltat",
")",
"self",
".",
"lifetime",
"-=",
"deltat",
"if",
"self",
".",
"lifetime",
"<=",
"0",
":",
"self",
".",
"randpos",
"(",
")",
"... | straight lines, with short life | [
"straight",
"lines",
"with",
"short",
"life"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L252-L258 |
235,774 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | GenobstaclesModule.cmd_dropobject | def cmd_dropobject(self, obj):
'''drop an object on the map'''
latlon = self.module('map').click_position
if self.last_click is not None and self.last_click == latlon:
return
self.last_click = latlon
if latlon is not None:
obj.setpos(latlon[0], latlon[1])
... | python | def cmd_dropobject(self, obj):
'''drop an object on the map'''
latlon = self.module('map').click_position
if self.last_click is not None and self.last_click == latlon:
return
self.last_click = latlon
if latlon is not None:
obj.setpos(latlon[0], latlon[1])
... | [
"def",
"cmd_dropobject",
"(",
"self",
",",
"obj",
")",
":",
"latlon",
"=",
"self",
".",
"module",
"(",
"'map'",
")",
".",
"click_position",
"if",
"self",
".",
"last_click",
"is",
"not",
"None",
"and",
"self",
".",
"last_click",
"==",
"latlon",
":",
"re... | drop an object on the map | [
"drop",
"an",
"object",
"on",
"the",
"map"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L291-L299 |
235,775 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | GenobstaclesModule.cmd_genobstacles | def cmd_genobstacles(self, args):
'''genobstacles command parser'''
usage = "usage: genobstacles <start|stop|restart|clearall|status|set>"
if len(args) == 0:
print(usage)
return
if args[0] == "set":
gen_settings.command(args[1:])
elif args[0] =... | python | def cmd_genobstacles(self, args):
'''genobstacles command parser'''
usage = "usage: genobstacles <start|stop|restart|clearall|status|set>"
if len(args) == 0:
print(usage)
return
if args[0] == "set":
gen_settings.command(args[1:])
elif args[0] =... | [
"def",
"cmd_genobstacles",
"(",
"self",
",",
"args",
")",
":",
"usage",
"=",
"\"usage: genobstacles <start|stop|restart|clearall|status|set>\"",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"usage",
")",
"return",
"if",
"args",
"[",
"0",
"]",
... | genobstacles command parser | [
"genobstacles",
"command",
"parser"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L309-L359 |
235,776 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | GenobstaclesModule.start | def start(self):
'''start sending packets'''
if self.sock is not None:
self.sock.close()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.connect(('', gen_setting... | python | def start(self):
'''start sending packets'''
if self.sock is not None:
self.sock.close()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.connect(('', gen_setting... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"sock",
"is",
"not",
"None",
":",
"self",
".",
"sock",
".",
"close",
"(",
")",
"self",
".",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_D... | start sending packets | [
"start",
"sending",
"packets"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L361-L389 |
235,777 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_genobstacles.py | GenobstaclesModule.mavlink_packet | def mavlink_packet(self, m):
'''trigger sends from ATTITUDE packets'''
if not self.have_home and m.get_type() == 'GPS_RAW_INT' and m.fix_type >= 3:
gen_settings.home_lat = m.lat * 1.0e-7
gen_settings.home_lon = m.lon * 1.0e-7
self.have_home = True
if self.... | python | def mavlink_packet(self, m):
'''trigger sends from ATTITUDE packets'''
if not self.have_home and m.get_type() == 'GPS_RAW_INT' and m.fix_type >= 3:
gen_settings.home_lat = m.lat * 1.0e-7
gen_settings.home_lon = m.lon * 1.0e-7
self.have_home = True
if self.... | [
"def",
"mavlink_packet",
"(",
"self",
",",
"m",
")",
":",
"if",
"not",
"self",
".",
"have_home",
"and",
"m",
".",
"get_type",
"(",
")",
"==",
"'GPS_RAW_INT'",
"and",
"m",
".",
"fix_type",
">=",
"3",
":",
"gen_settings",
".",
"home_lat",
"=",
"m",
"."... | trigger sends from ATTITUDE packets | [
"trigger",
"sends",
"from",
"ATTITUDE",
"packets"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L409-L436 |
235,778 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_adsb.py | ADSBVehicle.update | def update(self, state, tnow):
'''update the threat state'''
self.state = state
self.update_time = tnow | python | def update(self, state, tnow):
'''update the threat state'''
self.state = state
self.update_time = tnow | [
"def",
"update",
"(",
"self",
",",
"state",
",",
"tnow",
")",
":",
"self",
".",
"state",
"=",
"state",
"self",
".",
"update_time",
"=",
"tnow"
] | update the threat state | [
"update",
"the",
"threat",
"state"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_adsb.py#L50-L53 |
235,779 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_adsb.py | ADSBModule.cmd_ADSB | def cmd_ADSB(self, args):
'''adsb command parser'''
usage = "usage: adsb <set>"
if len(args) == 0:
print(usage)
return
if args[0] == "status":
print("total threat count: %u active threat count: %u" %
(len(self.threat_vehicles), len(s... | python | def cmd_ADSB(self, args):
'''adsb command parser'''
usage = "usage: adsb <set>"
if len(args) == 0:
print(usage)
return
if args[0] == "status":
print("total threat count: %u active threat count: %u" %
(len(self.threat_vehicles), len(s... | [
"def",
"cmd_ADSB",
"(",
"self",
",",
"args",
")",
":",
"usage",
"=",
"\"usage: adsb <set>\"",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"usage",
")",
"return",
"if",
"args",
"[",
"0",
"]",
"==",
"\"status\"",
":",
"print",
"(",
"... | adsb command parser | [
"adsb",
"command",
"parser"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_adsb.py#L79-L97 |
235,780 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_adsb.py | ADSBModule.update_threat_distances | def update_threat_distances(self, latlonalt):
'''update the distance between threats and vehicle'''
for id in self.threat_vehicles.keys():
threat_latlonalt = (self.threat_vehicles[id].state['lat'] * 1e-7,
self.threat_vehicles[id].state['lon'] * 1e-7,
... | python | def update_threat_distances(self, latlonalt):
'''update the distance between threats and vehicle'''
for id in self.threat_vehicles.keys():
threat_latlonalt = (self.threat_vehicles[id].state['lat'] * 1e-7,
self.threat_vehicles[id].state['lon'] * 1e-7,
... | [
"def",
"update_threat_distances",
"(",
"self",
",",
"latlonalt",
")",
":",
"for",
"id",
"in",
"self",
".",
"threat_vehicles",
".",
"keys",
"(",
")",
":",
"threat_latlonalt",
"=",
"(",
"self",
".",
"threat_vehicles",
"[",
"id",
"]",
".",
"state",
"[",
"'l... | update the distance between threats and vehicle | [
"update",
"the",
"distance",
"between",
"threats",
"and",
"vehicle"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_adsb.py#L122-L134 |
235,781 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_adsb.py | ADSBModule.check_threat_timeout | def check_threat_timeout(self):
'''check and handle threat time out'''
for id in self.threat_vehicles.keys():
if self.threat_vehicles[id].update_time == 0:
self.threat_vehicles[id].update_time = self.get_time()
dt = self.get_time() - self.threat_vehicles[id].updat... | python | def check_threat_timeout(self):
'''check and handle threat time out'''
for id in self.threat_vehicles.keys():
if self.threat_vehicles[id].update_time == 0:
self.threat_vehicles[id].update_time = self.get_time()
dt = self.get_time() - self.threat_vehicles[id].updat... | [
"def",
"check_threat_timeout",
"(",
"self",
")",
":",
"for",
"id",
"in",
"self",
".",
"threat_vehicles",
".",
"keys",
"(",
")",
":",
"if",
"self",
".",
"threat_vehicles",
"[",
"id",
"]",
".",
"update_time",
"==",
"0",
":",
"self",
".",
"threat_vehicles",... | check and handle threat time out | [
"check",
"and",
"handle",
"threat",
"time",
"out"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_adsb.py#L160-L176 |
235,782 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_gopro.py | GoProModule.cmd_gopro_status | def cmd_gopro_status(self, args):
'''show gopro status'''
master = self.master
if 'GOPRO_HEARTBEAT' in master.messages:
print(master.messages['GOPRO_HEARTBEAT'])
else:
print("No GOPRO_HEARTBEAT messages") | python | def cmd_gopro_status(self, args):
'''show gopro status'''
master = self.master
if 'GOPRO_HEARTBEAT' in master.messages:
print(master.messages['GOPRO_HEARTBEAT'])
else:
print("No GOPRO_HEARTBEAT messages") | [
"def",
"cmd_gopro_status",
"(",
"self",
",",
"args",
")",
":",
"master",
"=",
"self",
".",
"master",
"if",
"'GOPRO_HEARTBEAT'",
"in",
"master",
".",
"messages",
":",
"print",
"(",
"master",
".",
"messages",
"[",
"'GOPRO_HEARTBEAT'",
"]",
")",
"else",
":",
... | show gopro status | [
"show",
"gopro",
"status"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_gopro.py#L76-L82 |
235,783 | ArduPilot/MAVProxy | MAVProxy/modules/lib/wxconsole_ui.py | ConsoleFrame.on_text_url | def on_text_url(self, event):
'''handle double clicks on URL text'''
try:
import webbrowser
except ImportError:
return
mouse_event = event.GetMouseEvent()
if mouse_event.LeftDClick():
url_start = event.GetURLStart()
url_end = event.... | python | def on_text_url(self, event):
'''handle double clicks on URL text'''
try:
import webbrowser
except ImportError:
return
mouse_event = event.GetMouseEvent()
if mouse_event.LeftDClick():
url_start = event.GetURLStart()
url_end = event.... | [
"def",
"on_text_url",
"(",
"self",
",",
"event",
")",
":",
"try",
":",
"import",
"webbrowser",
"except",
"ImportError",
":",
"return",
"mouse_event",
"=",
"event",
".",
"GetMouseEvent",
"(",
")",
"if",
"mouse_event",
".",
"LeftDClick",
"(",
")",
":",
"url_... | handle double clicks on URL text | [
"handle",
"double",
"clicks",
"on",
"URL",
"text"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxconsole_ui.py#L55-L72 |
235,784 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_heliplane.py | HeliPlaneModule.update_channels | def update_channels(self):
'''update which channels provide input'''
self.interlock_channel = -1
self.override_channel = -1
self.zero_I_channel = -1
self.no_vtol_channel = -1
# output channels
self.rsc_out_channel = 9
self.fwd_thr_channel = 10
fo... | python | def update_channels(self):
'''update which channels provide input'''
self.interlock_channel = -1
self.override_channel = -1
self.zero_I_channel = -1
self.no_vtol_channel = -1
# output channels
self.rsc_out_channel = 9
self.fwd_thr_channel = 10
fo... | [
"def",
"update_channels",
"(",
"self",
")",
":",
"self",
".",
"interlock_channel",
"=",
"-",
"1",
"self",
".",
"override_channel",
"=",
"-",
"1",
"self",
".",
"zero_I_channel",
"=",
"-",
"1",
"self",
".",
"no_vtol_channel",
"=",
"-",
"1",
"# output channel... | update which channels provide input | [
"update",
"which",
"channels",
"provide",
"input"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_heliplane.py#L102-L130 |
235,785 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_rally.py | RallyModule.rallyloader | def rallyloader(self):
'''rally loader by system ID'''
if not self.target_system in self.rallyloader_by_sysid:
self.rallyloader_by_sysid[self.target_system] = mavwp.MAVRallyLoader(self.settings.target_system,
se... | python | def rallyloader(self):
'''rally loader by system ID'''
if not self.target_system in self.rallyloader_by_sysid:
self.rallyloader_by_sysid[self.target_system] = mavwp.MAVRallyLoader(self.settings.target_system,
se... | [
"def",
"rallyloader",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"target_system",
"in",
"self",
".",
"rallyloader_by_sysid",
":",
"self",
".",
"rallyloader_by_sysid",
"[",
"self",
".",
"target_system",
"]",
"=",
"mavwp",
".",
"MAVRallyLoader",
"(",
"se... | rally loader by system ID | [
"rally",
"loader",
"by",
"system",
"ID"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_rally.py#L45-L50 |
235,786 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_dataflash_logger.py | dataflash_logger.packet_is_for_me | def packet_is_for_me(self, m):
'''returns true if this packet is appropriately addressed'''
if m.target_system != self.master.mav.srcSystem:
return False
if m.target_component != self.master.mav.srcComponent:
return False
# if have a sender we can also check the s... | python | def packet_is_for_me(self, m):
'''returns true if this packet is appropriately addressed'''
if m.target_system != self.master.mav.srcSystem:
return False
if m.target_component != self.master.mav.srcComponent:
return False
# if have a sender we can also check the s... | [
"def",
"packet_is_for_me",
"(",
"self",
",",
"m",
")",
":",
"if",
"m",
".",
"target_system",
"!=",
"self",
".",
"master",
".",
"mav",
".",
"srcSystem",
":",
"return",
"False",
"if",
"m",
".",
"target_component",
"!=",
"self",
".",
"master",
".",
"mav",... | returns true if this packet is appropriately addressed | [
"returns",
"true",
"if",
"this",
"packet",
"is",
"appropriately",
"addressed"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_dataflash_logger.py#L261-L271 |
235,787 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wxagg.py | _convert_agg_to_wx_image | def _convert_agg_to_wx_image(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Image. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance.
"""
if bbox is None:
# agg => rgb -> image
image = wx.EmptyIma... | python | def _convert_agg_to_wx_image(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Image. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance.
"""
if bbox is None:
# agg => rgb -> image
image = wx.EmptyIma... | [
"def",
"_convert_agg_to_wx_image",
"(",
"agg",
",",
"bbox",
")",
":",
"if",
"bbox",
"is",
"None",
":",
"# agg => rgb -> image",
"image",
"=",
"wx",
".",
"EmptyImage",
"(",
"int",
"(",
"agg",
".",
"width",
")",
",",
"int",
"(",
"agg",
".",
"height",
")"... | Convert the region of the agg buffer bounded by bbox to a wx.Image. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance. | [
"Convert",
"the",
"region",
"of",
"the",
"agg",
"buffer",
"bounded",
"by",
"bbox",
"to",
"a",
"wx",
".",
"Image",
".",
"If",
"bbox",
"is",
"None",
"the",
"entire",
"buffer",
"is",
"converted",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wxagg.py#L128-L142 |
235,788 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wxagg.py | _convert_agg_to_wx_bitmap | def _convert_agg_to_wx_bitmap(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance.
"""
if bbox is None:
# agg => rgba buffer -> bitmap
return w... | python | def _convert_agg_to_wx_bitmap(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance.
"""
if bbox is None:
# agg => rgba buffer -> bitmap
return w... | [
"def",
"_convert_agg_to_wx_bitmap",
"(",
"agg",
",",
"bbox",
")",
":",
"if",
"bbox",
"is",
"None",
":",
"# agg => rgba buffer -> bitmap",
"return",
"wx",
".",
"BitmapFromBufferRGBA",
"(",
"int",
"(",
"agg",
".",
"width",
")",
",",
"int",
"(",
"agg",
".",
"... | Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If
bbox is None, the entire buffer is converted.
Note: agg must be a backend_agg.RendererAgg instance. | [
"Convert",
"the",
"region",
"of",
"the",
"agg",
"buffer",
"bounded",
"by",
"bbox",
"to",
"a",
"wx",
".",
"Bitmap",
".",
"If",
"bbox",
"is",
"None",
"the",
"entire",
"buffer",
"is",
"converted",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wxagg.py#L145-L158 |
235,789 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wxagg.py | _WX28_clipped_agg_as_bitmap | def _WX28_clipped_agg_as_bitmap(agg, bbox):
"""
Convert the region of a the agg buffer bounded by bbox to a wx.Bitmap.
Note: agg must be a backend_agg.RendererAgg instance.
"""
l, b, width, height = bbox.bounds
r = l + width
t = b + height
srcBmp = wx.BitmapFromBufferRGBA(int(agg.width... | python | def _WX28_clipped_agg_as_bitmap(agg, bbox):
"""
Convert the region of a the agg buffer bounded by bbox to a wx.Bitmap.
Note: agg must be a backend_agg.RendererAgg instance.
"""
l, b, width, height = bbox.bounds
r = l + width
t = b + height
srcBmp = wx.BitmapFromBufferRGBA(int(agg.width... | [
"def",
"_WX28_clipped_agg_as_bitmap",
"(",
"agg",
",",
"bbox",
")",
":",
"l",
",",
"b",
",",
"width",
",",
"height",
"=",
"bbox",
".",
"bounds",
"r",
"=",
"l",
"+",
"width",
"t",
"=",
"b",
"+",
"height",
"srcBmp",
"=",
"wx",
".",
"BitmapFromBufferRGB... | Convert the region of a the agg buffer bounded by bbox to a wx.Bitmap.
Note: agg must be a backend_agg.RendererAgg instance. | [
"Convert",
"the",
"region",
"of",
"a",
"the",
"agg",
"buffer",
"bounded",
"by",
"bbox",
"to",
"a",
"wx",
".",
"Bitmap",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wxagg.py#L161-L189 |
235,790 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wxagg.py | FigureCanvasWxAgg.draw | def draw(self, drawDC=None):
"""
Render the figure using agg.
"""
DEBUG_MSG("draw()", 1, self)
FigureCanvasAgg.draw(self)
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
self._isDrawn = True
self.gui_repaint(drawDC=drawDC) | python | def draw(self, drawDC=None):
"""
Render the figure using agg.
"""
DEBUG_MSG("draw()", 1, self)
FigureCanvasAgg.draw(self)
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
self._isDrawn = True
self.gui_repaint(drawDC=drawDC) | [
"def",
"draw",
"(",
"self",
",",
"drawDC",
"=",
"None",
")",
":",
"DEBUG_MSG",
"(",
"\"draw()\"",
",",
"1",
",",
"self",
")",
"FigureCanvasAgg",
".",
"draw",
"(",
"self",
")",
"self",
".",
"bitmap",
"=",
"_convert_agg_to_wx_bitmap",
"(",
"self",
".",
"... | Render the figure using agg. | [
"Render",
"the",
"figure",
"using",
"agg",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wxagg.py#L39-L48 |
235,791 | ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wxagg.py | FigureCanvasWxAgg.blit | def blit(self, bbox=None):
"""
Transfer the region of the agg buffer defined by bbox to the display.
If bbox is None, the entire buffer is transferred.
"""
if bbox is None:
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
self.gui_repaint... | python | def blit(self, bbox=None):
"""
Transfer the region of the agg buffer defined by bbox to the display.
If bbox is None, the entire buffer is transferred.
"""
if bbox is None:
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
self.gui_repaint... | [
"def",
"blit",
"(",
"self",
",",
"bbox",
"=",
"None",
")",
":",
"if",
"bbox",
"is",
"None",
":",
"self",
".",
"bitmap",
"=",
"_convert_agg_to_wx_bitmap",
"(",
"self",
".",
"get_renderer",
"(",
")",
",",
"None",
")",
"self",
".",
"gui_repaint",
"(",
"... | Transfer the region of the agg buffer defined by bbox to the display.
If bbox is None, the entire buffer is transferred. | [
"Transfer",
"the",
"region",
"of",
"the",
"agg",
"buffer",
"defined",
"by",
"bbox",
"to",
"the",
"display",
".",
"If",
"bbox",
"is",
"None",
"the",
"entire",
"buffer",
"is",
"transferred",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wxagg.py#L50-L79 |
235,792 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_antenna.py | AntennaModule.cmd_antenna | def cmd_antenna(self, args):
'''set gcs location'''
if len(args) != 2:
if self.gcs_location is None:
print("GCS location not set")
else:
print("GCS location %s" % str(self.gcs_location))
return
self.gcs_location = (float(args[0]... | python | def cmd_antenna(self, args):
'''set gcs location'''
if len(args) != 2:
if self.gcs_location is None:
print("GCS location not set")
else:
print("GCS location %s" % str(self.gcs_location))
return
self.gcs_location = (float(args[0]... | [
"def",
"cmd_antenna",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"2",
":",
"if",
"self",
".",
"gcs_location",
"is",
"None",
":",
"print",
"(",
"\"GCS location not set\"",
")",
"else",
":",
"print",
"(",
"\"GCS location %s\""... | set gcs location | [
"set",
"gcs",
"location"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_antenna.py#L20-L28 |
235,793 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_signing.py | SigningModule.passphrase_to_key | def passphrase_to_key(self, passphrase):
'''convert a passphrase to a 32 byte key'''
import hashlib
h = hashlib.new('sha256')
h.update(passphrase)
return h.digest() | python | def passphrase_to_key(self, passphrase):
'''convert a passphrase to a 32 byte key'''
import hashlib
h = hashlib.new('sha256')
h.update(passphrase)
return h.digest() | [
"def",
"passphrase_to_key",
"(",
"self",
",",
"passphrase",
")",
":",
"import",
"hashlib",
"h",
"=",
"hashlib",
".",
"new",
"(",
"'sha256'",
")",
"h",
".",
"update",
"(",
"passphrase",
")",
"return",
"h",
".",
"digest",
"(",
")"
] | convert a passphrase to a 32 byte key | [
"convert",
"a",
"passphrase",
"to",
"a",
"32",
"byte",
"key"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_signing.py#L39-L44 |
235,794 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_signing.py | SigningModule.cmd_signing_setup | def cmd_signing_setup(self, args):
'''setup signing key on board'''
if len(args) == 0:
print("usage: signing setup passphrase")
return
if not self.master.mavlink20():
print("You must be using MAVLink2 for signing")
return
passphrase = args[... | python | def cmd_signing_setup(self, args):
'''setup signing key on board'''
if len(args) == 0:
print("usage: signing setup passphrase")
return
if not self.master.mavlink20():
print("You must be using MAVLink2 for signing")
return
passphrase = args[... | [
"def",
"cmd_signing_setup",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"\"usage: signing setup passphrase\"",
")",
"return",
"if",
"not",
"self",
".",
"master",
".",
"mavlink20",
"(",
")",
":",
"print... | setup signing key on board | [
"setup",
"signing",
"key",
"on",
"board"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_signing.py#L46-L66 |
235,795 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_signing.py | SigningModule.allow_unsigned | def allow_unsigned(self, mav, msgId):
'''see if an unsigned packet should be allowed'''
if self.allow is None:
self.allow = {
mavutil.mavlink.MAVLINK_MSG_ID_RADIO : True,
mavutil.mavlink.MAVLINK_MSG_ID_RADIO_STATUS : True
}
if msgId in ... | python | def allow_unsigned(self, mav, msgId):
'''see if an unsigned packet should be allowed'''
if self.allow is None:
self.allow = {
mavutil.mavlink.MAVLINK_MSG_ID_RADIO : True,
mavutil.mavlink.MAVLINK_MSG_ID_RADIO_STATUS : True
}
if msgId in ... | [
"def",
"allow_unsigned",
"(",
"self",
",",
"mav",
",",
"msgId",
")",
":",
"if",
"self",
".",
"allow",
"is",
"None",
":",
"self",
".",
"allow",
"=",
"{",
"mavutil",
".",
"mavlink",
".",
"MAVLINK_MSG_ID_RADIO",
":",
"True",
",",
"mavutil",
".",
"mavlink"... | see if an unsigned packet should be allowed | [
"see",
"if",
"an",
"unsigned",
"packet",
"should",
"be",
"allowed"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_signing.py#L69-L80 |
235,796 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_signing.py | SigningModule.cmd_signing_key | def cmd_signing_key(self, args):
'''set signing key on connection'''
if len(args) == 0:
print("usage: signing setup passphrase")
return
if not self.master.mavlink20():
print("You must be using MAVLink2 for signing")
return
passphrase = args... | python | def cmd_signing_key(self, args):
'''set signing key on connection'''
if len(args) == 0:
print("usage: signing setup passphrase")
return
if not self.master.mavlink20():
print("You must be using MAVLink2 for signing")
return
passphrase = args... | [
"def",
"cmd_signing_key",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"\"usage: signing setup passphrase\"",
")",
"return",
"if",
"not",
"self",
".",
"master",
".",
"mavlink20",
"(",
")",
":",
"print",... | set signing key on connection | [
"set",
"signing",
"key",
"on",
"connection"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_signing.py#L82-L93 |
235,797 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_signing.py | SigningModule.cmd_signing_remove | def cmd_signing_remove(self, args):
'''remove signing from server'''
if not self.master.mavlink20():
print("You must be using MAVLink2 for signing")
return
self.master.mav.setup_signing_send(self.target_system, self.target_component, [0]*32, 0)
self.master.disable... | python | def cmd_signing_remove(self, args):
'''remove signing from server'''
if not self.master.mavlink20():
print("You must be using MAVLink2 for signing")
return
self.master.mav.setup_signing_send(self.target_system, self.target_component, [0]*32, 0)
self.master.disable... | [
"def",
"cmd_signing_remove",
"(",
"self",
",",
"args",
")",
":",
"if",
"not",
"self",
".",
"master",
".",
"mavlink20",
"(",
")",
":",
"print",
"(",
"\"You must be using MAVLink2 for signing\"",
")",
"return",
"self",
".",
"master",
".",
"mav",
".",
"setup_si... | remove signing from server | [
"remove",
"signing",
"from",
"server"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_signing.py#L100-L107 |
235,798 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_output.py | OutputModule.cmd_output | def cmd_output(self, args):
'''handle output commands'''
if len(args) < 1 or args[0] == "list":
self.cmd_output_list()
elif args[0] == "add":
if len(args) != 2:
print("Usage: output add OUTPUT")
return
self.cmd_output_add(args[1... | python | def cmd_output(self, args):
'''handle output commands'''
if len(args) < 1 or args[0] == "list":
self.cmd_output_list()
elif args[0] == "add":
if len(args) != 2:
print("Usage: output add OUTPUT")
return
self.cmd_output_add(args[1... | [
"def",
"cmd_output",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
"or",
"args",
"[",
"0",
"]",
"==",
"\"list\"",
":",
"self",
".",
"cmd_output_list",
"(",
")",
"elif",
"args",
"[",
"0",
"]",
"==",
"\"add\"",
":",
... | handle output commands | [
"handle",
"output",
"commands"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_output.py#L21-L41 |
235,799 | ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_output.py | OutputModule.cmd_output_add | def cmd_output_add(self, args):
'''add new output'''
device = args[0]
print("Adding output %s" % device)
try:
conn = mavutil.mavlink_connection(device, input=False, source_system=self.settings.source_system)
conn.mav.srcComponent = self.settings.source_component
... | python | def cmd_output_add(self, args):
'''add new output'''
device = args[0]
print("Adding output %s" % device)
try:
conn = mavutil.mavlink_connection(device, input=False, source_system=self.settings.source_system)
conn.mav.srcComponent = self.settings.source_component
... | [
"def",
"cmd_output_add",
"(",
"self",
",",
"args",
")",
":",
"device",
"=",
"args",
"[",
"0",
"]",
"print",
"(",
"\"Adding output %s\"",
"%",
"device",
")",
"try",
":",
"conn",
"=",
"mavutil",
".",
"mavlink_connection",
"(",
"device",
",",
"input",
"=",
... | add new output | [
"add",
"new",
"output"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_output.py#L55-L69 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.