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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
UCL-INGI/INGInious | inginious/common/hook_manager.py | HookManager.add_hook | def add_hook(self, name, callback, prio=0):
""" Add a new hook that can be called with the call_hook function.
`prio` is the priority. Higher priority hooks are called before lower priority ones.
This function does not enforce a particular order between hooks with the same priorities.
... | python | def add_hook(self, name, callback, prio=0):
""" Add a new hook that can be called with the call_hook function.
`prio` is the priority. Higher priority hooks are called before lower priority ones.
This function does not enforce a particular order between hooks with the same priorities.
... | [
"def",
"add_hook",
"(",
"self",
",",
"name",
",",
"callback",
",",
"prio",
"=",
"0",
")",
":",
"hook_list",
"=",
"self",
".",
"_hooks",
".",
"get",
"(",
"name",
",",
"[",
"]",
")",
"add",
"=",
"(",
"lambda",
"*",
"args",
",",
"**",
"kwargs",
":... | Add a new hook that can be called with the call_hook function.
`prio` is the priority. Higher priority hooks are called before lower priority ones.
This function does not enforce a particular order between hooks with the same priorities. | [
"Add",
"a",
"new",
"hook",
"that",
"can",
"be",
"called",
"with",
"the",
"call_hook",
"function",
".",
"prio",
"is",
"the",
"priority",
".",
"Higher",
"priority",
"hooks",
"are",
"called",
"before",
"lower",
"priority",
"ones",
".",
"This",
"function",
"do... | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/hook_manager.py#L26-L37 | train |
UCL-INGI/INGInious | inginious/common/tasks.py | Task.input_is_consistent | def input_is_consistent(self, task_input, default_allowed_extension, default_max_size):
""" Check if an input for a task is consistent. Return true if this is case, false else """
for problem in self._problems:
if not problem.input_is_consistent(task_input, default_allowed_extension, default... | python | def input_is_consistent(self, task_input, default_allowed_extension, default_max_size):
""" Check if an input for a task is consistent. Return true if this is case, false else """
for problem in self._problems:
if not problem.input_is_consistent(task_input, default_allowed_extension, default... | [
"def",
"input_is_consistent",
"(",
"self",
",",
"task_input",
",",
"default_allowed_extension",
",",
"default_max_size",
")",
":",
"for",
"problem",
"in",
"self",
".",
"_problems",
":",
"if",
"not",
"problem",
".",
"input_is_consistent",
"(",
"task_input",
",",
... | Check if an input for a task is consistent. Return true if this is case, false else | [
"Check",
"if",
"an",
"input",
"for",
"a",
"task",
"is",
"consistent",
".",
"Return",
"true",
"if",
"this",
"is",
"case",
"false",
"else"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/tasks.py#L75-L80 | train |
UCL-INGI/INGInious | inginious/common/tasks.py | Task.get_limits | def get_limits(self):
""" Return the limits of this task """
vals = self._hook_manager.call_hook('task_limits', course=self.get_course(), task=self, default=self._limits)
return vals[0] if len(vals) else self._limits | python | def get_limits(self):
""" Return the limits of this task """
vals = self._hook_manager.call_hook('task_limits', course=self.get_course(), task=self, default=self._limits)
return vals[0] if len(vals) else self._limits | [
"def",
"get_limits",
"(",
"self",
")",
":",
"vals",
"=",
"self",
".",
"_hook_manager",
".",
"call_hook",
"(",
"'task_limits'",
",",
"course",
"=",
"self",
".",
"get_course",
"(",
")",
",",
"task",
"=",
"self",
",",
"default",
"=",
"self",
".",
"_limits... | Return the limits of this task | [
"Return",
"the",
"limits",
"of",
"this",
"task"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/tasks.py#L106-L109 | train |
UCL-INGI/INGInious | inginious/common/tasks.py | Task.allow_network_access_grading | def allow_network_access_grading(self):
""" Return True if the grading container should have access to the network """
vals = self._hook_manager.call_hook('task_network_grading', course=self.get_course(), task=self, default=self._network_grading)
return vals[0] if len(vals) else self._network_gr... | python | def allow_network_access_grading(self):
""" Return True if the grading container should have access to the network """
vals = self._hook_manager.call_hook('task_network_grading', course=self.get_course(), task=self, default=self._network_grading)
return vals[0] if len(vals) else self._network_gr... | [
"def",
"allow_network_access_grading",
"(",
"self",
")",
":",
"vals",
"=",
"self",
".",
"_hook_manager",
".",
"call_hook",
"(",
"'task_network_grading'",
",",
"course",
"=",
"self",
".",
"get_course",
"(",
")",
",",
"task",
"=",
"self",
",",
"default",
"=",
... | Return True if the grading container should have access to the network | [
"Return",
"True",
"if",
"the",
"grading",
"container",
"should",
"have",
"access",
"to",
"the",
"network"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/tasks.py#L111-L114 | train |
UCL-INGI/INGInious | inginious/common/tasks.py | Task._create_task_problem | def _create_task_problem(self, problemid, problem_content, task_problem_types):
"""Creates a new instance of the right class for a given problem."""
# Basic checks
if not id_checker(problemid):
raise Exception("Invalid problem _id: " + problemid)
if problem_content.get('type'... | python | def _create_task_problem(self, problemid, problem_content, task_problem_types):
"""Creates a new instance of the right class for a given problem."""
# Basic checks
if not id_checker(problemid):
raise Exception("Invalid problem _id: " + problemid)
if problem_content.get('type'... | [
"def",
"_create_task_problem",
"(",
"self",
",",
"problemid",
",",
"problem_content",
",",
"task_problem_types",
")",
":",
"if",
"not",
"id_checker",
"(",
"problemid",
")",
":",
"raise",
"Exception",
"(",
"\"Invalid problem _id: \"",
"+",
"problemid",
")",
"if",
... | Creates a new instance of the right class for a given problem. | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"right",
"class",
"for",
"a",
"given",
"problem",
"."
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/tasks.py#L162-L170 | train |
UCL-INGI/INGInious | inginious/frontend/plugins/scoreboard/__init__.py | course_menu | def course_menu(course, template_helper):
""" Displays the link to the scoreboards on the course page, if the plugin is activated for this course """
scoreboards = course.get_descriptor().get('scoreboard', [])
if scoreboards != []:
return str(template_helper.get_custom_renderer('frontend/plugins/sc... | python | def course_menu(course, template_helper):
""" Displays the link to the scoreboards on the course page, if the plugin is activated for this course """
scoreboards = course.get_descriptor().get('scoreboard', [])
if scoreboards != []:
return str(template_helper.get_custom_renderer('frontend/plugins/sc... | [
"def",
"course_menu",
"(",
"course",
",",
"template_helper",
")",
":",
"scoreboards",
"=",
"course",
".",
"get_descriptor",
"(",
")",
".",
"get",
"(",
"'scoreboard'",
",",
"[",
"]",
")",
"if",
"scoreboards",
"!=",
"[",
"]",
":",
"return",
"str",
"(",
"... | Displays the link to the scoreboards on the course page, if the plugin is activated for this course | [
"Displays",
"the",
"link",
"to",
"the",
"scoreboards",
"on",
"the",
"course",
"page",
"if",
"the",
"plugin",
"is",
"activated",
"for",
"this",
"course"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugins/scoreboard/__init__.py#L172-L179 | train |
UCL-INGI/INGInious | inginious/frontend/plugins/scoreboard/__init__.py | task_menu | def task_menu(course, task, template_helper):
""" Displays the link to the scoreboards on the task page, if the plugin is activated for this course and the task is used in scoreboards """
scoreboards = course.get_descriptor().get('scoreboard', [])
try:
tolink = []
for sid, scoreboard in enum... | python | def task_menu(course, task, template_helper):
""" Displays the link to the scoreboards on the task page, if the plugin is activated for this course and the task is used in scoreboards """
scoreboards = course.get_descriptor().get('scoreboard', [])
try:
tolink = []
for sid, scoreboard in enum... | [
"def",
"task_menu",
"(",
"course",
",",
"task",
",",
"template_helper",
")",
":",
"scoreboards",
"=",
"course",
".",
"get_descriptor",
"(",
")",
".",
"get",
"(",
"'scoreboard'",
",",
"[",
"]",
")",
"try",
":",
"tolink",
"=",
"[",
"]",
"for",
"sid",
"... | Displays the link to the scoreboards on the task page, if the plugin is activated for this course and the task is used in scoreboards | [
"Displays",
"the",
"link",
"to",
"the",
"scoreboards",
"on",
"the",
"task",
"page",
"if",
"the",
"plugin",
"is",
"activated",
"for",
"this",
"course",
"and",
"the",
"task",
"is",
"used",
"in",
"scoreboards"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugins/scoreboard/__init__.py#L182-L195 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course_admin/classroom_edit.py | CourseEditClassroom.get_user_lists | def get_user_lists(self, course, classroomid):
""" Get the available student and tutor lists for classroom edition"""
tutor_list = course.get_staff()
# Determine if user is grouped or not in the classroom
student_list = list(self.database.classrooms.aggregate([
{"$match": {"... | python | def get_user_lists(self, course, classroomid):
""" Get the available student and tutor lists for classroom edition"""
tutor_list = course.get_staff()
# Determine if user is grouped or not in the classroom
student_list = list(self.database.classrooms.aggregate([
{"$match": {"... | [
"def",
"get_user_lists",
"(",
"self",
",",
"course",
",",
"classroomid",
")",
":",
"tutor_list",
"=",
"course",
".",
"get_staff",
"(",
")",
"student_list",
"=",
"list",
"(",
"self",
".",
"database",
".",
"classrooms",
".",
"aggregate",
"(",
"[",
"{",
"\"... | Get the available student and tutor lists for classroom edition | [
"Get",
"the",
"available",
"student",
"and",
"tutor",
"lists",
"for",
"classroom",
"edition"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/classroom_edit.py#L21-L64 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course_admin/classroom_edit.py | CourseEditClassroom.update_classroom | def update_classroom(self, course, classroomid, new_data):
""" Update classroom and returns a list of errored students"""
student_list, tutor_list, other_students, _ = self.get_user_lists(course, classroomid)
# Check tutors
new_data["tutors"] = [tutor for tutor in map(str.strip, new_dat... | python | def update_classroom(self, course, classroomid, new_data):
""" Update classroom and returns a list of errored students"""
student_list, tutor_list, other_students, _ = self.get_user_lists(course, classroomid)
# Check tutors
new_data["tutors"] = [tutor for tutor in map(str.strip, new_dat... | [
"def",
"update_classroom",
"(",
"self",
",",
"course",
",",
"classroomid",
",",
"new_data",
")",
":",
"student_list",
",",
"tutor_list",
",",
"other_students",
",",
"_",
"=",
"self",
".",
"get_user_lists",
"(",
"course",
",",
"classroomid",
")",
"new_data",
... | Update classroom and returns a list of errored students | [
"Update",
"classroom",
"and",
"returns",
"a",
"list",
"of",
"errored",
"students"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/classroom_edit.py#L66-L116 | train |
UCL-INGI/INGInious | inginious/frontend/parsable_text.py | ParsableText.parse | def parse(self, debug=False):
"""Returns parsed text"""
if self._parsed is None:
try:
if self._mode == "html":
self._parsed = self.html(self._content, self._show_everything, self._translation)
else:
self._parsed = self.r... | python | def parse(self, debug=False):
"""Returns parsed text"""
if self._parsed is None:
try:
if self._mode == "html":
self._parsed = self.html(self._content, self._show_everything, self._translation)
else:
self._parsed = self.r... | [
"def",
"parse",
"(",
"self",
",",
"debug",
"=",
"False",
")",
":",
"if",
"self",
".",
"_parsed",
"is",
"None",
":",
"try",
":",
"if",
"self",
".",
"_mode",
"==",
"\"html\"",
":",
"self",
".",
"_parsed",
"=",
"self",
".",
"html",
"(",
"self",
".",... | Returns parsed text | [
"Returns",
"parsed",
"text"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/parsable_text.py#L144-L157 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course_admin/task_edit_file.py | CourseTaskFiles.POST_AUTH | def POST_AUTH(self, courseid, taskid): # pylint: disable=arguments-differ
""" Upload or modify a file """
if not id_checker(taskid):
raise Exception("Invalid task id")
self.get_course_and_check_rights(courseid, allow_all_staff=False)
request = web.input(file={})
if... | python | def POST_AUTH(self, courseid, taskid): # pylint: disable=arguments-differ
""" Upload or modify a file """
if not id_checker(taskid):
raise Exception("Invalid task id")
self.get_course_and_check_rights(courseid, allow_all_staff=False)
request = web.input(file={})
if... | [
"def",
"POST_AUTH",
"(",
"self",
",",
"courseid",
",",
"taskid",
")",
":",
"if",
"not",
"id_checker",
"(",
"taskid",
")",
":",
"raise",
"Exception",
"(",
"\"Invalid task id\"",
")",
"self",
".",
"get_course_and_check_rights",
"(",
"courseid",
",",
"allow_all_s... | Upload or modify a file | [
"Upload",
"or",
"modify",
"a",
"file"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit_file.py#L40-L53 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course_admin/task_edit_file.py | CourseTaskFiles.show_tab_file | def show_tab_file(self, courseid, taskid, error=None):
""" Return the file tab """
return self.template_helper.get_renderer(False).course_admin.edit_tabs.files(
self.course_factory.get_course(courseid), taskid, self.get_task_filelist(self.task_factory, courseid, taskid), error) | python | def show_tab_file(self, courseid, taskid, error=None):
""" Return the file tab """
return self.template_helper.get_renderer(False).course_admin.edit_tabs.files(
self.course_factory.get_course(courseid), taskid, self.get_task_filelist(self.task_factory, courseid, taskid), error) | [
"def",
"show_tab_file",
"(",
"self",
",",
"courseid",
",",
"taskid",
",",
"error",
"=",
"None",
")",
":",
"return",
"self",
".",
"template_helper",
".",
"get_renderer",
"(",
"False",
")",
".",
"course_admin",
".",
"edit_tabs",
".",
"files",
"(",
"self",
... | Return the file tab | [
"Return",
"the",
"file",
"tab"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit_file.py#L55-L58 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course_admin/task_edit_file.py | CourseTaskFiles.action_edit | def action_edit(self, courseid, taskid, path):
""" Edit a file """
wanted_path = self.verify_path(courseid, taskid, path)
if wanted_path is None:
return "Internal error"
try:
content = self.task_factory.get_task_fs(courseid, taskid).get(wanted_path).decode("utf-8"... | python | def action_edit(self, courseid, taskid, path):
""" Edit a file """
wanted_path = self.verify_path(courseid, taskid, path)
if wanted_path is None:
return "Internal error"
try:
content = self.task_factory.get_task_fs(courseid, taskid).get(wanted_path).decode("utf-8"... | [
"def",
"action_edit",
"(",
"self",
",",
"courseid",
",",
"taskid",
",",
"path",
")",
":",
"wanted_path",
"=",
"self",
".",
"verify_path",
"(",
"courseid",
",",
"taskid",
",",
"path",
")",
"if",
"wanted_path",
"is",
"None",
":",
"return",
"\"Internal error\... | Edit a file | [
"Edit",
"a",
"file"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit_file.py#L131-L140 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course_admin/task_edit_file.py | CourseTaskFiles.action_edit_save | def action_edit_save(self, courseid, taskid, path, content):
""" Save an edited file """
wanted_path = self.verify_path(courseid, taskid, path)
if wanted_path is None:
return json.dumps({"error": True})
try:
self.task_factory.get_task_fs(courseid, taskid).put(want... | python | def action_edit_save(self, courseid, taskid, path, content):
""" Save an edited file """
wanted_path = self.verify_path(courseid, taskid, path)
if wanted_path is None:
return json.dumps({"error": True})
try:
self.task_factory.get_task_fs(courseid, taskid).put(want... | [
"def",
"action_edit_save",
"(",
"self",
",",
"courseid",
",",
"taskid",
",",
"path",
",",
"content",
")",
":",
"wanted_path",
"=",
"self",
".",
"verify_path",
"(",
"courseid",
",",
"taskid",
",",
"path",
")",
"if",
"wanted_path",
"is",
"None",
":",
"retu... | Save an edited file | [
"Save",
"an",
"edited",
"file"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit_file.py#L142-L151 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course_admin/task_edit_file.py | CourseTaskFiles.action_download | def action_download(self, courseid, taskid, path):
""" Download a file or a directory """
wanted_path = self.verify_path(courseid, taskid, path)
if wanted_path is None:
raise web.notfound()
task_fs = self.task_factory.get_task_fs(courseid, taskid)
(method, mimetype_... | python | def action_download(self, courseid, taskid, path):
""" Download a file or a directory """
wanted_path = self.verify_path(courseid, taskid, path)
if wanted_path is None:
raise web.notfound()
task_fs = self.task_factory.get_task_fs(courseid, taskid)
(method, mimetype_... | [
"def",
"action_download",
"(",
"self",
",",
"courseid",
",",
"taskid",
",",
"path",
")",
":",
"wanted_path",
"=",
"self",
".",
"verify_path",
"(",
"courseid",
",",
"taskid",
",",
"path",
")",
"if",
"wanted_path",
"is",
"None",
":",
"raise",
"web",
".",
... | Download a file or a directory | [
"Download",
"a",
"file",
"or",
"a",
"directory"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit_file.py#L235-L251 | train |
UCL-INGI/INGInious | inginious/common/base.py | write_json_or_yaml | def write_json_or_yaml(file_path, content):
""" Write JSON or YAML depending on the file extension. """
with codecs.open(file_path, "w", "utf-8") as f:
f.write(get_json_or_yaml(file_path, content)) | python | def write_json_or_yaml(file_path, content):
""" Write JSON or YAML depending on the file extension. """
with codecs.open(file_path, "w", "utf-8") as f:
f.write(get_json_or_yaml(file_path, content)) | [
"def",
"write_json_or_yaml",
"(",
"file_path",
",",
"content",
")",
":",
"with",
"codecs",
".",
"open",
"(",
"file_path",
",",
"\"w\"",
",",
"\"utf-8\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"get_json_or_yaml",
"(",
"file_path",
",",
"content",
"... | Write JSON or YAML depending on the file extension. | [
"Write",
"JSON",
"or",
"YAML",
"depending",
"on",
"the",
"file",
"extension",
"."
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/base.py#L43-L46 | train |
UCL-INGI/INGInious | inginious/common/base.py | get_json_or_yaml | def get_json_or_yaml(file_path, content):
""" Generate JSON or YAML depending on the file extension. """
if os.path.splitext(file_path)[1] == ".json":
return json.dumps(content, sort_keys=False, indent=4, separators=(',', ': '))
else:
return inginious.common.custom_yaml.dump(content) | python | def get_json_or_yaml(file_path, content):
""" Generate JSON or YAML depending on the file extension. """
if os.path.splitext(file_path)[1] == ".json":
return json.dumps(content, sort_keys=False, indent=4, separators=(',', ': '))
else:
return inginious.common.custom_yaml.dump(content) | [
"def",
"get_json_or_yaml",
"(",
"file_path",
",",
"content",
")",
":",
"if",
"os",
".",
"path",
".",
"splitext",
"(",
"file_path",
")",
"[",
"1",
"]",
"==",
"\".json\"",
":",
"return",
"json",
".",
"dumps",
"(",
"content",
",",
"sort_keys",
"=",
"False... | Generate JSON or YAML depending on the file extension. | [
"Generate",
"JSON",
"or",
"YAML",
"depending",
"on",
"the",
"file",
"extension",
"."
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/base.py#L49-L54 | train |
UCL-INGI/INGInious | inginious/frontend/user_manager.py | UserManager._set_session | def _set_session(self, username, realname, email, language):
""" Init the session. Preserves potential LTI information. """
self._session.loggedin = True
self._session.email = email
self._session.username = username
self._session.realname = realname
self._session.language... | python | def _set_session(self, username, realname, email, language):
""" Init the session. Preserves potential LTI information. """
self._session.loggedin = True
self._session.email = email
self._session.username = username
self._session.realname = realname
self._session.language... | [
"def",
"_set_session",
"(",
"self",
",",
"username",
",",
"realname",
",",
"email",
",",
"language",
")",
":",
"self",
".",
"_session",
".",
"loggedin",
"=",
"True",
"self",
".",
"_session",
".",
"email",
"=",
"email",
"self",
".",
"_session",
".",
"us... | Init the session. Preserves potential LTI information. | [
"Init",
"the",
"session",
".",
"Preserves",
"potential",
"LTI",
"information",
"."
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L184-L193 | train |
UCL-INGI/INGInious | inginious/frontend/user_manager.py | UserManager._destroy_session | def _destroy_session(self):
""" Destroy the session """
self._session.loggedin = False
self._session.email = None
self._session.username = None
self._session.realname = None
self._session.token = None
self._session.lti = None | python | def _destroy_session(self):
""" Destroy the session """
self._session.loggedin = False
self._session.email = None
self._session.username = None
self._session.realname = None
self._session.token = None
self._session.lti = None | [
"def",
"_destroy_session",
"(",
"self",
")",
":",
"self",
".",
"_session",
".",
"loggedin",
"=",
"False",
"self",
".",
"_session",
".",
"email",
"=",
"None",
"self",
".",
"_session",
".",
"username",
"=",
"None",
"self",
".",
"_session",
".",
"realname",... | Destroy the session | [
"Destroy",
"the",
"session"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L195-L202 | train |
UCL-INGI/INGInious | inginious/frontend/user_manager.py | UserManager.create_lti_session | def create_lti_session(self, user_id, roles, realname, email, course_id, task_id, consumer_key, outcome_service_url,
outcome_result_id, tool_name, tool_desc, tool_url, context_title, context_label):
""" Creates an LTI cookieless session. Returns the new session id"""
self._de... | python | def create_lti_session(self, user_id, roles, realname, email, course_id, task_id, consumer_key, outcome_service_url,
outcome_result_id, tool_name, tool_desc, tool_url, context_title, context_label):
""" Creates an LTI cookieless session. Returns the new session id"""
self._de... | [
"def",
"create_lti_session",
"(",
"self",
",",
"user_id",
",",
"roles",
",",
"realname",
",",
"email",
",",
"course_id",
",",
"task_id",
",",
"consumer_key",
",",
"outcome_service_url",
",",
"outcome_result_id",
",",
"tool_name",
",",
"tool_desc",
",",
"tool_url... | Creates an LTI cookieless session. Returns the new session id | [
"Creates",
"an",
"LTI",
"cookieless",
"session",
".",
"Returns",
"the",
"new",
"session",
"id"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L204-L228 | train |
UCL-INGI/INGInious | inginious/frontend/user_manager.py | UserManager.user_saw_task | def user_saw_task(self, username, courseid, taskid):
""" Set in the database that the user has viewed this task """
self._database.user_tasks.update({"username": username, "courseid": courseid, "taskid": taskid},
{"$setOnInsert": {"username": username, "courseid"... | python | def user_saw_task(self, username, courseid, taskid):
""" Set in the database that the user has viewed this task """
self._database.user_tasks.update({"username": username, "courseid": courseid, "taskid": taskid},
{"$setOnInsert": {"username": username, "courseid"... | [
"def",
"user_saw_task",
"(",
"self",
",",
"username",
",",
"courseid",
",",
"taskid",
")",
":",
"self",
".",
"_database",
".",
"user_tasks",
".",
"update",
"(",
"{",
"\"username\"",
":",
"username",
",",
"\"courseid\"",
":",
"courseid",
",",
"\"taskid\"",
... | Set in the database that the user has viewed this task | [
"Set",
"in",
"the",
"database",
"that",
"the",
"user",
"has",
"viewed",
"this",
"task"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L518-L523 | train |
UCL-INGI/INGInious | inginious/frontend/user_manager.py | UserManager.update_user_stats | def update_user_stats(self, username, task, submission, result_str, grade, state, newsub):
""" Update stats with a new submission """
self.user_saw_task(username, submission["courseid"], submission["taskid"])
if newsub:
old_submission = self._database.user_tasks.find_one_and_update(... | python | def update_user_stats(self, username, task, submission, result_str, grade, state, newsub):
""" Update stats with a new submission """
self.user_saw_task(username, submission["courseid"], submission["taskid"])
if newsub:
old_submission = self._database.user_tasks.find_one_and_update(... | [
"def",
"update_user_stats",
"(",
"self",
",",
"username",
",",
"task",
",",
"submission",
",",
"result_str",
",",
"grade",
",",
"state",
",",
"newsub",
")",
":",
"self",
".",
"user_saw_task",
"(",
"username",
",",
"submission",
"[",
"\"courseid\"",
"]",
",... | Update stats with a new submission | [
"Update",
"stats",
"with",
"a",
"new",
"submission"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L525-L568 | train |
UCL-INGI/INGInious | inginious/frontend/user_manager.py | UserManager.get_course_aggregations | def get_course_aggregations(self, course):
""" Returns a list of the course aggregations"""
return natsorted(list(self._database.aggregations.find({"courseid": course.get_id()})), key=lambda x: x["description"]) | python | def get_course_aggregations(self, course):
""" Returns a list of the course aggregations"""
return natsorted(list(self._database.aggregations.find({"courseid": course.get_id()})), key=lambda x: x["description"]) | [
"def",
"get_course_aggregations",
"(",
"self",
",",
"course",
")",
":",
"return",
"natsorted",
"(",
"list",
"(",
"self",
".",
"_database",
".",
"aggregations",
".",
"find",
"(",
"{",
"\"courseid\"",
":",
"course",
".",
"get_id",
"(",
")",
"}",
")",
")",
... | Returns a list of the course aggregations | [
"Returns",
"a",
"list",
"of",
"the",
"course",
"aggregations"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L650-L652 | train |
UCL-INGI/INGInious | inginious/frontend/tasks.py | WebAppTask.get_accessible_time | def get_accessible_time(self, plugin_override=True):
""" Get the accessible time of this task """
vals = self._hook_manager.call_hook('task_accessibility', course=self.get_course(), task=self, default=self._accessible)
return vals[0] if len(vals) and plugin_override else self._accessible | python | def get_accessible_time(self, plugin_override=True):
""" Get the accessible time of this task """
vals = self._hook_manager.call_hook('task_accessibility', course=self.get_course(), task=self, default=self._accessible)
return vals[0] if len(vals) and plugin_override else self._accessible | [
"def",
"get_accessible_time",
"(",
"self",
",",
"plugin_override",
"=",
"True",
")",
":",
"vals",
"=",
"self",
".",
"_hook_manager",
".",
"call_hook",
"(",
"'task_accessibility'",
",",
"course",
"=",
"self",
".",
"get_course",
"(",
")",
",",
"task",
"=",
"... | Get the accessible time of this task | [
"Get",
"the",
"accessible",
"time",
"of",
"this",
"task"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/tasks.py#L68-L71 | train |
UCL-INGI/INGInious | inginious/frontend/tasks.py | WebAppTask.get_deadline | def get_deadline(self):
""" Returns a string containing the deadline for this task """
if self.get_accessible_time().is_always_accessible():
return _("No deadline")
elif self.get_accessible_time().is_never_accessible():
return _("It's too late")
else:
... | python | def get_deadline(self):
""" Returns a string containing the deadline for this task """
if self.get_accessible_time().is_always_accessible():
return _("No deadline")
elif self.get_accessible_time().is_never_accessible():
return _("It's too late")
else:
... | [
"def",
"get_deadline",
"(",
"self",
")",
":",
"if",
"self",
".",
"get_accessible_time",
"(",
")",
".",
"is_always_accessible",
"(",
")",
":",
"return",
"_",
"(",
"\"No deadline\"",
")",
"elif",
"self",
".",
"get_accessible_time",
"(",
")",
".",
"is_never_acc... | Returns a string containing the deadline for this task | [
"Returns",
"a",
"string",
"containing",
"the",
"deadline",
"for",
"this",
"task"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/tasks.py#L77-L85 | train |
UCL-INGI/INGInious | inginious/frontend/tasks.py | WebAppTask.get_authors | def get_authors(self, language):
""" Return the list of this task's authors """
return self.gettext(language, self._author) if self._author else "" | python | def get_authors(self, language):
""" Return the list of this task's authors """
return self.gettext(language, self._author) if self._author else "" | [
"def",
"get_authors",
"(",
"self",
",",
"language",
")",
":",
"return",
"self",
".",
"gettext",
"(",
"language",
",",
"self",
".",
"_author",
")",
"if",
"self",
".",
"_author",
"else",
"\"\""
] | Return the list of this task's authors | [
"Return",
"the",
"list",
"of",
"this",
"task",
"s",
"authors"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/tasks.py#L106-L108 | train |
UCL-INGI/INGInious | inginious/frontend/tasks.py | WebAppTask.adapt_input_for_backend | def adapt_input_for_backend(self, input_data):
""" Adapt the input from web.py for the inginious.backend """
for problem in self._problems:
input_data = problem.adapt_input_for_backend(input_data)
return input_data | python | def adapt_input_for_backend(self, input_data):
""" Adapt the input from web.py for the inginious.backend """
for problem in self._problems:
input_data = problem.adapt_input_for_backend(input_data)
return input_data | [
"def",
"adapt_input_for_backend",
"(",
"self",
",",
"input_data",
")",
":",
"for",
"problem",
"in",
"self",
".",
"_problems",
":",
"input_data",
"=",
"problem",
".",
"adapt_input_for_backend",
"(",
"input_data",
")",
"return",
"input_data"
] | Adapt the input from web.py for the inginious.backend | [
"Adapt",
"the",
"input",
"from",
"web",
".",
"py",
"for",
"the",
"inginious",
".",
"backend"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/tasks.py#L110-L114 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course_admin/submissions.py | CourseSubmissionsPage.get_users | def get_users(self, course):
""" Returns a sorted list of users """
users = OrderedDict(sorted(list(self.user_manager.get_users_info(self.user_manager.get_course_registered_users(course)).items()),
key=lambda k: k[1][0] if k[1] is not None else ""))
return users | python | def get_users(self, course):
""" Returns a sorted list of users """
users = OrderedDict(sorted(list(self.user_manager.get_users_info(self.user_manager.get_course_registered_users(course)).items()),
key=lambda k: k[1][0] if k[1] is not None else ""))
return users | [
"def",
"get_users",
"(",
"self",
",",
"course",
")",
":",
"users",
"=",
"OrderedDict",
"(",
"sorted",
"(",
"list",
"(",
"self",
".",
"user_manager",
".",
"get_users_info",
"(",
"self",
".",
"user_manager",
".",
"get_course_registered_users",
"(",
"course",
"... | Returns a sorted list of users | [
"Returns",
"a",
"sorted",
"list",
"of",
"users"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/submissions.py#L107-L111 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course.py | CoursePage.get_course | def get_course(self, courseid):
""" Return the course """
try:
course = self.course_factory.get_course(courseid)
except:
raise web.notfound()
return course | python | def get_course(self, courseid):
""" Return the course """
try:
course = self.course_factory.get_course(courseid)
except:
raise web.notfound()
return course | [
"def",
"get_course",
"(",
"self",
",",
"courseid",
")",
":",
"try",
":",
"course",
"=",
"self",
".",
"course_factory",
".",
"get_course",
"(",
"courseid",
")",
"except",
":",
"raise",
"web",
".",
"notfound",
"(",
")",
"return",
"course"
] | Return the course | [
"Return",
"the",
"course"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course.py#L15-L22 | train |
UCL-INGI/INGInious | inginious/frontend/pages/course.py | CoursePage.show_page | def show_page(self, course):
""" Prepares and shows the course page """
username = self.user_manager.session_username()
if not self.user_manager.course_is_open_to_user(course, lti=False):
return self.template_helper.get_renderer().course_unavailable()
else:
tasks ... | python | def show_page(self, course):
""" Prepares and shows the course page """
username = self.user_manager.session_username()
if not self.user_manager.course_is_open_to_user(course, lti=False):
return self.template_helper.get_renderer().course_unavailable()
else:
tasks ... | [
"def",
"show_page",
"(",
"self",
",",
"course",
")",
":",
"username",
"=",
"self",
".",
"user_manager",
".",
"session_username",
"(",
")",
"if",
"not",
"self",
".",
"user_manager",
".",
"course_is_open_to_user",
"(",
"course",
",",
"lti",
"=",
"False",
")"... | Prepares and shows the course page | [
"Prepares",
"and",
"shows",
"the",
"course",
"page"
] | cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c | https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course.py#L40-L74 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavparms.py | mavparms | def mavparms(logfile):
'''extract mavlink parameters'''
mlog = mavutil.mavlink_connection(filename)
while True:
try:
m = mlog.recv_match(type=['PARAM_VALUE', 'PARM'])
if m is None:
return
except Exception:
return
if m.get_type() ==... | python | def mavparms(logfile):
'''extract mavlink parameters'''
mlog = mavutil.mavlink_connection(filename)
while True:
try:
m = mlog.recv_match(type=['PARAM_VALUE', 'PARM'])
if m is None:
return
except Exception:
return
if m.get_type() ==... | [
"def",
"mavparms",
"(",
"logfile",
")",
":",
"mlog",
"=",
"mavutil",
".",
"mavlink_connection",
"(",
"filename",
")",
"while",
"True",
":",
"try",
":",
"m",
"=",
"mlog",
".",
"recv_match",
"(",
"type",
"=",
"[",
"'PARAM_VALUE'",
",",
"'PARM'",
"]",
")"... | extract mavlink parameters | [
"extract",
"mavlink",
"parameters"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavparms.py#L20-L41 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.send | def send(self, mavmsg, force_mavlink1=False):
'''send a MAVLink message'''
buf = mavmsg.pack(self, force_mavlink1=force_mavlink1)
self.file.write(buf)
self.seq = (self.seq + 1) % 256
self.total_packets_sent += 1
self.total_b... | python | def send(self, mavmsg, force_mavlink1=False):
'''send a MAVLink message'''
buf = mavmsg.pack(self, force_mavlink1=force_mavlink1)
self.file.write(buf)
self.seq = (self.seq + 1) % 256
self.total_packets_sent += 1
self.total_b... | [
"def",
"send",
"(",
"self",
",",
"mavmsg",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"buf",
"=",
"mavmsg",
".",
"pack",
"(",
"self",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")",
"self",
".",
"file",
".",
"write",
"(",
"buf",
")",
"self",
"... | send a MAVLink message | [
"send",
"a",
"MAVLink",
"message"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L7550-L7558 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.bytes_needed | def bytes_needed(self):
'''return number of bytes needed for next parsing stage'''
if self.native:
ret = self.native.expected_length - self.buf_len()
else:
ret = self.expected_length - self.buf_len()
if ret <= 0:
... | python | def bytes_needed(self):
'''return number of bytes needed for next parsing stage'''
if self.native:
ret = self.native.expected_length - self.buf_len()
else:
ret = self.expected_length - self.buf_len()
if ret <= 0:
... | [
"def",
"bytes_needed",
"(",
"self",
")",
":",
"if",
"self",
".",
"native",
":",
"ret",
"=",
"self",
".",
"native",
".",
"expected_length",
"-",
"self",
".",
"buf_len",
"(",
")",
"else",
":",
"ret",
"=",
"self",
".",
"expected_length",
"-",
"self",
".... | return number of bytes needed for next parsing stage | [
"return",
"number",
"of",
"bytes",
"needed",
"for",
"next",
"parsing",
"stage"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L7563-L7572 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.__callbacks | def __callbacks(self, msg):
'''this method exists only to make profiling results easier to read'''
if self.callback:
self.callback(msg, *self.callback_args, **self.callback_kwargs) | python | def __callbacks(self, msg):
'''this method exists only to make profiling results easier to read'''
if self.callback:
self.callback(msg, *self.callback_args, **self.callback_kwargs) | [
"def",
"__callbacks",
"(",
"self",
",",
"msg",
")",
":",
"if",
"self",
".",
"callback",
":",
"self",
".",
"callback",
"(",
"msg",
",",
"*",
"self",
".",
"callback_args",
",",
"**",
"self",
".",
"callback_kwargs",
")"
] | this method exists only to make profiling results easier to read | [
"this",
"method",
"exists",
"only",
"to",
"make",
"profiling",
"results",
"easier",
"to",
"read"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L7579-L7582 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.parse_char | def parse_char(self, c):
'''input some data bytes, possibly returning a new message'''
self.buf.extend(c)
self.total_bytes_received += len(c)
if self.native:
if native_testing:
self.test_buf.extend(c)
m = self.__pa... | python | def parse_char(self, c):
'''input some data bytes, possibly returning a new message'''
self.buf.extend(c)
self.total_bytes_received += len(c)
if self.native:
if native_testing:
self.test_buf.extend(c)
m = self.__pa... | [
"def",
"parse_char",
"(",
"self",
",",
"c",
")",
":",
"self",
".",
"buf",
".",
"extend",
"(",
"c",
")",
"self",
".",
"total_bytes_received",
"+=",
"len",
"(",
"c",
")",
"if",
"self",
".",
"native",
":",
"if",
"native_testing",
":",
"self",
".",
"te... | input some data bytes, possibly returning a new message | [
"input",
"some",
"data",
"bytes",
"possibly",
"returning",
"a",
"new",
"message"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L7584-L7613 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.parse_buffer | def parse_buffer(self, s):
'''input some data bytes, possibly returning a list of new messages'''
m = self.parse_char(s)
if m is None:
return None
ret = [m]
while True:
m = self.parse_char("")
if m is None:
... | python | def parse_buffer(self, s):
'''input some data bytes, possibly returning a list of new messages'''
m = self.parse_char(s)
if m is None:
return None
ret = [m]
while True:
m = self.parse_char("")
if m is None:
... | [
"def",
"parse_buffer",
"(",
"self",
",",
"s",
")",
":",
"m",
"=",
"self",
".",
"parse_char",
"(",
"s",
")",
"if",
"m",
"is",
"None",
":",
"return",
"None",
"ret",
"=",
"[",
"m",
"]",
"while",
"True",
":",
"m",
"=",
"self",
".",
"parse_char",
"(... | input some data bytes, possibly returning a list of new messages | [
"input",
"some",
"data",
"bytes",
"possibly",
"returning",
"a",
"list",
"of",
"new",
"messages"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L7662-L7673 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.check_signature | def check_signature(self, msgbuf, srcSystem, srcComponent):
'''check signature on incoming message'''
if isinstance(msgbuf, array.array):
msgbuf = msgbuf.tostring()
timestamp_buf = msgbuf[-12:-6]
link_id = msgbuf[-13]
(tlow, thigh) = struct.unp... | python | def check_signature(self, msgbuf, srcSystem, srcComponent):
'''check signature on incoming message'''
if isinstance(msgbuf, array.array):
msgbuf = msgbuf.tostring()
timestamp_buf = msgbuf[-12:-6]
link_id = msgbuf[-13]
(tlow, thigh) = struct.unp... | [
"def",
"check_signature",
"(",
"self",
",",
"msgbuf",
",",
"srcSystem",
",",
"srcComponent",
")",
":",
"if",
"isinstance",
"(",
"msgbuf",
",",
"array",
".",
"array",
")",
":",
"msgbuf",
"=",
"msgbuf",
".",
"tostring",
"(",
")",
"timestamp_buf",
"=",
"msg... | check signature on incoming message | [
"check",
"signature",
"on",
"incoming",
"message"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L7675-L7712 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.flexifunction_set_send | def flexifunction_set_send(self, target_system, target_component, force_mavlink1=False):
'''
Depreciated but used as a compiler flag. Do not remove
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
... | python | def flexifunction_set_send(self, target_system, target_component, force_mavlink1=False):
'''
Depreciated but used as a compiler flag. Do not remove
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
... | [
"def",
"flexifunction_set_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"flexifunction_set_encode",
"(",
"target_system",
",",
"target_component",
... | Depreciated but used as a compiler flag. Do not remove
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Depreciated",
"but",
"used",
"as",
"a",
"compiler",
"flag",
".",
"Do",
"not",
"remove"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L7855-L7863 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.system_time_send | def system_time_send(self, time_unix_usec, time_boot_ms, force_mavlink1=False):
'''
The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
time_unix_usec : Timestamp of the master clock in mi... | python | def system_time_send(self, time_unix_usec, time_boot_ms, force_mavlink1=False):
'''
The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
time_unix_usec : Timestamp of the master clock in mi... | [
"def",
"system_time_send",
"(",
"self",
",",
"time_unix_usec",
",",
"time_boot_ms",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"system_time_encode",
"(",
"time_unix_usec",
",",
"time_boot_ms",
")",
",",
"for... | The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
time_unix_usec : Timestamp of the master clock in microseconds since UNIX epoch. (uint64_t)
time_boot_ms : Timestamp of the component clock... | [
"The",
"system",
"time",
"is",
"the",
"time",
"of",
"the",
"master",
"clock",
"typically",
"the",
"computer",
"clock",
"of",
"the",
"main",
"onboard",
"computer",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8636-L8645 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.set_mode_send | def set_mode_send(self, target_system, base_mode, custom_mode, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as
defined by enum MAV_MODE. There is no target component
... | python | def set_mode_send(self, target_system, base_mode, custom_mode, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as
defined by enum MAV_MODE. There is no target component
... | [
"def",
"set_mode_send",
"(",
"self",
",",
"target_system",
",",
"base_mode",
",",
"custom_mode",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"set_mode_encode",
"(",
"target_system",
",",
"base_mode",
",",
"... | THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as
defined by enum MAV_MODE. There is no target component
id as the mode is by definition for the overall
aircraft, not only for one component.
... | [
"THIS",
"INTERFACE",
"IS",
"DEPRECATED",
".",
"USE",
"COMMAND_LONG",
"with",
"MAV_CMD_DO_SET_MODE",
"INSTEAD",
".",
"Set",
"the",
"system",
"mode",
"as",
"defined",
"by",
"enum",
"MAV_MODE",
".",
"There",
"is",
"no",
"target",
"component",
"id",
"as",
"the",
... | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8760-L8773 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.param_request_list_send | def param_request_list_send(self, target_system, target_component, force_mavlink1=False):
'''
Request all parameters of this component. After this request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_... | python | def param_request_list_send(self, target_system, target_component, force_mavlink1=False):
'''
Request all parameters of this component. After this request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_... | [
"def",
"param_request_list_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"param_request_list_encode",
"(",
"target_system",
",",
"target_component",
... | Request all parameters of this component. After this request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Request",
"all",
"parameters",
"of",
"this",
"component",
".",
"After",
"this",
"request",
"all",
"parameters",
"are",
"emitted",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8826-L8835 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.mission_current_send | def mission_current_send(self, seq, force_mavlink1=False):
'''
Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t)
... | python | def mission_current_send(self, seq, force_mavlink1=False):
'''
Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t)
... | [
"def",
"mission_current_send",
"(",
"self",
",",
"seq",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"mission_current_encode",
"(",
"seq",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t) | [
"Message",
"that",
"announces",
"the",
"sequence",
"number",
"of",
"the",
"current",
"active",
"mission",
"item",
".",
"The",
"MAV",
"will",
"fly",
"towards",
"this",
"mission",
"item",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9590-L9599 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.mission_count_send | def mission_count_send(self, target_system, target_component, count, force_mavlink1=False):
'''
This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then
request the individual mission item... | python | def mission_count_send(self, target_system, target_component, count, force_mavlink1=False):
'''
This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then
request the individual mission item... | [
"def",
"mission_count_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"count",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"mission_count_encode",
"(",
"target_system",
",",
"target_comp... | This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then
request the individual mission item based on the
knowledge of the total number of MISSIONs.
target_system : System ID ... | [
"This",
"message",
"is",
"emitted",
"as",
"response",
"to",
"MISSION_REQUEST_LIST",
"by",
"the",
"MAV",
"and",
"to",
"initiate",
"a",
"write",
"transaction",
".",
"The",
"GCS",
"can",
"then",
"request",
"the",
"individual",
"mission",
"item",
"based",
"on",
... | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9635-L9647 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.mission_clear_all_send | def mission_clear_all_send(self, target_system, target_component, force_mavlink1=False):
'''
Delete all mission items at once.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
... | python | def mission_clear_all_send(self, target_system, target_component, force_mavlink1=False):
'''
Delete all mission items at once.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
... | [
"def",
"mission_clear_all_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"mission_clear_all_encode",
"(",
"target_system",
",",
"target_component",
... | Delete all mission items at once.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Delete",
"all",
"mission",
"items",
"at",
"once",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9659-L9667 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.data_stream_send | def data_stream_send(self, stream_id, message_rate, on_off, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The me... | python | def data_stream_send(self, stream_id, message_rate, on_off, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The me... | [
"def",
"data_stream_send",
"(",
"self",
",",
"stream_id",
",",
"message_rate",
",",
"on_off",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"data_stream_encode",
"(",
"stream_id",
",",
"message_rate",
",",
"o... | THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The message rate (uint16_t)
on_off : 1 stream is enabled, 0 stream is stopped. (uint8_t) | [
"THIS",
"INTERFACE",
"IS",
"DEPRECATED",
".",
"USE",
"MESSAGE_INTERVAL",
"INSTEAD",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L10178-L10187 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.command_ack_send | def command_ack_send(self, command, result, force_mavlink1=False):
'''
Report status of a command. Includes feedback wether the command was
executed.
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
result ... | python | def command_ack_send(self, command, result, force_mavlink1=False):
'''
Report status of a command. Includes feedback wether the command was
executed.
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
result ... | [
"def",
"command_ack_send",
"(",
"self",
",",
"command",
",",
"result",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"command_ack_encode",
"(",
"command",
",",
"result",
")",
",",
"force_mavlink1",
"=",
"fo... | Report status of a command. Includes feedback wether the command was
executed.
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
result : See MAV_RESULT enum (uint8_t) | [
"Report",
"status",
"of",
"a",
"command",
".",
"Includes",
"feedback",
"wether",
"the",
"command",
"was",
"executed",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L10452-L10461 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.timesync_send | def timesync_send(self, tc1, ts1, force_mavlink1=False):
'''
Time synchronization message.
tc1 : Time sync timestamp 1 (int64_t)
ts1 : Time sync timestamp 2 (int64_t)
'''
return ... | python | def timesync_send(self, tc1, ts1, force_mavlink1=False):
'''
Time synchronization message.
tc1 : Time sync timestamp 1 (int64_t)
ts1 : Time sync timestamp 2 (int64_t)
'''
return ... | [
"def",
"timesync_send",
"(",
"self",
",",
"tc1",
",",
"ts1",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"timesync_encode",
"(",
"tc1",
",",
"ts1",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"... | Time synchronization message.
tc1 : Time sync timestamp 1 (int64_t)
ts1 : Time sync timestamp 2 (int64_t) | [
"Time",
"synchronization",
"message",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11391-L11399 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.camera_trigger_send | def camera_trigger_send(self, time_usec, seq, force_mavlink1=False):
'''
Camera-IMU triggering and synchronisation message.
time_usec : Timestamp for the image frame in microseconds (uint64_t)
seq : Image frame sequen... | python | def camera_trigger_send(self, time_usec, seq, force_mavlink1=False):
'''
Camera-IMU triggering and synchronisation message.
time_usec : Timestamp for the image frame in microseconds (uint64_t)
seq : Image frame sequen... | [
"def",
"camera_trigger_send",
"(",
"self",
",",
"time_usec",
",",
"seq",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"camera_trigger_encode",
"(",
"time_usec",
",",
"seq",
")",
",",
"force_mavlink1",
"=",
... | Camera-IMU triggering and synchronisation message.
time_usec : Timestamp for the image frame in microseconds (uint64_t)
seq : Image frame sequence (uint32_t) | [
"Camera",
"-",
"IMU",
"triggering",
"and",
"synchronisation",
"message",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11411-L11419 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.log_erase_send | def log_erase_send(self, target_system, target_component, force_mavlink1=False):
'''
Erase all logs
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(se... | python | def log_erase_send(self, target_system, target_component, force_mavlink1=False):
'''
Erase all logs
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(se... | [
"def",
"log_erase_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"log_erase_encode",
"(",
"target_system",
",",
"target_component",
")",
",",
"f... | Erase all logs
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Erase",
"all",
"logs"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11721-L11729 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.log_request_end_send | def log_request_end_send(self, target_system, target_component, force_mavlink1=False):
'''
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
... | python | def log_request_end_send(self, target_system, target_component, force_mavlink1=False):
'''
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
... | [
"def",
"log_request_end_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"log_request_end_encode",
"(",
"target_system",
",",
"target_component",
")",... | Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Stop",
"log",
"transfer",
"and",
"resume",
"normal",
"logging"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11741-L11749 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.power_status_send | def power_status_send(self, Vcc, Vservo, flags, force_mavlink1=False):
'''
Power supply status
Vcc : 5V rail voltage in millivolts (uint16_t)
Vservo : servo rail voltage in millivolts (uint16_t)
fla... | python | def power_status_send(self, Vcc, Vservo, flags, force_mavlink1=False):
'''
Power supply status
Vcc : 5V rail voltage in millivolts (uint16_t)
Vservo : servo rail voltage in millivolts (uint16_t)
fla... | [
"def",
"power_status_send",
"(",
"self",
",",
"Vcc",
",",
"Vservo",
",",
"flags",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"power_status_encode",
"(",
"Vcc",
",",
"Vservo",
",",
"flags",
")",
",",
... | Power supply status
Vcc : 5V rail voltage in millivolts (uint16_t)
Vservo : servo rail voltage in millivolts (uint16_t)
flags : power supply status flags (see MAV_POWER_STATUS enum) (uint16_t) | [
"Power",
"supply",
"status"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11828-L11837 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.terrain_check_send | def terrain_check_send(self, lat, lon, force_mavlink1=False):
'''
Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data
needed for a mission.
lat : ... | python | def terrain_check_send(self, lat, lon, force_mavlink1=False):
'''
Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data
needed for a mission.
lat : ... | [
"def",
"terrain_check_send",
"(",
"self",
",",
"lat",
",",
"lon",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"terrain_check_encode",
"(",
"lat",
",",
"lon",
")",
",",
"force_mavlink1",
"=",
"force_mavlin... | Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data
needed for a mission.
lat : Latitude (degrees *10^7) (int32_t)
lon : Longitude (degrees ... | [
"Request",
"that",
"the",
"vehicle",
"report",
"terrain",
"height",
"at",
"the",
"given",
"location",
".",
"Used",
"by",
"GCS",
"to",
"check",
"if",
"vehicle",
"has",
"all",
"terrain",
"data",
"needed",
"for",
"a",
"mission",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12149-L12159 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.gps_input_encode | def gps_input_encode(self, time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible):
'''
GPS sensor input message. This is a raw sensor value sent by the GPS.
... | python | def gps_input_encode(self, time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible):
'''
GPS sensor input message. This is a raw sensor value sent by the GPS.
... | [
"def",
"gps_input_encode",
"(",
"self",
",",
"time_usec",
",",
"gps_id",
",",
"ignore_flags",
",",
"time_week_ms",
",",
"time_week",
",",
"fix_type",
",",
"lat",
",",
"lon",
",",
"alt",
",",
"hdop",
",",
"vdop",
",",
"vn",
",",
"ve",
",",
"vd",
",",
... | GPS sensor input message. This is a raw sensor value sent by the GPS.
This is NOT the global position estimate of the sytem.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
gps_id : ID of the GPS for multiple GPS inp... | [
"GPS",
"sensor",
"input",
"message",
".",
"This",
"is",
"a",
"raw",
"sensor",
"value",
"sent",
"by",
"the",
"GPS",
".",
"This",
"is",
"NOT",
"the",
"global",
"position",
"estimate",
"of",
"the",
"sytem",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12663-L12688 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.message_interval_send | def message_interval_send(self, message_id, interval_us, force_mavlink1=False):
'''
This interface replaces DATA_STREAM
message_id : The ID of the requested MAVLink message. v1.0 is limited to 254 messages. (uint16_t)
interval_us ... | python | def message_interval_send(self, message_id, interval_us, force_mavlink1=False):
'''
This interface replaces DATA_STREAM
message_id : The ID of the requested MAVLink message. v1.0 is limited to 254 messages. (uint16_t)
interval_us ... | [
"def",
"message_interval_send",
"(",
"self",
",",
"message_id",
",",
"interval_us",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"message_interval_encode",
"(",
"message_id",
",",
"interval_us",
")",
",",
"for... | This interface replaces DATA_STREAM
message_id : The ID of the requested MAVLink message. v1.0 is limited to 254 messages. (uint16_t)
interval_us : The interval between two messages, in microseconds. A value of -1 indicates this stream is disabled, 0 indicat... | [
"This",
"interface",
"replaces",
"DATA_STREAM"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12903-L12911 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.extended_sys_state_send | def extended_sys_state_send(self, vtol_state, landed_state, force_mavlink1=False):
'''
Provides state for additional features
vtol_state : The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. (uint8_t)
... | python | def extended_sys_state_send(self, vtol_state, landed_state, force_mavlink1=False):
'''
Provides state for additional features
vtol_state : The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. (uint8_t)
... | [
"def",
"extended_sys_state_send",
"(",
"self",
",",
"vtol_state",
",",
"landed_state",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"extended_sys_state_encode",
"(",
"vtol_state",
",",
"landed_state",
")",
",",
... | Provides state for additional features
vtol_state : The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. (uint8_t)
landed_state : The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknow... | [
"Provides",
"state",
"for",
"additional",
"features"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12923-L12931 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.named_value_float_send | def named_value_float_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for
testing new messages and getting experimental de... | python | def named_value_float_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for
testing new messages and getting experimental de... | [
"def",
"named_value_float_send",
"(",
"self",
",",
"time_boot_ms",
",",
"name",
",",
"value",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"named_value_float_encode",
"(",
"time_boot_ms",
",",
"name",
",",
"... | Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for
testing new messages and getting experimental debug
output.
time_boot_ms : Timestamp (milliseconds since system boot) (ui... | [
"Send",
"a",
"key",
"-",
"value",
"pair",
"as",
"float",
".",
"The",
"use",
"of",
"this",
"message",
"is",
"discouraged",
"for",
"normal",
"packets",
"but",
"a",
"quite",
"efficient",
"way",
"for",
"testing",
"new",
"messages",
"and",
"getting",
"experimen... | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L13101-L13113 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.named_value_int_send | def named_value_int_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient
way for testing new messages and getting experimental
... | python | def named_value_int_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient
way for testing new messages and getting experimental
... | [
"def",
"named_value_int_send",
"(",
"self",
",",
"time_boot_ms",
",",
"name",
",",
"value",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"named_value_int_encode",
"(",
"time_boot_ms",
",",
"name",
",",
"valu... | Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient
way for testing new messages and getting experimental
debug output.
time_boot_ms : Timestamp (milliseconds since system boot) (... | [
"Send",
"a",
"key",
"-",
"value",
"pair",
"as",
"integer",
".",
"The",
"use",
"of",
"this",
"message",
"is",
"discouraged",
"for",
"normal",
"packets",
"but",
"a",
"quite",
"efficient",
"way",
"for",
"testing",
"new",
"messages",
"and",
"getting",
"experim... | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L13129-L13141 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.debug_send | def debug_send(self, time_boot_ms, ind, value, force_mavlink1=False):
'''
Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as
DEBUG N.
time_boot_ms : Time... | python | def debug_send(self, time_boot_ms, ind, value, force_mavlink1=False):
'''
Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as
DEBUG N.
time_boot_ms : Time... | [
"def",
"debug_send",
"(",
"self",
",",
"time_boot_ms",
",",
"ind",
",",
"value",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"debug_encode",
"(",
"time_boot_ms",
",",
"ind",
",",
"value",
")",
",",
"f... | Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as
DEBUG N.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
ind : index of deb... | [
"Send",
"a",
"debug",
"value",
".",
"The",
"index",
"is",
"used",
"to",
"discriminate",
"between",
"values",
".",
"These",
"values",
"show",
"up",
"in",
"the",
"plot",
"of",
"QGroundControl",
"as",
"DEBUG",
"N",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L13186-L13197 | train |
JdeRobot/base | src/libs/comm_py/comm/ros/publisherMotors.py | PublisherMotors.sendVX | def sendVX(self, vx):
'''
Sends VX velocity.
@param vx: VX velocity
@type vx: float
'''
self.lock.acquire()
self.data.vx = vx
self.lock.release() | python | def sendVX(self, vx):
'''
Sends VX velocity.
@param vx: VX velocity
@type vx: float
'''
self.lock.acquire()
self.data.vx = vx
self.lock.release() | [
"def",
"sendVX",
"(",
"self",
",",
"vx",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"data",
".",
"vx",
"=",
"vx",
"self",
".",
"lock",
".",
"release",
"(",
")"
] | Sends VX velocity.
@param vx: VX velocity
@type vx: float | [
"Sends",
"VX",
"velocity",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/publisherMotors.py#L138-L149 | train |
JdeRobot/base | src/libs/comm_py/comm/ros/publisherMotors.py | PublisherMotors.sendVY | def sendVY(self, vy):
'''
Sends VY velocity.
@param vy: VY velocity
@type vy: float
'''
self.lock.acquire()
self.data.vy = vy
self.lock.release() | python | def sendVY(self, vy):
'''
Sends VY velocity.
@param vy: VY velocity
@type vy: float
'''
self.lock.acquire()
self.data.vy = vy
self.lock.release() | [
"def",
"sendVY",
"(",
"self",
",",
"vy",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"data",
".",
"vy",
"=",
"vy",
"self",
".",
"lock",
".",
"release",
"(",
")"
] | Sends VY velocity.
@param vy: VY velocity
@type vy: float | [
"Sends",
"VY",
"velocity",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/publisherMotors.py#L151-L162 | train |
JdeRobot/base | src/libs/comm_py/comm/ros/publisherMotors.py | PublisherMotors.sendAZ | def sendAZ(self, az):
'''
Sends AZ velocity.
@param az: AZ velocity
@type az: float
'''
self.lock.acquire()
self.data.az = az
self.lock.release() | python | def sendAZ(self, az):
'''
Sends AZ velocity.
@param az: AZ velocity
@type az: float
'''
self.lock.acquire()
self.data.az = az
self.lock.release() | [
"def",
"sendAZ",
"(",
"self",
",",
"az",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"data",
".",
"az",
"=",
"az",
"self",
".",
"lock",
".",
"release",
"(",
")"
] | Sends AZ velocity.
@param az: AZ velocity
@type az: float | [
"Sends",
"AZ",
"velocity",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/publisherMotors.py#L164-L175 | train |
JdeRobot/base | src/libs/comm_py/comm/ros/listenerBumper.py | bumperEvent2BumperData | def bumperEvent2BumperData(event):
'''
Translates from ROS BumperScan to JderobotTypes BumperData.
@param event: ROS BumperScan to translate
@type event: BumperScan
@return a BumperData translated from event
# bumper
LEFT = 0
CENTER = 1
RIGHT = 2
# state
RELEASED = ... | python | def bumperEvent2BumperData(event):
'''
Translates from ROS BumperScan to JderobotTypes BumperData.
@param event: ROS BumperScan to translate
@type event: BumperScan
@return a BumperData translated from event
# bumper
LEFT = 0
CENTER = 1
RIGHT = 2
# state
RELEASED = ... | [
"def",
"bumperEvent2BumperData",
"(",
"event",
")",
":",
"bump",
"=",
"BumperData",
"(",
")",
"bump",
".",
"state",
"=",
"event",
".",
"state",
"bump",
".",
"bumper",
"=",
"event",
".",
"bumper",
"return",
"bump"
] | Translates from ROS BumperScan to JderobotTypes BumperData.
@param event: ROS BumperScan to translate
@type event: BumperScan
@return a BumperData translated from event
# bumper
LEFT = 0
CENTER = 1
RIGHT = 2
# state
RELEASED = 0
PRESSED = 1 | [
"Translates",
"from",
"ROS",
"BumperScan",
"to",
"JderobotTypes",
"BumperData",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/listenerBumper.py#L11-L36 | train |
JdeRobot/base | src/libs/comm_py/comm/ros/listenerBumper.py | ListenerBumper.__callback | def __callback (self, event):
'''
Callback function to receive and save Bumper Scans.
@param event: ROS BumperScan received
@type event: BumperScan
'''
bump = bumperEvent2BumperData(event)
if bump.state == 1:
self.lock.acquire()
... | python | def __callback (self, event):
'''
Callback function to receive and save Bumper Scans.
@param event: ROS BumperScan received
@type event: BumperScan
'''
bump = bumperEvent2BumperData(event)
if bump.state == 1:
self.lock.acquire()
... | [
"def",
"__callback",
"(",
"self",
",",
"event",
")",
":",
"bump",
"=",
"bumperEvent2BumperData",
"(",
"event",
")",
"if",
"bump",
".",
"state",
"==",
"1",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"time",
"=",
"current_milli_time... | Callback function to receive and save Bumper Scans.
@param event: ROS BumperScan received
@type event: BumperScan | [
"Callback",
"function",
"to",
"receive",
"and",
"save",
"Bumper",
"Scans",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/listenerBumper.py#L58-L73 | train |
JdeRobot/base | src/libs/comm_py/comm/ros/listenerBumper.py | ListenerBumper.getBumperData | def getBumperData(self):
'''
Returns last BumperData.
@return last JdeRobotTypes BumperData saved
'''
self.lock.acquire()
t = current_milli_time()
if (t - self.time) > 500:
self.data.state = 0
bump = self.data
self.lock.release()
... | python | def getBumperData(self):
'''
Returns last BumperData.
@return last JdeRobotTypes BumperData saved
'''
self.lock.acquire()
t = current_milli_time()
if (t - self.time) > 500:
self.data.state = 0
bump = self.data
self.lock.release()
... | [
"def",
"getBumperData",
"(",
"self",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"t",
"=",
"current_milli_time",
"(",
")",
"if",
"(",
"t",
"-",
"self",
".",
"time",
")",
">",
"500",
":",
"self",
".",
"data",
".",
"state",
"=",
"0",
... | Returns last BumperData.
@return last JdeRobotTypes BumperData saved | [
"Returns",
"last",
"BumperData",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/listenerBumper.py#L89-L103 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_battery.py | BatteryModule.cmd_bat | def cmd_bat(self, args):
'''show battery levels'''
print("Flight battery: %u%%" % self.battery_level)
if self.settings.numcells != 0:
print("%.2f V/cell for %u cells - approx %u%%" % (self.per_cell,
self.settings.numcell... | python | def cmd_bat(self, args):
'''show battery levels'''
print("Flight battery: %u%%" % self.battery_level)
if self.settings.numcells != 0:
print("%.2f V/cell for %u cells - approx %u%%" % (self.per_cell,
self.settings.numcell... | [
"def",
"cmd_bat",
"(",
"self",
",",
"args",
")",
":",
"print",
"(",
"\"Flight battery: %u%%\"",
"%",
"self",
".",
"battery_level",
")",
"if",
"self",
".",
"settings",
".",
"numcells",
"!=",
"0",
":",
"print",
"(",
"\"%.2f V/cell for %u cells - approx %u%%\"",
... | show battery levels | [
"show",
"battery",
"levels"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_battery.py#L38-L44 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_battery.py | BatteryModule.battery_update | def battery_update(self, SYS_STATUS):
'''update battery level'''
# main flight battery
self.battery_level = SYS_STATUS.battery_remaining
self.voltage_level = SYS_STATUS.voltage_battery
self.current_battery = SYS_STATUS.current_battery
if self.settings.numcells != 0:
... | python | def battery_update(self, SYS_STATUS):
'''update battery level'''
# main flight battery
self.battery_level = SYS_STATUS.battery_remaining
self.voltage_level = SYS_STATUS.voltage_battery
self.current_battery = SYS_STATUS.current_battery
if self.settings.numcells != 0:
... | [
"def",
"battery_update",
"(",
"self",
",",
"SYS_STATUS",
")",
":",
"self",
".",
"battery_level",
"=",
"SYS_STATUS",
".",
"battery_remaining",
"self",
".",
"voltage_level",
"=",
"SYS_STATUS",
".",
"voltage_battery",
"self",
".",
"current_battery",
"=",
"SYS_STATUS"... | update battery level | [
"update",
"battery",
"level"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_battery.py#L92-L99 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py | CalibrationModule.cmd_accelcal | def cmd_accelcal(self, args):
'''do a full 3D accel calibration'''
mav = self.master
# ack the APM to begin 3D calibration of accelerometers
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION,... | python | def cmd_accelcal(self, args):
'''do a full 3D accel calibration'''
mav = self.master
# ack the APM to begin 3D calibration of accelerometers
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION,... | [
"def",
"cmd_accelcal",
"(",
"self",
",",
"args",
")",
":",
"mav",
"=",
"self",
".",
"master",
"mav",
".",
"mav",
".",
"command_long_send",
"(",
"mav",
".",
"target_system",
",",
"mav",
".",
"target_component",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CM... | do a full 3D accel calibration | [
"do",
"a",
"full",
"3D",
"accel",
"calibration"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py#L34-L42 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py | CalibrationModule.cmd_gyrocal | def cmd_gyrocal(self, args):
'''do a full gyro calibration'''
mav = self.master
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, 0,
1, 0, 0, 0, 0, 0, 0) | python | def cmd_gyrocal(self, args):
'''do a full gyro calibration'''
mav = self.master
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, 0,
1, 0, 0, 0, 0, 0, 0) | [
"def",
"cmd_gyrocal",
"(",
"self",
",",
"args",
")",
":",
"mav",
"=",
"self",
".",
"master",
"mav",
".",
"mav",
".",
"command_long_send",
"(",
"mav",
".",
"target_system",
",",
"mav",
".",
"target_component",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD... | do a full gyro calibration | [
"do",
"a",
"full",
"gyro",
"calibration"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py#L44-L49 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py | CalibrationModule.cmd_magcal | def cmd_magcal(self, args):
'''control magnetometer calibration'''
if len(args) < 1:
print("Usage: magcal <start|accept|cancel>")
return
if args[0] == 'start':
self.master.mav.command_long_send(
self.settings.target_system, # target_system
... | python | def cmd_magcal(self, args):
'''control magnetometer calibration'''
if len(args) < 1:
print("Usage: magcal <start|accept|cancel>")
return
if args[0] == 'start':
self.master.mav.command_long_send(
self.settings.target_system, # target_system
... | [
"def",
"cmd_magcal",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"print",
"(",
"\"Usage: magcal <start|accept|cancel>\"",
")",
"return",
"if",
"args",
"[",
"0",
"]",
"==",
"'start'",
":",
"self",
".",
"master",
"."... | control magnetometer calibration | [
"control",
"magnetometer",
"calibration"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py#L114-L158 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.set_fence_enabled | def set_fence_enabled(self, do_enable):
'''Enable or disable fence'''
self.master.mav.command_long_send(
self.target_system,
self.target_component,
mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE, 0,
do_enable, 0, 0, 0, 0, 0, 0) | python | def set_fence_enabled(self, do_enable):
'''Enable or disable fence'''
self.master.mav.command_long_send(
self.target_system,
self.target_component,
mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE, 0,
do_enable, 0, 0, 0, 0, 0, 0) | [
"def",
"set_fence_enabled",
"(",
"self",
",",
"do_enable",
")",
":",
"self",
".",
"master",
".",
"mav",
".",
"command_long_send",
"(",
"self",
".",
"target_system",
",",
"self",
".",
"target_component",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_DO_FENCE_EN... | Enable or disable fence | [
"Enable",
"or",
"disable",
"fence"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L96-L102 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.cmd_fence_move | def cmd_fence_move(self, args):
'''handle fencepoint move'''
if len(args) < 1:
print("Usage: fence move FENCEPOINTNUM")
return
if not self.have_list:
print("Please list fence points first")
return
idx = int(args[0])
if idx <= 0 or ... | python | def cmd_fence_move(self, args):
'''handle fencepoint move'''
if len(args) < 1:
print("Usage: fence move FENCEPOINTNUM")
return
if not self.have_list:
print("Please list fence points first")
return
idx = int(args[0])
if idx <= 0 or ... | [
"def",
"cmd_fence_move",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"print",
"(",
"\"Usage: fence move FENCEPOINTNUM\"",
")",
"return",
"if",
"not",
"self",
".",
"have_list",
":",
"print",
"(",
"\"Please list fence poin... | handle fencepoint move | [
"handle",
"fencepoint",
"move"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L104-L130 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.cmd_fence_remove | def cmd_fence_remove(self, args):
'''handle fencepoint remove'''
if len(args) < 1:
print("Usage: fence remove FENCEPOINTNUM")
return
if not self.have_list:
print("Please list fence points first")
return
idx = int(args[0])
if idx <=... | python | def cmd_fence_remove(self, args):
'''handle fencepoint remove'''
if len(args) < 1:
print("Usage: fence remove FENCEPOINTNUM")
return
if not self.have_list:
print("Please list fence points first")
return
idx = int(args[0])
if idx <=... | [
"def",
"cmd_fence_remove",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"print",
"(",
"\"Usage: fence remove FENCEPOINTNUM\"",
")",
"return",
"if",
"not",
"self",
".",
"have_list",
":",
"print",
"(",
"\"Please list fence ... | handle fencepoint remove | [
"handle",
"fencepoint",
"remove"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L132-L151 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.send_fence | def send_fence(self):
'''send fence points from fenceloader'''
# must disable geo-fencing when loading
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
self.fenceloader.reindex()
action = self.get_mav_param('FEN... | python | def send_fence(self):
'''send fence points from fenceloader'''
# must disable geo-fencing when loading
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
self.fenceloader.reindex()
action = self.get_mav_param('FEN... | [
"def",
"send_fence",
"(",
"self",
")",
":",
"self",
".",
"fenceloader",
".",
"target_system",
"=",
"self",
".",
"target_system",
"self",
".",
"fenceloader",
".",
"target_component",
"=",
"self",
".",
"target_component",
"self",
".",
"fenceloader",
".",
"reinde... | send fence points from fenceloader | [
"send",
"fence",
"points",
"from",
"fenceloader"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L208-L231 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.fetch_fence_point | def fetch_fence_point(self ,i):
'''fetch one fence point'''
self.master.mav.fence_fetch_point_send(self.target_system,
self.target_component, i)
tstart = time.time()
p = None
while time.time() - tstart < 3:
p = self.... | python | def fetch_fence_point(self ,i):
'''fetch one fence point'''
self.master.mav.fence_fetch_point_send(self.target_system,
self.target_component, i)
tstart = time.time()
p = None
while time.time() - tstart < 3:
p = self.... | [
"def",
"fetch_fence_point",
"(",
"self",
",",
"i",
")",
":",
"self",
".",
"master",
".",
"mav",
".",
"fence_fetch_point_send",
"(",
"self",
".",
"target_system",
",",
"self",
".",
"target_component",
",",
"i",
")",
"tstart",
"=",
"time",
".",
"time",
"("... | fetch one fence point | [
"fetch",
"one",
"fence",
"point"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L233-L248 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.fence_draw_callback | def fence_draw_callback(self, points):
'''callback from drawing a fence'''
self.fenceloader.clear()
if len(points) < 3:
return
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
bounds = mp_util.polygo... | python | def fence_draw_callback(self, points):
'''callback from drawing a fence'''
self.fenceloader.clear()
if len(points) < 3:
return
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
bounds = mp_util.polygo... | [
"def",
"fence_draw_callback",
"(",
"self",
",",
"points",
")",
":",
"self",
".",
"fenceloader",
".",
"clear",
"(",
")",
"if",
"len",
"(",
"points",
")",
"<",
"3",
":",
"return",
"self",
".",
"fenceloader",
".",
"target_system",
"=",
"self",
".",
"targe... | callback from drawing a fence | [
"callback",
"from",
"drawing",
"a",
"fence"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L250-L266 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_console.py | ConsoleModule.add_menu | def add_menu(self, menu):
'''add a new menu'''
self.menu.add(menu)
self.mpstate.console.set_menu(self.menu, self.menu_callback) | python | def add_menu(self, menu):
'''add a new menu'''
self.menu.add(menu)
self.mpstate.console.set_menu(self.menu, self.menu_callback) | [
"def",
"add_menu",
"(",
"self",
",",
"menu",
")",
":",
"self",
".",
"menu",
".",
"add",
"(",
"menu",
")",
"self",
".",
"mpstate",
".",
"console",
".",
"set_menu",
"(",
"self",
".",
"menu",
",",
"self",
".",
"menu_callback",
")"
] | add a new menu | [
"add",
"a",
"new",
"menu"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_console.py#L67-L70 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_console.py | ConsoleModule.estimated_time_remaining | def estimated_time_remaining(self, lat, lon, wpnum, speed):
'''estimate time remaining in mission in seconds'''
idx = wpnum
if wpnum >= self.module('wp').wploader.count():
return 0
distance = 0
done = set()
while idx < self.module('wp').wploader.count():
... | python | def estimated_time_remaining(self, lat, lon, wpnum, speed):
'''estimate time remaining in mission in seconds'''
idx = wpnum
if wpnum >= self.module('wp').wploader.count():
return 0
distance = 0
done = set()
while idx < self.module('wp').wploader.count():
... | [
"def",
"estimated_time_remaining",
"(",
"self",
",",
"lat",
",",
"lon",
",",
"wpnum",
",",
"speed",
")",
":",
"idx",
"=",
"wpnum",
"if",
"wpnum",
">=",
"self",
".",
"module",
"(",
"'wp'",
")",
".",
"wploader",
".",
"count",
"(",
")",
":",
"return",
... | estimate time remaining in mission in seconds | [
"estimate",
"time",
"remaining",
"in",
"mission",
"in",
"seconds"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_console.py#L90-L117 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Vector3.angle | def angle(self, v):
'''return the angle between this vector and another vector'''
return acos((self * v) / (self.length() * v.length())) | python | def angle(self, v):
'''return the angle between this vector and another vector'''
return acos((self * v) / (self.length() * v.length())) | [
"def",
"angle",
"(",
"self",
",",
"v",
")",
":",
"return",
"acos",
"(",
"(",
"self",
"*",
"v",
")",
"/",
"(",
"self",
".",
"length",
"(",
")",
"*",
"v",
".",
"length",
"(",
")",
")",
")"
] | return the angle between this vector and another vector | [
"return",
"the",
"angle",
"between",
"this",
"vector",
"and",
"another",
"vector"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L114-L116 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.from_euler | def from_euler(self, roll, pitch, yaw):
'''fill the matrix from Euler angles in radians'''
cp = cos(pitch)
sp = sin(pitch)
sr = sin(roll)
cr = cos(roll)
sy = sin(yaw)
cy = cos(yaw)
self.a.x = cp * cy
self.a.y = (sr * sp * cy) - (cr * sy)
s... | python | def from_euler(self, roll, pitch, yaw):
'''fill the matrix from Euler angles in radians'''
cp = cos(pitch)
sp = sin(pitch)
sr = sin(roll)
cr = cos(roll)
sy = sin(yaw)
cy = cos(yaw)
self.a.x = cp * cy
self.a.y = (sr * sp * cy) - (cr * sy)
s... | [
"def",
"from_euler",
"(",
"self",
",",
"roll",
",",
"pitch",
",",
"yaw",
")",
":",
"cp",
"=",
"cos",
"(",
"pitch",
")",
"sp",
"=",
"sin",
"(",
"pitch",
")",
"sr",
"=",
"sin",
"(",
"roll",
")",
"cr",
"=",
"cos",
"(",
"roll",
")",
"sy",
"=",
... | fill the matrix from Euler angles in radians | [
"fill",
"the",
"matrix",
"from",
"Euler",
"angles",
"in",
"radians"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L154-L171 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.from_euler312 | def from_euler312(self, roll, pitch, yaw):
'''fill the matrix from Euler angles in radians in 312 convention'''
c3 = cos(pitch)
s3 = sin(pitch)
s2 = sin(roll)
c2 = cos(roll)
s1 = sin(yaw)
c1 = cos(yaw)
self.a.x = c1 * c3 - s1 * s2 * s3
self.b.y = ... | python | def from_euler312(self, roll, pitch, yaw):
'''fill the matrix from Euler angles in radians in 312 convention'''
c3 = cos(pitch)
s3 = sin(pitch)
s2 = sin(roll)
c2 = cos(roll)
s1 = sin(yaw)
c1 = cos(yaw)
self.a.x = c1 * c3 - s1 * s2 * s3
self.b.y = ... | [
"def",
"from_euler312",
"(",
"self",
",",
"roll",
",",
"pitch",
",",
"yaw",
")",
":",
"c3",
"=",
"cos",
"(",
"pitch",
")",
"s3",
"=",
"sin",
"(",
"pitch",
")",
"s2",
"=",
"sin",
"(",
"roll",
")",
"c2",
"=",
"cos",
"(",
"roll",
")",
"s1",
"=",... | fill the matrix from Euler angles in radians in 312 convention | [
"fill",
"the",
"matrix",
"from",
"Euler",
"angles",
"in",
"radians",
"in",
"312",
"convention"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L201-L218 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.rotate | def rotate(self, g):
'''rotate the matrix by a given amount on 3 axes'''
temp_matrix = Matrix3()
a = self.a
b = self.b
c = self.c
temp_matrix.a.x = a.y * g.z - a.z * g.y
temp_matrix.a.y = a.z * g.x - a.x * g.z
temp_matrix.a.z = a.x * g.y - a.y * g.x
... | python | def rotate(self, g):
'''rotate the matrix by a given amount on 3 axes'''
temp_matrix = Matrix3()
a = self.a
b = self.b
c = self.c
temp_matrix.a.x = a.y * g.z - a.z * g.y
temp_matrix.a.y = a.z * g.x - a.x * g.z
temp_matrix.a.z = a.x * g.y - a.y * g.x
... | [
"def",
"rotate",
"(",
"self",
",",
"g",
")",
":",
"temp_matrix",
"=",
"Matrix3",
"(",
")",
"a",
"=",
"self",
".",
"a",
"b",
"=",
"self",
".",
"b",
"c",
"=",
"self",
".",
"c",
"temp_matrix",
".",
"a",
".",
"x",
"=",
"a",
".",
"y",
"*",
"g",
... | rotate the matrix by a given amount on 3 axes | [
"rotate",
"the",
"matrix",
"by",
"a",
"given",
"amount",
"on",
"3",
"axes"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L262-L279 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.normalize | def normalize(self):
'''re-normalise a rotation matrix'''
error = self.a * self.b
t0 = self.a - (self.b * (0.5 * error))
t1 = self.b - (self.a * (0.5 * error))
t2 = t0 % t1
self.a = t0 * (1.0 / t0.length())
self.b = t1 * (1.0 / t1.length())
self.c = t2 * (... | python | def normalize(self):
'''re-normalise a rotation matrix'''
error = self.a * self.b
t0 = self.a - (self.b * (0.5 * error))
t1 = self.b - (self.a * (0.5 * error))
t2 = t0 % t1
self.a = t0 * (1.0 / t0.length())
self.b = t1 * (1.0 / t1.length())
self.c = t2 * (... | [
"def",
"normalize",
"(",
"self",
")",
":",
"error",
"=",
"self",
".",
"a",
"*",
"self",
".",
"b",
"t0",
"=",
"self",
".",
"a",
"-",
"(",
"self",
".",
"b",
"*",
"(",
"0.5",
"*",
"error",
")",
")",
"t1",
"=",
"self",
".",
"b",
"-",
"(",
"se... | re-normalise a rotation matrix | [
"re",
"-",
"normalise",
"a",
"rotation",
"matrix"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L281-L289 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.trace | def trace(self):
'''the trace of the matrix'''
return self.a.x + self.b.y + self.c.z | python | def trace(self):
'''the trace of the matrix'''
return self.a.x + self.b.y + self.c.z | [
"def",
"trace",
"(",
"self",
")",
":",
"return",
"self",
".",
"a",
".",
"x",
"+",
"self",
".",
"b",
".",
"y",
"+",
"self",
".",
"c",
".",
"z"
] | the trace of the matrix | [
"the",
"trace",
"of",
"the",
"matrix"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L291-L293 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.from_axis_angle | def from_axis_angle(self, axis, angle):
'''create a rotation matrix from axis and angle'''
ux = axis.x
uy = axis.y
uz = axis.z
ct = cos(angle)
st = sin(angle)
self.a.x = ct + (1-ct) * ux**2
self.a.y = ux*uy*(1-ct) - uz*st
self.a.z = ux*uz*(1-ct) + ... | python | def from_axis_angle(self, axis, angle):
'''create a rotation matrix from axis and angle'''
ux = axis.x
uy = axis.y
uz = axis.z
ct = cos(angle)
st = sin(angle)
self.a.x = ct + (1-ct) * ux**2
self.a.y = ux*uy*(1-ct) - uz*st
self.a.z = ux*uz*(1-ct) + ... | [
"def",
"from_axis_angle",
"(",
"self",
",",
"axis",
",",
"angle",
")",
":",
"ux",
"=",
"axis",
".",
"x",
"uy",
"=",
"axis",
".",
"y",
"uz",
"=",
"axis",
".",
"z",
"ct",
"=",
"cos",
"(",
"angle",
")",
"st",
"=",
"sin",
"(",
"angle",
")",
"self... | create a rotation matrix from axis and angle | [
"create",
"a",
"rotation",
"matrix",
"from",
"axis",
"and",
"angle"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L295-L310 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.from_two_vectors | def from_two_vectors(self, vec1, vec2):
'''get a rotation matrix from two vectors.
This returns a rotation matrix which when applied to vec1
will produce a vector pointing in the same direction as vec2'''
angle = vec1.angle(vec2)
cross = vec1 % vec2
if cross.length(... | python | def from_two_vectors(self, vec1, vec2):
'''get a rotation matrix from two vectors.
This returns a rotation matrix which when applied to vec1
will produce a vector pointing in the same direction as vec2'''
angle = vec1.angle(vec2)
cross = vec1 % vec2
if cross.length(... | [
"def",
"from_two_vectors",
"(",
"self",
",",
"vec1",
",",
"vec2",
")",
":",
"angle",
"=",
"vec1",
".",
"angle",
"(",
"vec2",
")",
"cross",
"=",
"vec1",
"%",
"vec2",
"if",
"cross",
".",
"length",
"(",
")",
"==",
"0",
":",
"return",
"self",
".",
"f... | get a rotation matrix from two vectors.
This returns a rotation matrix which when applied to vec1
will produce a vector pointing in the same direction as vec2 | [
"get",
"a",
"rotation",
"matrix",
"from",
"two",
"vectors",
".",
"This",
"returns",
"a",
"rotation",
"matrix",
"which",
"when",
"applied",
"to",
"vec1",
"will",
"produce",
"a",
"vector",
"pointing",
"in",
"the",
"same",
"direction",
"as",
"vec2"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L313-L323 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Line.plane_intersection | def plane_intersection(self, plane, forward_only=False):
'''return point where line intersects with a plane'''
l_dot_n = self.vector * plane.normal
if l_dot_n == 0.0:
# line is parallel to the plane
return None
d = ((plane.point - self.point) * plane.normal) / l_d... | python | def plane_intersection(self, plane, forward_only=False):
'''return point where line intersects with a plane'''
l_dot_n = self.vector * plane.normal
if l_dot_n == 0.0:
# line is parallel to the plane
return None
d = ((plane.point - self.point) * plane.normal) / l_d... | [
"def",
"plane_intersection",
"(",
"self",
",",
"plane",
",",
"forward_only",
"=",
"False",
")",
":",
"l_dot_n",
"=",
"self",
".",
"vector",
"*",
"plane",
".",
"normal",
"if",
"l_dot_n",
"==",
"0.0",
":",
"return",
"None",
"d",
"=",
"(",
"(",
"plane",
... | return point where line intersects with a plane | [
"return",
"point",
"where",
"line",
"intersects",
"with",
"a",
"plane"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L348-L357 | train |
JdeRobot/base | src/libs/comm_py/comm/ice/rgbdIceClient.py | RgbdCamera.getRgbd | def getRgbd(self):
'''
Returns last Rgbd.
@return last JdeRobotTypes Rgbd saved
'''
img = Rgb()
if self.hasproxy():
self.lock.acquire()
img = self.image
self.lock.release()
return img | python | def getRgbd(self):
'''
Returns last Rgbd.
@return last JdeRobotTypes Rgbd saved
'''
img = Rgb()
if self.hasproxy():
self.lock.acquire()
img = self.image
self.lock.release()
return img | [
"def",
"getRgbd",
"(",
"self",
")",
":",
"img",
"=",
"Rgb",
"(",
")",
"if",
"self",
".",
"hasproxy",
"(",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"img",
"=",
"self",
".",
"image",
"self",
".",
"lock",
".",
"release",
"(",
")",
... | Returns last Rgbd.
@return last JdeRobotTypes Rgbd saved | [
"Returns",
"last",
"Rgbd",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ice/rgbdIceClient.py#L97-L109 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_graph.py | Graph.add_mavlink_packet | def add_mavlink_packet(self, msg):
'''add data to the graph'''
mtype = msg.get_type()
if mtype not in self.msg_types:
return
for i in range(len(self.fields)):
if mtype not in self.field_types[i]:
continue
f = self.fields[i]
... | python | def add_mavlink_packet(self, msg):
'''add data to the graph'''
mtype = msg.get_type()
if mtype not in self.msg_types:
return
for i in range(len(self.fields)):
if mtype not in self.field_types[i]:
continue
f = self.fields[i]
... | [
"def",
"add_mavlink_packet",
"(",
"self",
",",
"msg",
")",
":",
"mtype",
"=",
"msg",
".",
"get_type",
"(",
")",
"if",
"mtype",
"not",
"in",
"self",
".",
"msg_types",
":",
"return",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"fields",
... | add data to the graph | [
"add",
"data",
"to",
"the",
"graph"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_graph.py#L104-L115 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_javascript.py | generate | def generate(basename, xml):
'''generate complete javascript implementation'''
if basename.endswith('.js'):
filename = basename
else:
filename = basename + '.js'
msgs = []
enums = []
filelist = []
for x in xml:
msgs.extend(x.message)
enums.extend(x.enum)
... | python | def generate(basename, xml):
'''generate complete javascript implementation'''
if basename.endswith('.js'):
filename = basename
else:
filename = basename + '.js'
msgs = []
enums = []
filelist = []
for x in xml:
msgs.extend(x.message)
enums.extend(x.enum)
... | [
"def",
"generate",
"(",
"basename",
",",
"xml",
")",
":",
"if",
"basename",
".",
"endswith",
"(",
"'.js'",
")",
":",
"filename",
"=",
"basename",
"else",
":",
"filename",
"=",
"basename",
"+",
"'.js'",
"msgs",
"=",
"[",
"]",
"enums",
"=",
"[",
"]",
... | generate complete javascript implementation | [
"generate",
"complete",
"javascript",
"implementation"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_javascript.py#L538-L574 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavflightmodes.py | flight_modes | def flight_modes(logfile):
'''show flight modes for a log file'''
print("Processing log %s" % filename)
mlog = mavutil.mavlink_connection(filename)
mode = ""
previous_mode = ""
mode_start_timestamp = -1
time_in_mode = {}
previous_percent = -1
seconds_per_percent = -1
filesize =... | python | def flight_modes(logfile):
'''show flight modes for a log file'''
print("Processing log %s" % filename)
mlog = mavutil.mavlink_connection(filename)
mode = ""
previous_mode = ""
mode_start_timestamp = -1
time_in_mode = {}
previous_percent = -1
seconds_per_percent = -1
filesize =... | [
"def",
"flight_modes",
"(",
"logfile",
")",
":",
"print",
"(",
"\"Processing log %s\"",
"%",
"filename",
")",
"mlog",
"=",
"mavutil",
".",
"mavlink_connection",
"(",
"filename",
")",
"mode",
"=",
"\"\"",
"previous_mode",
"=",
"\"\"",
"mode_start_timestamp",
"=",... | show flight modes for a log file | [
"show",
"flight",
"modes",
"for",
"a",
"log",
"file"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavflightmodes.py#L18-L80 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py | have_graph | def have_graph(name):
'''return true if we have a graph of the given name'''
for g in mestate.graphs:
if g.name == name:
return True
return False | python | def have_graph(name):
'''return true if we have a graph of the given name'''
for g in mestate.graphs:
if g.name == name:
return True
return False | [
"def",
"have_graph",
"(",
"name",
")",
":",
"for",
"g",
"in",
"mestate",
".",
"graphs",
":",
"if",
"g",
".",
"name",
"==",
"name",
":",
"return",
"True",
"return",
"False"
] | return true if we have a graph of the given name | [
"return",
"true",
"if",
"we",
"have",
"a",
"graph",
"of",
"the",
"given",
"name"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L67-L72 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py | expression_ok | def expression_ok(expression):
'''return True if an expression is OK with current messages'''
expression_ok = True
fields = expression.split()
for f in fields:
try:
if f.endswith(':2'):
f = f[:-2]
if mavutil.evaluate_expression(f, mestate.status.msgs) is N... | python | def expression_ok(expression):
'''return True if an expression is OK with current messages'''
expression_ok = True
fields = expression.split()
for f in fields:
try:
if f.endswith(':2'):
f = f[:-2]
if mavutil.evaluate_expression(f, mestate.status.msgs) is N... | [
"def",
"expression_ok",
"(",
"expression",
")",
":",
"expression_ok",
"=",
"True",
"fields",
"=",
"expression",
".",
"split",
"(",
")",
"for",
"f",
"in",
"fields",
":",
"try",
":",
"if",
"f",
".",
"endswith",
"(",
"':2'",
")",
":",
"f",
"=",
"f",
"... | return True if an expression is OK with current messages | [
"return",
"True",
"if",
"an",
"expression",
"is",
"OK",
"with",
"current",
"messages"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L129-L142 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py | load_graph_xml | def load_graph_xml(xml, filename, load_all=False):
'''load a graph from one xml string'''
ret = []
try:
root = objectify.fromstring(xml)
except Exception:
return []
if root.tag != 'graphs':
return []
if not hasattr(root, 'graph'):
return []
for g in root.graph... | python | def load_graph_xml(xml, filename, load_all=False):
'''load a graph from one xml string'''
ret = []
try:
root = objectify.fromstring(xml)
except Exception:
return []
if root.tag != 'graphs':
return []
if not hasattr(root, 'graph'):
return []
for g in root.graph... | [
"def",
"load_graph_xml",
"(",
"xml",
",",
"filename",
",",
"load_all",
"=",
"False",
")",
":",
"ret",
"=",
"[",
"]",
"try",
":",
"root",
"=",
"objectify",
".",
"fromstring",
"(",
"xml",
")",
"except",
"Exception",
":",
"return",
"[",
"]",
"if",
"root... | load a graph from one xml string | [
"load",
"a",
"graph",
"from",
"one",
"xml",
"string"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L144-L167 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py | cmd_condition | def cmd_condition(args):
'''control MAVExporer conditions'''
if len(args) == 0:
print("condition is: %s" % mestate.settings.condition)
return
mestate.settings.condition = ' '.join(args)
if len(mestate.settings.condition) == 0 or mestate.settings.condition == 'clear':
mestate.sett... | python | def cmd_condition(args):
'''control MAVExporer conditions'''
if len(args) == 0:
print("condition is: %s" % mestate.settings.condition)
return
mestate.settings.condition = ' '.join(args)
if len(mestate.settings.condition) == 0 or mestate.settings.condition == 'clear':
mestate.sett... | [
"def",
"cmd_condition",
"(",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"\"condition is: %s\"",
"%",
"mestate",
".",
"settings",
".",
"condition",
")",
"return",
"mestate",
".",
"settings",
".",
"condition",
"=",
"' '"... | control MAVExporer conditions | [
"control",
"MAVExporer",
"conditions"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L260-L267 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ualberta.py | MAVLink.ualberta_sys_status_send | def ualberta_sys_status_send(self, mode, nav_mode, pilot, force_mavlink1=False):
'''
System status specific to ualberta uav
mode : System mode, see UALBERTA_AUTOPILOT_MODE ENUM (uint8_t)
nav_mode : Navigation mode, se... | python | def ualberta_sys_status_send(self, mode, nav_mode, pilot, force_mavlink1=False):
'''
System status specific to ualberta uav
mode : System mode, see UALBERTA_AUTOPILOT_MODE ENUM (uint8_t)
nav_mode : Navigation mode, se... | [
"def",
"ualberta_sys_status_send",
"(",
"self",
",",
"mode",
",",
"nav_mode",
",",
"pilot",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"ualberta_sys_status_encode",
"(",
"mode",
",",
"nav_mode",
",",
"pilo... | System status specific to ualberta uav
mode : System mode, see UALBERTA_AUTOPILOT_MODE ENUM (uint8_t)
nav_mode : Navigation mode, see UALBERTA_NAV_MODE ENUM (uint8_t)
pilot : Pilot mode, see UALBERTA_PILOT_MODE (u... | [
"System",
"status",
"specific",
"to",
"ualberta",
"uav"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ualberta.py#L7434-L7443 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ualberta.py | MAVLink.button_change_send | def button_change_send(self, time_boot_ms, last_change_ms, state, force_mavlink1=False):
'''
Report button state change
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
last_change_ms : Time of last change of bu... | python | def button_change_send(self, time_boot_ms, last_change_ms, state, force_mavlink1=False):
'''
Report button state change
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
last_change_ms : Time of last change of bu... | [
"def",
"button_change_send",
"(",
"self",
",",
"time_boot_ms",
",",
"last_change_ms",
",",
"state",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"button_change_encode",
"(",
"time_boot_ms",
",",
"last_change_ms"... | Report button state change
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
last_change_ms : Time of last change of button state (uint32_t)
state : Bitmap state of buttons (uint8_t) | [
"Report",
"button",
"state",
"change"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ualberta.py#L12186-L12195 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/lib/ANUGA/redfearn.py | convert_from_latlon_to_utm | def convert_from_latlon_to_utm(points=None,
latitudes=None,
longitudes=None,
false_easting=None,
false_northing=None):
"""Convert latitude and longitude data to UTM as a list of coordinates.
... | python | def convert_from_latlon_to_utm(points=None,
latitudes=None,
longitudes=None,
false_easting=None,
false_northing=None):
"""Convert latitude and longitude data to UTM as a list of coordinates.
... | [
"def",
"convert_from_latlon_to_utm",
"(",
"points",
"=",
"None",
",",
"latitudes",
"=",
"None",
",",
"longitudes",
"=",
"None",
",",
"false_easting",
"=",
"None",
",",
"false_northing",
"=",
"None",
")",
":",
"old_geo",
"=",
"Geo_reference",
"(",
")",
"utm_p... | Convert latitude and longitude data to UTM as a list of coordinates.
Input
points: list of points given in decimal degrees (latitude, longitude) or
latitudes: list of latitudes and
longitudes: list of longitudes
false_easting (optional)
false_northing (optional)
Output
points: Lis... | [
"Convert",
"latitude",
"and",
"longitude",
"data",
"to",
"UTM",
"as",
"a",
"list",
"of",
"coordinates",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/ANUGA/redfearn.py#L199-L243 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/quaternion.py | QuaternionBase.dcm | def dcm(self):
"""
Get the DCM
:returns: 3x3 array
"""
if self._dcm is None:
if self._q is not None:
# try to get dcm from q
self._dcm = self._q_to_dcm(self.q)
elif self._euler is not None:
# try to get get ... | python | def dcm(self):
"""
Get the DCM
:returns: 3x3 array
"""
if self._dcm is None:
if self._q is not None:
# try to get dcm from q
self._dcm = self._q_to_dcm(self.q)
elif self._euler is not None:
# try to get get ... | [
"def",
"dcm",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dcm",
"is",
"None",
":",
"if",
"self",
".",
"_q",
"is",
"not",
"None",
":",
"self",
".",
"_dcm",
"=",
"self",
".",
"_q_to_dcm",
"(",
"self",
".",
"q",
")",
"elif",
"self",
".",
"_euler",... | Get the DCM
:returns: 3x3 array | [
"Get",
"the",
"DCM"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/quaternion.py#L128-L141 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavgpslock.py | lock_time | def lock_time(logfile):
'''work out gps lock times for a log file'''
print("Processing log %s" % filename)
mlog = mavutil.mavlink_connection(filename)
locked = False
start_time = 0.0
total_time = 0.0
t = None
m = mlog.recv_match(type=['GPS_RAW_INT','GPS_RAW'], condition=args.condition)
... | python | def lock_time(logfile):
'''work out gps lock times for a log file'''
print("Processing log %s" % filename)
mlog = mavutil.mavlink_connection(filename)
locked = False
start_time = 0.0
total_time = 0.0
t = None
m = mlog.recv_match(type=['GPS_RAW_INT','GPS_RAW'], condition=args.condition)
... | [
"def",
"lock_time",
"(",
"logfile",
")",
":",
"print",
"(",
"\"Processing log %s\"",
"%",
"filename",
")",
"mlog",
"=",
"mavutil",
".",
"mavlink_connection",
"(",
"filename",
")",
"locked",
"=",
"False",
"start_time",
"=",
"0.0",
"total_time",
"=",
"0.0",
"t... | work out gps lock times for a log file | [
"work",
"out",
"gps",
"lock",
"times",
"for",
"a",
"log",
"file"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavgpslock.py#L19-L58 | train |
JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapFrame.on_menu | def on_menu(self, event):
'''handle menu selection'''
state = self.state
# see if it is a popup menu
if state.popup_object is not None:
obj = state.popup_object
ret = obj.popup_menu.find_selected(event)
if ret is not None:
ret.call_hand... | python | def on_menu(self, event):
'''handle menu selection'''
state = self.state
# see if it is a popup menu
if state.popup_object is not None:
obj = state.popup_object
ret = obj.popup_menu.find_selected(event)
if ret is not None:
ret.call_hand... | [
"def",
"on_menu",
"(",
"self",
",",
"event",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"state",
".",
"popup_object",
"is",
"not",
"None",
":",
"obj",
"=",
"state",
".",
"popup_object",
"ret",
"=",
"obj",
".",
"popup_menu",
".",
"find_selected... | handle menu selection | [
"handle",
"menu",
"selection"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L49-L88 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.