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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wx.py | MenuButtonWx.getActiveAxes | def getActiveAxes(self):
"""Return a list of the selected axes."""
active = []
for i in range(len(self._axisId)):
if self._menu.IsChecked(self._axisId[i]):
active.append(i)
return active | python | def getActiveAxes(self):
"""Return a list of the selected axes."""
active = []
for i in range(len(self._axisId)):
if self._menu.IsChecked(self._axisId[i]):
active.append(i)
return active | [
"def",
"getActiveAxes",
"(",
"self",
")",
":",
"active",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"_axisId",
")",
")",
":",
"if",
"self",
".",
"_menu",
".",
"IsChecked",
"(",
"self",
".",
"_axisId",
"[",
"i",
"]",
... | Return a list of the selected axes. | [
"Return",
"a",
"list",
"of",
"the",
"selected",
"axes",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1570-L1576 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wx.py | MenuButtonWx.updateButtonText | def updateButtonText(self, lst):
"""Update the list of selected axes in the menu button"""
axis_txt = ''
for e in lst:
axis_txt += '%d,' % (e+1)
# remove trailing ',' and add to button string
self.SetLabel("Axes: %s" % axis_txt[:-1]) | python | def updateButtonText(self, lst):
"""Update the list of selected axes in the menu button"""
axis_txt = ''
for e in lst:
axis_txt += '%d,' % (e+1)
# remove trailing ',' and add to button string
self.SetLabel("Axes: %s" % axis_txt[:-1]) | [
"def",
"updateButtonText",
"(",
"self",
",",
"lst",
")",
":",
"axis_txt",
"=",
"''",
"for",
"e",
"in",
"lst",
":",
"axis_txt",
"+=",
"'%d,'",
"%",
"(",
"e",
"+",
"1",
")",
"# remove trailing ',' and add to button string",
"self",
".",
"SetLabel",
"(",
"\"A... | Update the list of selected axes in the menu button | [
"Update",
"the",
"list",
"of",
"selected",
"axes",
"in",
"the",
"menu",
"button"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1578-L1584 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wx.py | NavigationToolbarWx._create_menu | def _create_menu(self):
"""
Creates the 'menu' - implemented as a button which opens a
pop-up menu since wxPython does not allow a menu as a control
"""
DEBUG_MSG("_create_menu()", 1, self)
self._menu = MenuButtonWx(self)
self.AddControl(self._menu)
self.A... | python | def _create_menu(self):
"""
Creates the 'menu' - implemented as a button which opens a
pop-up menu since wxPython does not allow a menu as a control
"""
DEBUG_MSG("_create_menu()", 1, self)
self._menu = MenuButtonWx(self)
self.AddControl(self._menu)
self.A... | [
"def",
"_create_menu",
"(",
"self",
")",
":",
"DEBUG_MSG",
"(",
"\"_create_menu()\"",
",",
"1",
",",
"self",
")",
"self",
".",
"_menu",
"=",
"MenuButtonWx",
"(",
"self",
")",
"self",
".",
"AddControl",
"(",
"self",
".",
"_menu",
")",
"self",
".",
"AddS... | Creates the 'menu' - implemented as a button which opens a
pop-up menu since wxPython does not allow a menu as a control | [
"Creates",
"the",
"menu",
"-",
"implemented",
"as",
"a",
"button",
"which",
"opens",
"a",
"pop",
"-",
"up",
"menu",
"since",
"wxPython",
"does",
"not",
"allow",
"a",
"menu",
"as",
"a",
"control"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1795-L1803 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wx.py | NavigationToolbarWx._create_controls | def _create_controls(self, can_kill):
"""
Creates the button controls, and links them to event handlers
"""
DEBUG_MSG("_create_controls()", 1, self)
# Need the following line as Windows toolbars default to 15x16
self.SetToolBitmapSize(wx.Size(16,16))
self.AddSimp... | python | def _create_controls(self, can_kill):
"""
Creates the button controls, and links them to event handlers
"""
DEBUG_MSG("_create_controls()", 1, self)
# Need the following line as Windows toolbars default to 15x16
self.SetToolBitmapSize(wx.Size(16,16))
self.AddSimp... | [
"def",
"_create_controls",
"(",
"self",
",",
"can_kill",
")",
":",
"DEBUG_MSG",
"(",
"\"_create_controls()\"",
",",
"1",
",",
"self",
")",
"# Need the following line as Windows toolbars default to 15x16",
"self",
".",
"SetToolBitmapSize",
"(",
"wx",
".",
"Size",
"(",
... | Creates the button controls, and links them to event handlers | [
"Creates",
"the",
"button",
"controls",
"and",
"links",
"them",
"to",
"event",
"handlers"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1805-L1847 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/MacOS/backend_wx.py | NavigationToolbarWx.set_active | def set_active(self, ind):
"""
ind is a list of index numbers for the axes which are to be made active
"""
DEBUG_MSG("set_active()", 1, self)
self._ind = ind
if ind != None:
self._active = [ self._axes[i] for i in self._ind ]
else:
self._ac... | python | def set_active(self, ind):
"""
ind is a list of index numbers for the axes which are to be made active
"""
DEBUG_MSG("set_active()", 1, self)
self._ind = ind
if ind != None:
self._active = [ self._axes[i] for i in self._ind ]
else:
self._ac... | [
"def",
"set_active",
"(",
"self",
",",
"ind",
")",
":",
"DEBUG_MSG",
"(",
"\"set_active()\"",
",",
"1",
",",
"self",
")",
"self",
".",
"_ind",
"=",
"ind",
"if",
"ind",
"!=",
"None",
":",
"self",
".",
"_active",
"=",
"[",
"self",
".",
"_axes",
"[",
... | ind is a list of index numbers for the axes which are to be made active | [
"ind",
"is",
"a",
"list",
"of",
"index",
"numbers",
"for",
"the",
"axes",
"which",
"are",
"to",
"be",
"made",
"active"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1849-L1860 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_map/srtm.py | SRTMDownloader.getURIWithRedirect | def getURIWithRedirect(self, url):
'''fetch a URL with redirect handling'''
tries = 0
while tries < 5:
conn = httplib.HTTPConnection(self.server)
conn.request("GET", url)
r1 = conn.getresponse()
if r1.status in [301, 302, 303, 307]:... | python | def getURIWithRedirect(self, url):
'''fetch a URL with redirect handling'''
tries = 0
while tries < 5:
conn = httplib.HTTPConnection(self.server)
conn.request("GET", url)
r1 = conn.getresponse()
if r1.status in [301, 302, 303, 307]:... | [
"def",
"getURIWithRedirect",
"(",
"self",
",",
"url",
")",
":",
"tries",
"=",
"0",
"while",
"tries",
"<",
"5",
":",
"conn",
"=",
"httplib",
".",
"HTTPConnection",
"(",
"self",
".",
"server",
")",
"conn",
".",
"request",
"(",
"\"GET\"",
",",
"url",
")... | fetch a URL with redirect handling | [
"fetch",
"a",
"URL",
"with",
"redirect",
"handling"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/srtm.py#L133-L155 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_rc.py | RCModule.cmd_rc | def cmd_rc(self, args):
'''handle RC value override'''
if len(args) != 2:
print("Usage: rc <channel|all> <pwmvalue>")
return
value = int(args[1])
if value > 65535 or value < -1:
raise ValueError("PWM value must be a positive integer between 0 and 65535... | python | def cmd_rc(self, args):
'''handle RC value override'''
if len(args) != 2:
print("Usage: rc <channel|all> <pwmvalue>")
return
value = int(args[1])
if value > 65535 or value < -1:
raise ValueError("PWM value must be a positive integer between 0 and 65535... | [
"def",
"cmd_rc",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"2",
":",
"print",
"(",
"\"Usage: rc <channel|all> <pwmvalue>\"",
")",
"return",
"value",
"=",
"int",
"(",
"args",
"[",
"1",
"]",
")",
"if",
"value",
">",
"6553... | handle RC value override | [
"handle",
"RC",
"value",
"override"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_rc.py#L86-L106 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/rline.py | complete_variable | def complete_variable(text):
'''complete a MAVLink variable or expression'''
if text == '':
return list(rline_mpstate.status.msgs.keys())
if text.endswith(":2"):
suffix = ":2"
text = text[:-2]
else:
suffix = ''
try:
if mavutil.evaluate_expression(text, rline... | python | def complete_variable(text):
'''complete a MAVLink variable or expression'''
if text == '':
return list(rline_mpstate.status.msgs.keys())
if text.endswith(":2"):
suffix = ":2"
text = text[:-2]
else:
suffix = ''
try:
if mavutil.evaluate_expression(text, rline... | [
"def",
"complete_variable",
"(",
"text",
")",
":",
"if",
"text",
"==",
"''",
":",
"return",
"list",
"(",
"rline_mpstate",
".",
"status",
".",
"msgs",
".",
"keys",
"(",
")",
")",
"if",
"text",
".",
"endswith",
"(",
"\":2\"",
")",
":",
"suffix",
"=",
... | complete a MAVLink variable or expression | [
"complete",
"a",
"MAVLink",
"variable",
"or",
"expression"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/rline.py#L94-L136 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/rline.py | complete_rule | def complete_rule(rule, cmd):
'''complete using one rule'''
global rline_mpstate
rule_components = rule.split(' ')
# complete the empty string (e.g "graph <TAB><TAB>")
if len(cmd) == 0:
return rule_expand(rule_components[0], "")
# check it matches so far
for i in range(len(cmd)-1)... | python | def complete_rule(rule, cmd):
'''complete using one rule'''
global rline_mpstate
rule_components = rule.split(' ')
# complete the empty string (e.g "graph <TAB><TAB>")
if len(cmd) == 0:
return rule_expand(rule_components[0], "")
# check it matches so far
for i in range(len(cmd)-1)... | [
"def",
"complete_rule",
"(",
"rule",
",",
"cmd",
")",
":",
"global",
"rline_mpstate",
"rule_components",
"=",
"rule",
".",
"split",
"(",
"' '",
")",
"# complete the empty string (e.g \"graph <TAB><TAB>\")",
"if",
"len",
"(",
"cmd",
")",
"==",
"0",
":",
"return"... | complete using one rule | [
"complete",
"using",
"one",
"rule"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/rline.py#L156-L172 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createPlotPanel | def createPlotPanel(self):
'''Creates the figure and axes for the plotting panel.'''
self.figure = Figure()
self.axes = self.figure.add_subplot(111)
self.canvas = FigureCanvas(self,-1,self.figure)
self.canvas.SetSize(wx.Size(300,300))
self.axes.axis('off')
self.fi... | python | def createPlotPanel(self):
'''Creates the figure and axes for the plotting panel.'''
self.figure = Figure()
self.axes = self.figure.add_subplot(111)
self.canvas = FigureCanvas(self,-1,self.figure)
self.canvas.SetSize(wx.Size(300,300))
self.axes.axis('off')
self.fi... | [
"def",
"createPlotPanel",
"(",
"self",
")",
":",
"self",
".",
"figure",
"=",
"Figure",
"(",
")",
"self",
".",
"axes",
"=",
"self",
".",
"figure",
".",
"add_subplot",
"(",
"111",
")",
"self",
".",
"canvas",
"=",
"FigureCanvas",
"(",
"self",
",",
"-",
... | Creates the figure and axes for the plotting panel. | [
"Creates",
"the",
"figure",
"and",
"axes",
"for",
"the",
"plotting",
"panel",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L135-L146 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.rescaleX | def rescaleX(self):
'''Rescales the horizontal axes to make the lengthscales equal.'''
self.ratio = self.figure.get_size_inches()[0]/float(self.figure.get_size_inches()[1])
self.axes.set_xlim(-self.ratio,self.ratio)
self.axes.set_ylim(-1,1) | python | def rescaleX(self):
'''Rescales the horizontal axes to make the lengthscales equal.'''
self.ratio = self.figure.get_size_inches()[0]/float(self.figure.get_size_inches()[1])
self.axes.set_xlim(-self.ratio,self.ratio)
self.axes.set_ylim(-1,1) | [
"def",
"rescaleX",
"(",
"self",
")",
":",
"self",
".",
"ratio",
"=",
"self",
".",
"figure",
".",
"get_size_inches",
"(",
")",
"[",
"0",
"]",
"/",
"float",
"(",
"self",
".",
"figure",
".",
"get_size_inches",
"(",
")",
"[",
"1",
"]",
")",
"self",
"... | Rescales the horizontal axes to make the lengthscales equal. | [
"Rescales",
"the",
"horizontal",
"axes",
"to",
"make",
"the",
"lengthscales",
"equal",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L148-L152 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.calcFontScaling | def calcFontScaling(self):
'''Calculates the current font size and left position for the current window.'''
self.ypx = self.figure.get_size_inches()[1]*self.figure.dpi
self.xpx = self.figure.get_size_inches()[0]*self.figure.dpi
self.fontSize = self.vertSize*(self.ypx/2.0)
self.le... | python | def calcFontScaling(self):
'''Calculates the current font size and left position for the current window.'''
self.ypx = self.figure.get_size_inches()[1]*self.figure.dpi
self.xpx = self.figure.get_size_inches()[0]*self.figure.dpi
self.fontSize = self.vertSize*(self.ypx/2.0)
self.le... | [
"def",
"calcFontScaling",
"(",
"self",
")",
":",
"self",
".",
"ypx",
"=",
"self",
".",
"figure",
".",
"get_size_inches",
"(",
")",
"[",
"1",
"]",
"*",
"self",
".",
"figure",
".",
"dpi",
"self",
".",
"xpx",
"=",
"self",
".",
"figure",
".",
"get_size... | Calculates the current font size and left position for the current window. | [
"Calculates",
"the",
"current",
"font",
"size",
"and",
"left",
"position",
"for",
"the",
"current",
"window",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L154-L160 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.checkReszie | def checkReszie(self):
'''Checks if the window was resized.'''
if not self.resized:
oldypx = self.ypx
oldxpx = self.xpx
self.ypx = self.figure.get_size_inches()[1]*self.figure.dpi
self.xpx = self.figure.get_size_inches()[0]*self.figure.dpi
if (... | python | def checkReszie(self):
'''Checks if the window was resized.'''
if not self.resized:
oldypx = self.ypx
oldxpx = self.xpx
self.ypx = self.figure.get_size_inches()[1]*self.figure.dpi
self.xpx = self.figure.get_size_inches()[0]*self.figure.dpi
if (... | [
"def",
"checkReszie",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"resized",
":",
"oldypx",
"=",
"self",
".",
"ypx",
"oldxpx",
"=",
"self",
".",
"xpx",
"self",
".",
"ypx",
"=",
"self",
".",
"figure",
".",
"get_size_inches",
"(",
")",
"[",
"1",... | Checks if the window was resized. | [
"Checks",
"if",
"the",
"window",
"was",
"resized",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L162-L172 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createHeadingPointer | def createHeadingPointer(self):
'''Creates the pointer for the current heading.'''
self.headingTri = patches.RegularPolygon((0.0,0.80),3,0.05,color='k',zorder=4)
self.axes.add_patch(self.headingTri)
self.headingText = self.axes.text(0.0,0.675,'0',color='k',size=self.fontSize,horizontalal... | python | def createHeadingPointer(self):
'''Creates the pointer for the current heading.'''
self.headingTri = patches.RegularPolygon((0.0,0.80),3,0.05,color='k',zorder=4)
self.axes.add_patch(self.headingTri)
self.headingText = self.axes.text(0.0,0.675,'0',color='k',size=self.fontSize,horizontalal... | [
"def",
"createHeadingPointer",
"(",
"self",
")",
":",
"self",
".",
"headingTri",
"=",
"patches",
".",
"RegularPolygon",
"(",
"(",
"0.0",
",",
"0.80",
")",
",",
"3",
",",
"0.05",
",",
"color",
"=",
"'k'",
",",
"zorder",
"=",
"4",
")",
"self",
".",
"... | Creates the pointer for the current heading. | [
"Creates",
"the",
"pointer",
"for",
"the",
"current",
"heading",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L174-L178 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.adjustHeadingPointer | def adjustHeadingPointer(self):
'''Adjust the value of the heading pointer.'''
self.headingText.set_text(str(self.heading))
self.headingText.set_size(self.fontSize) | python | def adjustHeadingPointer(self):
'''Adjust the value of the heading pointer.'''
self.headingText.set_text(str(self.heading))
self.headingText.set_size(self.fontSize) | [
"def",
"adjustHeadingPointer",
"(",
"self",
")",
":",
"self",
".",
"headingText",
".",
"set_text",
"(",
"str",
"(",
"self",
".",
"heading",
")",
")",
"self",
".",
"headingText",
".",
"set_size",
"(",
"self",
".",
"fontSize",
")"
] | Adjust the value of the heading pointer. | [
"Adjust",
"the",
"value",
"of",
"the",
"heading",
"pointer",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L180-L183 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createNorthPointer | def createNorthPointer(self):
'''Creates the north pointer relative to current heading.'''
self.headingNorthTri = patches.RegularPolygon((0.0,0.80),3,0.05,color='k',zorder=4)
self.axes.add_patch(self.headingNorthTri)
self.headingNorthText = self.axes.text(0.0,0.675,'N',color='k',size=sel... | python | def createNorthPointer(self):
'''Creates the north pointer relative to current heading.'''
self.headingNorthTri = patches.RegularPolygon((0.0,0.80),3,0.05,color='k',zorder=4)
self.axes.add_patch(self.headingNorthTri)
self.headingNorthText = self.axes.text(0.0,0.675,'N',color='k',size=sel... | [
"def",
"createNorthPointer",
"(",
"self",
")",
":",
"self",
".",
"headingNorthTri",
"=",
"patches",
".",
"RegularPolygon",
"(",
"(",
"0.0",
",",
"0.80",
")",
",",
"3",
",",
"0.05",
",",
"color",
"=",
"'k'",
",",
"zorder",
"=",
"4",
")",
"self",
".",
... | Creates the north pointer relative to current heading. | [
"Creates",
"the",
"north",
"pointer",
"relative",
"to",
"current",
"heading",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L185-L189 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.adjustNorthPointer | def adjustNorthPointer(self):
'''Adjust the position and orientation of
the north pointer.'''
self.headingNorthText.set_size(self.fontSize)
headingRotate = mpl.transforms.Affine2D().rotate_deg_around(0.0,0.0,self.heading)+self.axes.transData
self.headingNorthText.set_transform(h... | python | def adjustNorthPointer(self):
'''Adjust the position and orientation of
the north pointer.'''
self.headingNorthText.set_size(self.fontSize)
headingRotate = mpl.transforms.Affine2D().rotate_deg_around(0.0,0.0,self.heading)+self.axes.transData
self.headingNorthText.set_transform(h... | [
"def",
"adjustNorthPointer",
"(",
"self",
")",
":",
"self",
".",
"headingNorthText",
".",
"set_size",
"(",
"self",
".",
"fontSize",
")",
"headingRotate",
"=",
"mpl",
".",
"transforms",
".",
"Affine2D",
"(",
")",
".",
"rotate_deg_around",
"(",
"0.0",
",",
"... | Adjust the position and orientation of
the north pointer. | [
"Adjust",
"the",
"position",
"and",
"orientation",
"of",
"the",
"north",
"pointer",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L191-L207 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createRPYText | def createRPYText(self):
'''Creates the text for roll, pitch and yaw.'''
self.rollText = self.axes.text(self.leftPos+(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0),'Roll: %.2f' % self.roll,color='w',size=self.fontSize)
self.pitchText = self.axes.text(self.leftPos+(self.vertS... | python | def createRPYText(self):
'''Creates the text for roll, pitch and yaw.'''
self.rollText = self.axes.text(self.leftPos+(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0),'Roll: %.2f' % self.roll,color='w',size=self.fontSize)
self.pitchText = self.axes.text(self.leftPos+(self.vertS... | [
"def",
"createRPYText",
"(",
"self",
")",
":",
"self",
".",
"rollText",
"=",
"self",
".",
"axes",
".",
"text",
"(",
"self",
".",
"leftPos",
"+",
"(",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"-",
"0.97",
"+",
"(",
"2",
"*",
"self",
".",
... | Creates the text for roll, pitch and yaw. | [
"Creates",
"the",
"text",
"for",
"roll",
"pitch",
"and",
"yaw",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L217-L224 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.updateRPYLocations | def updateRPYLocations(self):
'''Update the locations of roll, pitch, yaw text.'''
# Locations
self.rollText.set_position((self.leftPos+(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0)))
self.pitchText.set_position((self.leftPos+(self.vertSize/10.0),-0.97+self.vertSize-(... | python | def updateRPYLocations(self):
'''Update the locations of roll, pitch, yaw text.'''
# Locations
self.rollText.set_position((self.leftPos+(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0)))
self.pitchText.set_position((self.leftPos+(self.vertSize/10.0),-0.97+self.vertSize-(... | [
"def",
"updateRPYLocations",
"(",
"self",
")",
":",
"# Locations",
"self",
".",
"rollText",
".",
"set_position",
"(",
"(",
"self",
".",
"leftPos",
"+",
"(",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"-",
"0.97",
"+",
"(",
"2",
"*",
"self",
".",... | Update the locations of roll, pitch, yaw text. | [
"Update",
"the",
"locations",
"of",
"roll",
"pitch",
"yaw",
"text",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L226-L235 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.updateRPYText | def updateRPYText(self):
'Updates the displayed Roll, Pitch, Yaw Text'
self.rollText.set_text('Roll: %.2f' % self.roll)
self.pitchText.set_text('Pitch: %.2f' % self.pitch)
self.yawText.set_text('Yaw: %.2f' % self.yaw) | python | def updateRPYText(self):
'Updates the displayed Roll, Pitch, Yaw Text'
self.rollText.set_text('Roll: %.2f' % self.roll)
self.pitchText.set_text('Pitch: %.2f' % self.pitch)
self.yawText.set_text('Yaw: %.2f' % self.yaw) | [
"def",
"updateRPYText",
"(",
"self",
")",
":",
"self",
".",
"rollText",
".",
"set_text",
"(",
"'Roll: %.2f'",
"%",
"self",
".",
"roll",
")",
"self",
".",
"pitchText",
".",
"set_text",
"(",
"'Pitch: %.2f'",
"%",
"self",
".",
"pitch",
")",
"self",
".",
... | Updates the displayed Roll, Pitch, Yaw Text | [
"Updates",
"the",
"displayed",
"Roll",
"Pitch",
"Yaw",
"Text"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L237-L241 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createCenterPointMarker | def createCenterPointMarker(self):
'''Creates the center pointer in the middle of the screen.'''
self.axes.add_patch(patches.Rectangle((-0.75,-self.thick),0.5,2.0*self.thick,facecolor='orange',zorder=3))
self.axes.add_patch(patches.Rectangle((0.25,-self.thick),0.5,2.0*self.thick,facecolor='orang... | python | def createCenterPointMarker(self):
'''Creates the center pointer in the middle of the screen.'''
self.axes.add_patch(patches.Rectangle((-0.75,-self.thick),0.5,2.0*self.thick,facecolor='orange',zorder=3))
self.axes.add_patch(patches.Rectangle((0.25,-self.thick),0.5,2.0*self.thick,facecolor='orang... | [
"def",
"createCenterPointMarker",
"(",
"self",
")",
":",
"self",
".",
"axes",
".",
"add_patch",
"(",
"patches",
".",
"Rectangle",
"(",
"(",
"-",
"0.75",
",",
"-",
"self",
".",
"thick",
")",
",",
"0.5",
",",
"2.0",
"*",
"self",
".",
"thick",
",",
"f... | Creates the center pointer in the middle of the screen. | [
"Creates",
"the",
"center",
"pointer",
"in",
"the",
"middle",
"of",
"the",
"screen",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L243-L247 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createHorizonPolygons | def createHorizonPolygons(self):
'''Creates the two polygons to show the sky and ground.'''
# Sky Polygon
vertsTop = [[-1,0],[-1,1],[1,1],[1,0],[-1,0]]
self.topPolygon = Polygon(vertsTop,facecolor='dodgerblue',edgecolor='none')
self.axes.add_patch(self.topPolygon)
# Groun... | python | def createHorizonPolygons(self):
'''Creates the two polygons to show the sky and ground.'''
# Sky Polygon
vertsTop = [[-1,0],[-1,1],[1,1],[1,0],[-1,0]]
self.topPolygon = Polygon(vertsTop,facecolor='dodgerblue',edgecolor='none')
self.axes.add_patch(self.topPolygon)
# Groun... | [
"def",
"createHorizonPolygons",
"(",
"self",
")",
":",
"# Sky Polygon",
"vertsTop",
"=",
"[",
"[",
"-",
"1",
",",
"0",
"]",
",",
"[",
"-",
"1",
",",
"1",
"]",
",",
"[",
"1",
",",
"1",
"]",
",",
"[",
"1",
",",
"0",
"]",
",",
"[",
"-",
"1",
... | Creates the two polygons to show the sky and ground. | [
"Creates",
"the",
"two",
"polygons",
"to",
"show",
"the",
"sky",
"and",
"ground",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L249-L258 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.calcHorizonPoints | def calcHorizonPoints(self):
'''Updates the verticies of the patches for the ground and sky.'''
ydiff = math.tan(math.radians(-self.roll))*float(self.ratio)
pitchdiff = self.dist10deg*(self.pitch/10.0)
# Sky Polygon
vertsTop = [(-self.ratio,ydiff-pitchdiff),(-self.ratio,1),(self.... | python | def calcHorizonPoints(self):
'''Updates the verticies of the patches for the ground and sky.'''
ydiff = math.tan(math.radians(-self.roll))*float(self.ratio)
pitchdiff = self.dist10deg*(self.pitch/10.0)
# Sky Polygon
vertsTop = [(-self.ratio,ydiff-pitchdiff),(-self.ratio,1),(self.... | [
"def",
"calcHorizonPoints",
"(",
"self",
")",
":",
"ydiff",
"=",
"math",
".",
"tan",
"(",
"math",
".",
"radians",
"(",
"-",
"self",
".",
"roll",
")",
")",
"*",
"float",
"(",
"self",
".",
"ratio",
")",
"pitchdiff",
"=",
"self",
".",
"dist10deg",
"*"... | Updates the verticies of the patches for the ground and sky. | [
"Updates",
"the",
"verticies",
"of",
"the",
"patches",
"for",
"the",
"ground",
"and",
"sky",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L260-L269 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createPitchMarkers | def createPitchMarkers(self):
'''Creates the rectangle patches for the pitch indicators.'''
self.pitchPatches = []
# Major Lines (multiple of 10 deg)
for i in [-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9]:
width = self.calcPitchMarkerWidth(i)
currPatch = patche... | python | def createPitchMarkers(self):
'''Creates the rectangle patches for the pitch indicators.'''
self.pitchPatches = []
# Major Lines (multiple of 10 deg)
for i in [-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9]:
width = self.calcPitchMarkerWidth(i)
currPatch = patche... | [
"def",
"createPitchMarkers",
"(",
"self",
")",
":",
"self",
".",
"pitchPatches",
"=",
"[",
"]",
"# Major Lines (multiple of 10 deg)",
"for",
"i",
"in",
"[",
"-",
"9",
",",
"-",
"8",
",",
"-",
"7",
",",
"-",
"6",
",",
"-",
"5",
",",
"-",
"4",
",",
... | Creates the rectangle patches for the pitch indicators. | [
"Creates",
"the",
"rectangle",
"patches",
"for",
"the",
"pitch",
"indicators",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L271-L290 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.adjustPitchmarkers | def adjustPitchmarkers(self):
'''Adjusts the location and orientation of pitch markers.'''
pitchdiff = self.dist10deg*(self.pitch/10.0)
rollRotate = mpl.transforms.Affine2D().rotate_deg_around(0.0,-pitchdiff,self.roll)+self.axes.transData
j=0
for i in [-9,-8,-7,-6,-5,-4,-3,-2,-1,... | python | def adjustPitchmarkers(self):
'''Adjusts the location and orientation of pitch markers.'''
pitchdiff = self.dist10deg*(self.pitch/10.0)
rollRotate = mpl.transforms.Affine2D().rotate_deg_around(0.0,-pitchdiff,self.roll)+self.axes.transData
j=0
for i in [-9,-8,-7,-6,-5,-4,-3,-2,-1,... | [
"def",
"adjustPitchmarkers",
"(",
"self",
")",
":",
"pitchdiff",
"=",
"self",
".",
"dist10deg",
"*",
"(",
"self",
".",
"pitch",
"/",
"10.0",
")",
"rollRotate",
"=",
"mpl",
".",
"transforms",
".",
"Affine2D",
"(",
")",
".",
"rotate_deg_around",
"(",
"0.0"... | Adjusts the location and orientation of pitch markers. | [
"Adjusts",
"the",
"location",
"and",
"orientation",
"of",
"pitch",
"markers",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L304-L325 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createAARText | def createAARText(self):
'''Creates the text for airspeed, altitude and climb rate.'''
self.airspeedText = self.axes.text(self.rightPos-(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0),'AS: %.1f m/s' % self.airspeed,color='w',size=self.fontSize,ha='right')
self.altitudeText = ... | python | def createAARText(self):
'''Creates the text for airspeed, altitude and climb rate.'''
self.airspeedText = self.axes.text(self.rightPos-(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0),'AS: %.1f m/s' % self.airspeed,color='w',size=self.fontSize,ha='right')
self.altitudeText = ... | [
"def",
"createAARText",
"(",
"self",
")",
":",
"self",
".",
"airspeedText",
"=",
"self",
".",
"axes",
".",
"text",
"(",
"self",
".",
"rightPos",
"-",
"(",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"-",
"0.97",
"+",
"(",
"2",
"*",
"self",
".... | Creates the text for airspeed, altitude and climb rate. | [
"Creates",
"the",
"text",
"for",
"airspeed",
"altitude",
"and",
"climb",
"rate",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L327-L334 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.updateAARLocations | def updateAARLocations(self):
'''Update the locations of airspeed, altitude and Climb rate.'''
# Locations
self.airspeedText.set_position((self.rightPos-(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0)))
self.altitudeText.set_position((self.rightPos-(self.vertSize/10.0),... | python | def updateAARLocations(self):
'''Update the locations of airspeed, altitude and Climb rate.'''
# Locations
self.airspeedText.set_position((self.rightPos-(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0)))
self.altitudeText.set_position((self.rightPos-(self.vertSize/10.0),... | [
"def",
"updateAARLocations",
"(",
"self",
")",
":",
"# Locations",
"self",
".",
"airspeedText",
".",
"set_position",
"(",
"(",
"self",
".",
"rightPos",
"-",
"(",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"-",
"0.97",
"+",
"(",
"2",
"*",
"self",
... | Update the locations of airspeed, altitude and Climb rate. | [
"Update",
"the",
"locations",
"of",
"airspeed",
"altitude",
"and",
"Climb",
"rate",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L336-L345 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.updateAARText | def updateAARText(self):
'Updates the displayed airspeed, altitude, climb rate Text'
self.airspeedText.set_text('AR: %.1f m/s' % self.airspeed)
self.altitudeText.set_text('ALT: %.1f m ' % self.relAlt)
self.climbRateText.set_text('CR: %.1f m/s' % self.climbRate) | python | def updateAARText(self):
'Updates the displayed airspeed, altitude, climb rate Text'
self.airspeedText.set_text('AR: %.1f m/s' % self.airspeed)
self.altitudeText.set_text('ALT: %.1f m ' % self.relAlt)
self.climbRateText.set_text('CR: %.1f m/s' % self.climbRate) | [
"def",
"updateAARText",
"(",
"self",
")",
":",
"self",
".",
"airspeedText",
".",
"set_text",
"(",
"'AR: %.1f m/s'",
"%",
"self",
".",
"airspeed",
")",
"self",
".",
"altitudeText",
".",
"set_text",
"(",
"'ALT: %.1f m '",
"%",
"self",
".",
"relAlt",
")",
... | Updates the displayed airspeed, altitude, climb rate Text | [
"Updates",
"the",
"displayed",
"airspeed",
"altitude",
"climb",
"rate",
"Text"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L347-L351 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createBatteryBar | def createBatteryBar(self):
'''Creates the bar to display current battery percentage.'''
self.batOutRec = patches.Rectangle((self.rightPos-(1.3+self.rOffset)*self.batWidth,1.0-(0.1+1.0+(2*0.075))*self.batHeight),self.batWidth*1.3,self.batHeight*1.15,facecolor='darkgrey',edgecolor='none')
self.ba... | python | def createBatteryBar(self):
'''Creates the bar to display current battery percentage.'''
self.batOutRec = patches.Rectangle((self.rightPos-(1.3+self.rOffset)*self.batWidth,1.0-(0.1+1.0+(2*0.075))*self.batHeight),self.batWidth*1.3,self.batHeight*1.15,facecolor='darkgrey',edgecolor='none')
self.ba... | [
"def",
"createBatteryBar",
"(",
"self",
")",
":",
"self",
".",
"batOutRec",
"=",
"patches",
".",
"Rectangle",
"(",
"(",
"self",
".",
"rightPos",
"-",
"(",
"1.3",
"+",
"self",
".",
"rOffset",
")",
"*",
"self",
".",
"batWidth",
",",
"1.0",
"-",
"(",
... | Creates the bar to display current battery percentage. | [
"Creates",
"the",
"bar",
"to",
"display",
"current",
"battery",
"percentage",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L353-L365 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.updateBatteryBar | def updateBatteryBar(self):
'''Updates the position and values of the battery bar.'''
# Bar
self.batOutRec.set_xy((self.rightPos-(1.3+self.rOffset)*self.batWidth,1.0-(0.1+1.0+(2*0.075))*self.batHeight))
self.batInRec.set_xy((self.rightPos-(self.rOffset+1+0.15)*self.batWidth,1.0-(0.1+1+0.... | python | def updateBatteryBar(self):
'''Updates the position and values of the battery bar.'''
# Bar
self.batOutRec.set_xy((self.rightPos-(1.3+self.rOffset)*self.batWidth,1.0-(0.1+1.0+(2*0.075))*self.batHeight))
self.batInRec.set_xy((self.rightPos-(self.rOffset+1+0.15)*self.batWidth,1.0-(0.1+1+0.... | [
"def",
"updateBatteryBar",
"(",
"self",
")",
":",
"# Bar",
"self",
".",
"batOutRec",
".",
"set_xy",
"(",
"(",
"self",
".",
"rightPos",
"-",
"(",
"1.3",
"+",
"self",
".",
"rOffset",
")",
"*",
"self",
".",
"batWidth",
",",
"1.0",
"-",
"(",
"0.1",
"+"... | Updates the position and values of the battery bar. | [
"Updates",
"the",
"position",
"and",
"values",
"of",
"the",
"battery",
"bar",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L367-L391 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createStateText | def createStateText(self):
'''Creates the mode and arm state text.'''
self.modeText = self.axes.text(self.leftPos+(self.vertSize/10.0),0.97,'UNKNOWN',color='grey',size=1.5*self.fontSize,ha='left',va='top')
self.modeText.set_path_effects([PathEffects.withStroke(linewidth=self.fontSize/10.0,foregr... | python | def createStateText(self):
'''Creates the mode and arm state text.'''
self.modeText = self.axes.text(self.leftPos+(self.vertSize/10.0),0.97,'UNKNOWN',color='grey',size=1.5*self.fontSize,ha='left',va='top')
self.modeText.set_path_effects([PathEffects.withStroke(linewidth=self.fontSize/10.0,foregr... | [
"def",
"createStateText",
"(",
"self",
")",
":",
"self",
".",
"modeText",
"=",
"self",
".",
"axes",
".",
"text",
"(",
"self",
".",
"leftPos",
"+",
"(",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"0.97",
",",
"'UNKNOWN'",
",",
"color",
"=",
"'g... | Creates the mode and arm state text. | [
"Creates",
"the",
"mode",
"and",
"arm",
"state",
"text",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L393-L396 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.updateStateText | def updateStateText(self):
'''Updates the mode and colours red or green depending on arm state.'''
self.modeText.set_position((self.leftPos+(self.vertSize/10.0),0.97))
self.modeText.set_text(self.mode)
self.modeText.set_size(1.5*self.fontSize)
if self.armed:
self.mode... | python | def updateStateText(self):
'''Updates the mode and colours red or green depending on arm state.'''
self.modeText.set_position((self.leftPos+(self.vertSize/10.0),0.97))
self.modeText.set_text(self.mode)
self.modeText.set_size(1.5*self.fontSize)
if self.armed:
self.mode... | [
"def",
"updateStateText",
"(",
"self",
")",
":",
"self",
".",
"modeText",
".",
"set_position",
"(",
"(",
"self",
".",
"leftPos",
"+",
"(",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"0.97",
")",
")",
"self",
".",
"modeText",
".",
"set_text",
"("... | Updates the mode and colours red or green depending on arm state. | [
"Updates",
"the",
"mode",
"and",
"colours",
"red",
"or",
"green",
"depending",
"on",
"arm",
"state",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L398-L414 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createWPText | def createWPText(self):
'''Creates the text for the current and final waypoint,
and the distance to the new waypoint.'''
self.wpText = self.axes.text(self.leftPos+(1.5*self.vertSize/10.0),0.97-(1.5*self.vertSize)+(0.5*self.vertSize/10.0),'0/0\n(0 m, 0 s)',color='w',size=self.fontSize,ha='left',v... | python | def createWPText(self):
'''Creates the text for the current and final waypoint,
and the distance to the new waypoint.'''
self.wpText = self.axes.text(self.leftPos+(1.5*self.vertSize/10.0),0.97-(1.5*self.vertSize)+(0.5*self.vertSize/10.0),'0/0\n(0 m, 0 s)',color='w',size=self.fontSize,ha='left',v... | [
"def",
"createWPText",
"(",
"self",
")",
":",
"self",
".",
"wpText",
"=",
"self",
".",
"axes",
".",
"text",
"(",
"self",
".",
"leftPos",
"+",
"(",
"1.5",
"*",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"0.97",
"-",
"(",
"1.5",
"*",
"self",
... | Creates the text for the current and final waypoint,
and the distance to the new waypoint. | [
"Creates",
"the",
"text",
"for",
"the",
"current",
"and",
"final",
"waypoint",
"and",
"the",
"distance",
"to",
"the",
"new",
"waypoint",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L416-L420 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.updateWPText | def updateWPText(self):
'''Updates the current waypoint and distance to it.'''
self.wpText.set_position((self.leftPos+(1.5*self.vertSize/10.0),0.97-(1.5*self.vertSize)+(0.5*self.vertSize/10.0)))
self.wpText.set_size(self.fontSize)
if type(self.nextWPTime) is str:
self.wpText... | python | def updateWPText(self):
'''Updates the current waypoint and distance to it.'''
self.wpText.set_position((self.leftPos+(1.5*self.vertSize/10.0),0.97-(1.5*self.vertSize)+(0.5*self.vertSize/10.0)))
self.wpText.set_size(self.fontSize)
if type(self.nextWPTime) is str:
self.wpText... | [
"def",
"updateWPText",
"(",
"self",
")",
":",
"self",
".",
"wpText",
".",
"set_position",
"(",
"(",
"self",
".",
"leftPos",
"+",
"(",
"1.5",
"*",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"0.97",
"-",
"(",
"1.5",
"*",
"self",
".",
"vertSize",... | Updates the current waypoint and distance to it. | [
"Updates",
"the",
"current",
"waypoint",
"and",
"distance",
"to",
"it",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L422-L429 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createWPPointer | def createWPPointer(self):
'''Creates the waypoint pointer relative to current heading.'''
self.headingWPTri = patches.RegularPolygon((0.0,0.55),3,0.05,facecolor='lime',zorder=4,ec='k')
self.axes.add_patch(self.headingWPTri)
self.headingWPText = self.axes.text(0.0,0.45,'1',color='lime',s... | python | def createWPPointer(self):
'''Creates the waypoint pointer relative to current heading.'''
self.headingWPTri = patches.RegularPolygon((0.0,0.55),3,0.05,facecolor='lime',zorder=4,ec='k')
self.axes.add_patch(self.headingWPTri)
self.headingWPText = self.axes.text(0.0,0.45,'1',color='lime',s... | [
"def",
"createWPPointer",
"(",
"self",
")",
":",
"self",
".",
"headingWPTri",
"=",
"patches",
".",
"RegularPolygon",
"(",
"(",
"0.0",
",",
"0.55",
")",
",",
"3",
",",
"0.05",
",",
"facecolor",
"=",
"'lime'",
",",
"zorder",
"=",
"4",
",",
"ec",
"=",
... | Creates the waypoint pointer relative to current heading. | [
"Creates",
"the",
"waypoint",
"pointer",
"relative",
"to",
"current",
"heading",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L431-L436 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.adjustWPPointer | def adjustWPPointer(self):
'''Adjust the position and orientation of
the waypoint pointer.'''
self.headingWPText.set_size(self.fontSize)
headingRotate = mpl.transforms.Affine2D().rotate_deg_around(0.0,0.0,-self.wpBearing+self.heading)+self.axes.transData
self.headingWPText.set_t... | python | def adjustWPPointer(self):
'''Adjust the position and orientation of
the waypoint pointer.'''
self.headingWPText.set_size(self.fontSize)
headingRotate = mpl.transforms.Affine2D().rotate_deg_around(0.0,0.0,-self.wpBearing+self.heading)+self.axes.transData
self.headingWPText.set_t... | [
"def",
"adjustWPPointer",
"(",
"self",
")",
":",
"self",
".",
"headingWPText",
".",
"set_size",
"(",
"self",
".",
"fontSize",
")",
"headingRotate",
"=",
"mpl",
".",
"transforms",
".",
"Affine2D",
"(",
")",
".",
"rotate_deg_around",
"(",
"0.0",
",",
"0.0",
... | Adjust the position and orientation of
the waypoint pointer. | [
"Adjust",
"the",
"position",
"and",
"orientation",
"of",
"the",
"waypoint",
"pointer",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L438-L453 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.createAltHistoryPlot | def createAltHistoryPlot(self):
'''Creates the altitude history plot.'''
self.altHistRect = patches.Rectangle((self.leftPos+(self.vertSize/10.0),-0.25),0.5,0.5,facecolor='grey',edgecolor='none',alpha=0.4,zorder=4)
self.axes.add_patch(self.altHistRect)
self.altPlot, = self.axes.plot([self... | python | def createAltHistoryPlot(self):
'''Creates the altitude history plot.'''
self.altHistRect = patches.Rectangle((self.leftPos+(self.vertSize/10.0),-0.25),0.5,0.5,facecolor='grey',edgecolor='none',alpha=0.4,zorder=4)
self.axes.add_patch(self.altHistRect)
self.altPlot, = self.axes.plot([self... | [
"def",
"createAltHistoryPlot",
"(",
"self",
")",
":",
"self",
".",
"altHistRect",
"=",
"patches",
".",
"Rectangle",
"(",
"(",
"self",
".",
"leftPos",
"+",
"(",
"self",
".",
"vertSize",
"/",
"10.0",
")",
",",
"-",
"0.25",
")",
",",
"0.5",
",",
"0.5",
... | Creates the altitude history plot. | [
"Creates",
"the",
"altitude",
"history",
"plot",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L455-L461 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.updateAltHistory | def updateAltHistory(self):
'''Updates the altitude history plot.'''
self.altHist.append(self.relAlt)
self.timeHist.append(self.relAltTime)
# Delete entries older than x seconds
histLim = 10
currentTime = time.time()
point = 0
for i in range(0,len... | python | def updateAltHistory(self):
'''Updates the altitude history plot.'''
self.altHist.append(self.relAlt)
self.timeHist.append(self.relAltTime)
# Delete entries older than x seconds
histLim = 10
currentTime = time.time()
point = 0
for i in range(0,len... | [
"def",
"updateAltHistory",
"(",
"self",
")",
":",
"self",
".",
"altHist",
".",
"append",
"(",
"self",
".",
"relAlt",
")",
"self",
".",
"timeHist",
".",
"append",
"(",
"self",
".",
"relAltTime",
")",
"# Delete entries older than x seconds",
"histLim",
"=",
"1... | Updates the altitude history plot. | [
"Updates",
"the",
"altitude",
"history",
"plot",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L463-L517 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.on_idle | def on_idle(self, event):
'''To adjust text and positions on rescaling the window when resized.'''
# Check for resize
self.checkReszie()
if self.resized:
# Fix Window Scales
self.rescaleX()
self.calcFontScaling()
# Re... | python | def on_idle(self, event):
'''To adjust text and positions on rescaling the window when resized.'''
# Check for resize
self.checkReszie()
if self.resized:
# Fix Window Scales
self.rescaleX()
self.calcFontScaling()
# Re... | [
"def",
"on_idle",
"(",
"self",
",",
"event",
")",
":",
"# Check for resize",
"self",
".",
"checkReszie",
"(",
")",
"if",
"self",
".",
"resized",
":",
"# Fix Window Scales ",
"self",
".",
"rescaleX",
"(",
")",
"self",
".",
"calcFontScaling",
"(",
")",
"# Re... | To adjust text and positions on rescaling the window when resized. | [
"To",
"adjust",
"text",
"and",
"positions",
"on",
"rescaling",
"the",
"window",
"when",
"resized",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L520-L567 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.on_timer | def on_timer(self, event):
'''Main Loop.'''
state = self.state
self.loopStartTime = time.time()
if state.close_event.wait(0.001):
self.timer.Stop()
self.Destroy()
return
# Check for resizing
self.checkReszie()
if self.r... | python | def on_timer(self, event):
'''Main Loop.'''
state = self.state
self.loopStartTime = time.time()
if state.close_event.wait(0.001):
self.timer.Stop()
self.Destroy()
return
# Check for resizing
self.checkReszie()
if self.r... | [
"def",
"on_timer",
"(",
"self",
",",
"event",
")",
":",
"state",
"=",
"self",
".",
"state",
"self",
".",
"loopStartTime",
"=",
"time",
".",
"time",
"(",
")",
"if",
"state",
".",
"close_event",
".",
"wait",
"(",
"0.001",
")",
":",
"self",
".",
"time... | Main Loop. | [
"Main",
"Loop",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L569-L675 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/wxhorizon_ui.py | HorizonFrame.on_KeyPress | def on_KeyPress(self,event):
'''To adjust the distance between pitch markers.'''
if event.GetKeyCode() == wx.WXK_UP:
self.dist10deg += 0.1
print('Dist per 10 deg: %.1f' % self.dist10deg)
elif event.GetKeyCode() == wx.WXK_DOWN:
self.dist10deg -= 0.1
... | python | def on_KeyPress(self,event):
'''To adjust the distance between pitch markers.'''
if event.GetKeyCode() == wx.WXK_UP:
self.dist10deg += 0.1
print('Dist per 10 deg: %.1f' % self.dist10deg)
elif event.GetKeyCode() == wx.WXK_DOWN:
self.dist10deg -= 0.1
... | [
"def",
"on_KeyPress",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"GetKeyCode",
"(",
")",
"==",
"wx",
".",
"WXK_UP",
":",
"self",
".",
"dist10deg",
"+=",
"0.1",
"print",
"(",
"'Dist per 10 deg: %.1f'",
"%",
"self",
".",
"dist10deg",
")",
"... | To adjust the distance between pitch markers. | [
"To",
"adjust",
"the",
"distance",
"between",
"pitch",
"markers",
"."
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L677-L712 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_fence.py | FenceModule.fenceloader | def fenceloader(self):
'''fence loader by sysid'''
if not self.target_system in self.fenceloader_by_sysid:
self.fenceloader_by_sysid[self.target_system] = mavwp.MAVFenceLoader()
return self.fenceloader_by_sysid[self.target_system] | python | def fenceloader(self):
'''fence loader by sysid'''
if not self.target_system in self.fenceloader_by_sysid:
self.fenceloader_by_sysid[self.target_system] = mavwp.MAVFenceLoader()
return self.fenceloader_by_sysid[self.target_system] | [
"def",
"fenceloader",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"target_system",
"in",
"self",
".",
"fenceloader_by_sysid",
":",
"self",
".",
"fenceloader_by_sysid",
"[",
"self",
".",
"target_system",
"]",
"=",
"mavwp",
".",
"MAVFenceLoader",
"(",
")"... | fence loader by sysid | [
"fence",
"loader",
"by",
"sysid"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_fence.py#L51-L55 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_fence.py | FenceModule.mavlink_packet | def mavlink_packet(self, m):
'''handle and incoming mavlink packet'''
if m.get_type() == "FENCE_STATUS":
self.last_fence_breach = m.breach_time
self.last_fence_status = m.breach_status
elif m.get_type() in ['SYS_STATUS']:
bits = mavutil.mavlink.MAV_SYS_STATUS_... | python | def mavlink_packet(self, m):
'''handle and incoming mavlink packet'''
if m.get_type() == "FENCE_STATUS":
self.last_fence_breach = m.breach_time
self.last_fence_status = m.breach_status
elif m.get_type() in ['SYS_STATUS']:
bits = mavutil.mavlink.MAV_SYS_STATUS_... | [
"def",
"mavlink_packet",
"(",
"self",
",",
"m",
")",
":",
"if",
"m",
".",
"get_type",
"(",
")",
"==",
"\"FENCE_STATUS\"",
":",
"self",
".",
"last_fence_breach",
"=",
"m",
".",
"breach_time",
"self",
".",
"last_fence_status",
"=",
"m",
".",
"breach_status",... | handle and incoming mavlink packet | [
"handle",
"and",
"incoming",
"mavlink",
"packet"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_fence.py#L66-L103 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_fence.py | FenceModule.load_fence | def load_fence(self, filename):
'''load fence points from a file'''
try:
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
self.fenceloader.load(filename.strip('"'))
except Exception as msg:
... | python | def load_fence(self, filename):
'''load fence points from a file'''
try:
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
self.fenceloader.load(filename.strip('"'))
except Exception as msg:
... | [
"def",
"load_fence",
"(",
"self",
",",
"filename",
")",
":",
"try",
":",
"self",
".",
"fenceloader",
".",
"target_system",
"=",
"self",
".",
"target_system",
"self",
".",
"fenceloader",
".",
"target_component",
"=",
"self",
".",
"target_component",
"self",
"... | load fence points from a file | [
"load",
"fence",
"points",
"from",
"a",
"file"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_fence.py#L205-L215 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_fence.py | FenceModule.list_fence | def list_fence(self, filename):
'''list fence points, optionally saving to a file'''
self.fenceloader.clear()
count = self.get_mav_param('FENCE_TOTAL', 0)
if count == 0:
print("No geo-fence points")
return
for i in range(int(count)):
p = self.f... | python | def list_fence(self, filename):
'''list fence points, optionally saving to a file'''
self.fenceloader.clear()
count = self.get_mav_param('FENCE_TOTAL', 0)
if count == 0:
print("No geo-fence points")
return
for i in range(int(count)):
p = self.f... | [
"def",
"list_fence",
"(",
"self",
",",
"filename",
")",
":",
"self",
".",
"fenceloader",
".",
"clear",
"(",
")",
"count",
"=",
"self",
".",
"get_mav_param",
"(",
"'FENCE_TOTAL'",
",",
"0",
")",
"if",
"count",
"==",
"0",
":",
"print",
"(",
"\"No geo-fen... | list fence points, optionally saving to a file | [
"list",
"fence",
"points",
"optionally",
"saving",
"to",
"a",
"file"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_fence.py#L277-L308 | train |
ArduPilot/MAVProxy | MAVProxy/modules/lib/mp_image.py | MPImage.poll | def poll(self):
'''check for events, returning one event'''
if self.out_queue.qsize() <= 0:
return None
evt = self.out_queue.get()
while isinstance(evt, win_layout.WinLayout):
win_layout.set_layout(evt, self.set_layout)
if self.out_queue.qsize() == 0:
... | python | def poll(self):
'''check for events, returning one event'''
if self.out_queue.qsize() <= 0:
return None
evt = self.out_queue.get()
while isinstance(evt, win_layout.WinLayout):
win_layout.set_layout(evt, self.set_layout)
if self.out_queue.qsize() == 0:
... | [
"def",
"poll",
"(",
"self",
")",
":",
"if",
"self",
".",
"out_queue",
".",
"qsize",
"(",
")",
"<=",
"0",
":",
"return",
"None",
"evt",
"=",
"self",
".",
"out_queue",
".",
"get",
"(",
")",
"while",
"isinstance",
"(",
"evt",
",",
"win_layout",
".",
... | check for events, returning one event | [
"check",
"for",
"events",
"returning",
"one",
"event"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/mp_image.py#L172-L182 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapFrame.find_object | def find_object(self, key, layers):
'''find an object to be modified'''
state = self.state
if layers is None or layers == '':
layers = state.layers.keys()
for layer in layers:
if key in state.layers[layer]:
return state.layers[layer][key]
... | python | def find_object(self, key, layers):
'''find an object to be modified'''
state = self.state
if layers is None or layers == '':
layers = state.layers.keys()
for layer in layers:
if key in state.layers[layer]:
return state.layers[layer][key]
... | [
"def",
"find_object",
"(",
"self",
",",
"key",
",",
"layers",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"layers",
"is",
"None",
"or",
"layers",
"==",
"''",
":",
"layers",
"=",
"state",
".",
"layers",
".",
"keys",
"(",
")",
"for",
"layer",... | find an object to be modified | [
"find",
"an",
"object",
"to",
"be",
"modified"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L140-L149 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapFrame.add_object | def add_object(self, obj):
'''add an object to a layer'''
state = self.state
if not obj.layer in state.layers:
# its a new layer
state.layers[obj.layer] = {}
state.layers[obj.layer][obj.key] = obj
state.need_redraw = True
if (not self.legend_checkb... | python | def add_object(self, obj):
'''add an object to a layer'''
state = self.state
if not obj.layer in state.layers:
# its a new layer
state.layers[obj.layer] = {}
state.layers[obj.layer][obj.key] = obj
state.need_redraw = True
if (not self.legend_checkb... | [
"def",
"add_object",
"(",
"self",
",",
"obj",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"not",
"obj",
".",
"layer",
"in",
"state",
".",
"layers",
":",
"# its a new layer",
"state",
".",
"layers",
"[",
"obj",
".",
"layer",
"]",
"=",
"{",
"... | add an object to a layer | [
"add",
"an",
"object",
"to",
"a",
"layer"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L177-L189 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.set_ground_width | def set_ground_width(self, ground_width):
'''set ground width of view'''
state = self.state
state.ground_width = ground_width
state.panel.re_center(state.width/2, state.height/2, state.lat, state.lon) | python | def set_ground_width(self, ground_width):
'''set ground width of view'''
state = self.state
state.ground_width = ground_width
state.panel.re_center(state.width/2, state.height/2, state.lat, state.lon) | [
"def",
"set_ground_width",
"(",
"self",
",",
"ground_width",
")",
":",
"state",
"=",
"self",
".",
"state",
"state",
".",
"ground_width",
"=",
"ground_width",
"state",
".",
"panel",
".",
"re_center",
"(",
"state",
".",
"width",
"/",
"2",
",",
"state",
"."... | set ground width of view | [
"set",
"ground",
"width",
"of",
"view"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L387-L391 | train |
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.show_popup | def show_popup(self, selected, pos):
'''show popup menu for an object'''
state = self.state
if selected.popup_menu is not None:
import copy
popup_menu = selected.popup_menu
if state.default_popup is not None and state.default_popup.combine:
pop... | python | def show_popup(self, selected, pos):
'''show popup menu for an object'''
state = self.state
if selected.popup_menu is not None:
import copy
popup_menu = selected.popup_menu
if state.default_popup is not None and state.default_popup.combine:
pop... | [
"def",
"show_popup",
"(",
"self",
",",
"selected",
",",
"pos",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"selected",
".",
"popup_menu",
"is",
"not",
"None",
":",
"import",
"copy",
"popup_menu",
"=",
"selected",
".",
"popup_menu",
"if",
"state",... | show popup menu for an object | [
"show",
"popup",
"menu",
"for",
"an",
"object"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L568-L579 | train |
ArduPilot/MAVProxy | MAVProxy/mavproxy.py | cmd_watch | def cmd_watch(args):
'''watch a mavlink packet pattern'''
if len(args) == 0:
mpstate.status.watch = None
return
mpstate.status.watch = args
print("Watching %s" % mpstate.status.watch) | python | def cmd_watch(args):
'''watch a mavlink packet pattern'''
if len(args) == 0:
mpstate.status.watch = None
return
mpstate.status.watch = args
print("Watching %s" % mpstate.status.watch) | [
"def",
"cmd_watch",
"(",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"mpstate",
".",
"status",
".",
"watch",
"=",
"None",
"return",
"mpstate",
".",
"status",
".",
"watch",
"=",
"args",
"print",
"(",
"\"Watching %s\"",
"%",
"mpsta... | watch a mavlink packet pattern | [
"watch",
"a",
"mavlink",
"packet",
"pattern"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/mavproxy.py#L315-L321 | train |
ArduPilot/MAVProxy | MAVProxy/mavproxy.py | load_module | def load_module(modname, quiet=False, **kwargs):
'''load a module'''
modpaths = ['MAVProxy.modules.mavproxy_%s' % modname, modname]
for (m,pm) in mpstate.modules:
if m.name == modname and not modname in mpstate.multi_instance:
if not quiet:
print("module %s already loaded... | python | def load_module(modname, quiet=False, **kwargs):
'''load a module'''
modpaths = ['MAVProxy.modules.mavproxy_%s' % modname, modname]
for (m,pm) in mpstate.modules:
if m.name == modname and not modname in mpstate.multi_instance:
if not quiet:
print("module %s already loaded... | [
"def",
"load_module",
"(",
"modname",
",",
"quiet",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"modpaths",
"=",
"[",
"'MAVProxy.modules.mavproxy_%s'",
"%",
"modname",
",",
"modname",
"]",
"for",
"(",
"m",
",",
"pm",
")",
"in",
"mpstate",
".",
"mo... | load a module | [
"load",
"a",
"module"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/mavproxy.py#L337-L372 | train |
ArduPilot/MAVProxy | MAVProxy/mavproxy.py | process_mavlink | def process_mavlink(slave):
'''process packets from MAVLink slaves, forwarding to the master'''
try:
buf = slave.recv()
except socket.error:
return
try:
global mavversion
if slave.first_byte and mavversion is None:
slave.auto_mavlink_version(buf)
msgs ... | python | def process_mavlink(slave):
'''process packets from MAVLink slaves, forwarding to the master'''
try:
buf = slave.recv()
except socket.error:
return
try:
global mavversion
if slave.first_byte and mavversion is None:
slave.auto_mavlink_version(buf)
msgs ... | [
"def",
"process_mavlink",
"(",
"slave",
")",
":",
"try",
":",
"buf",
"=",
"slave",
".",
"recv",
"(",
")",
"except",
"socket",
".",
"error",
":",
"return",
"try",
":",
"global",
"mavversion",
"if",
"slave",
".",
"first_byte",
"and",
"mavversion",
"is",
... | process packets from MAVLink slaves, forwarding to the master | [
"process",
"packets",
"from",
"MAVLink",
"slaves",
"forwarding",
"to",
"the",
"master"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/mavproxy.py#L638-L662 | train |
ArduPilot/MAVProxy | MAVProxy/mavproxy.py | log_writer | def log_writer():
'''log writing thread'''
while True:
mpstate.logfile_raw.write(bytearray(mpstate.logqueue_raw.get()))
timeout = time.time() + 10
while not mpstate.logqueue_raw.empty() and time.time() < timeout:
mpstate.logfile_raw.write(mpstate.logqueue_raw.get())
w... | python | def log_writer():
'''log writing thread'''
while True:
mpstate.logfile_raw.write(bytearray(mpstate.logqueue_raw.get()))
timeout = time.time() + 10
while not mpstate.logqueue_raw.empty() and time.time() < timeout:
mpstate.logfile_raw.write(mpstate.logqueue_raw.get())
w... | [
"def",
"log_writer",
"(",
")",
":",
"while",
"True",
":",
"mpstate",
".",
"logfile_raw",
".",
"write",
"(",
"bytearray",
"(",
"mpstate",
".",
"logqueue_raw",
".",
"get",
"(",
")",
")",
")",
"timeout",
"=",
"time",
".",
"time",
"(",
")",
"+",
"10",
... | log writing thread | [
"log",
"writing",
"thread"
] | f50bdeff33064876f7dc8dc4683d278ff47f75d5 | https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/mavproxy.py#L677-L688 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.