id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
233,500 | jorgenschaefer/elpy | elpy/refactor.py | Refactor.refactor_rename_at_point | def refactor_rename_at_point(self, offset, new_name, in_hierarchy, docs):
"""Rename the symbol at point."""
try:
refactor = Rename(self.project, self.resource, offset)
except RefactoringError as e:
raise Fault(str(e), code=400)
return self._get_changes(refactor, n... | python | def refactor_rename_at_point(self, offset, new_name, in_hierarchy, docs):
"""Rename the symbol at point."""
try:
refactor = Rename(self.project, self.resource, offset)
except RefactoringError as e:
raise Fault(str(e), code=400)
return self._get_changes(refactor, n... | [
"def",
"refactor_rename_at_point",
"(",
"self",
",",
"offset",
",",
"new_name",
",",
"in_hierarchy",
",",
"docs",
")",
":",
"try",
":",
"refactor",
"=",
"Rename",
"(",
"self",
".",
"project",
",",
"self",
".",
"resource",
",",
"offset",
")",
"except",
"R... | Rename the symbol at point. | [
"Rename",
"the",
"symbol",
"at",
"point",
"."
] | ffd982f829b11e53f2be187c7b770423341f29bc | https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/refactor.py#L252-L259 |
233,501 | jorgenschaefer/elpy | elpy/refactor.py | Refactor.refactor_rename_current_module | def refactor_rename_current_module(self, new_name):
"""Rename the current module."""
refactor = Rename(self.project, self.resource, None)
return self._get_changes(refactor, new_name) | python | def refactor_rename_current_module(self, new_name):
"""Rename the current module."""
refactor = Rename(self.project, self.resource, None)
return self._get_changes(refactor, new_name) | [
"def",
"refactor_rename_current_module",
"(",
"self",
",",
"new_name",
")",
":",
"refactor",
"=",
"Rename",
"(",
"self",
".",
"project",
",",
"self",
".",
"resource",
",",
"None",
")",
"return",
"self",
".",
"_get_changes",
"(",
"refactor",
",",
"new_name",
... | Rename the current module. | [
"Rename",
"the",
"current",
"module",
"."
] | ffd982f829b11e53f2be187c7b770423341f29bc | https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/refactor.py#L264-L267 |
233,502 | jorgenschaefer/elpy | elpy/refactor.py | Refactor.refactor_move_module | def refactor_move_module(self, new_name):
"""Move the current module."""
refactor = create_move(self.project, self.resource)
resource = path_to_resource(self.project, new_name)
return self._get_changes(refactor, resource) | python | def refactor_move_module(self, new_name):
"""Move the current module."""
refactor = create_move(self.project, self.resource)
resource = path_to_resource(self.project, new_name)
return self._get_changes(refactor, resource) | [
"def",
"refactor_move_module",
"(",
"self",
",",
"new_name",
")",
":",
"refactor",
"=",
"create_move",
"(",
"self",
".",
"project",
",",
"self",
".",
"resource",
")",
"resource",
"=",
"path_to_resource",
"(",
"self",
".",
"project",
",",
"new_name",
")",
"... | Move the current module. | [
"Move",
"the",
"current",
"module",
"."
] | ffd982f829b11e53f2be187c7b770423341f29bc | https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/refactor.py#L273-L277 |
233,503 | jorgenschaefer/elpy | elpy/refactor.py | Refactor.refactor_create_inline | def refactor_create_inline(self, offset, only_this):
"""Inline the function call at point."""
refactor = create_inline(self.project, self.resource, offset)
if only_this:
return self._get_changes(refactor, remove=False, only_current=True)
else:
return self._get_cha... | python | def refactor_create_inline(self, offset, only_this):
"""Inline the function call at point."""
refactor = create_inline(self.project, self.resource, offset)
if only_this:
return self._get_changes(refactor, remove=False, only_current=True)
else:
return self._get_cha... | [
"def",
"refactor_create_inline",
"(",
"self",
",",
"offset",
",",
"only_this",
")",
":",
"refactor",
"=",
"create_inline",
"(",
"self",
".",
"project",
",",
"self",
".",
"resource",
",",
"offset",
")",
"if",
"only_this",
":",
"return",
"self",
".",
"_get_c... | Inline the function call at point. | [
"Inline",
"the",
"function",
"call",
"at",
"point",
"."
] | ffd982f829b11e53f2be187c7b770423341f29bc | https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/refactor.py#L283-L289 |
233,504 | jorgenschaefer/elpy | elpy/refactor.py | Refactor.refactor_extract_method | def refactor_extract_method(self, start, end, name,
make_global):
"""Extract region as a method."""
refactor = ExtractMethod(self.project, self.resource, start, end)
return self._get_changes(
refactor, name, similar=True, global_=make_global
) | python | def refactor_extract_method(self, start, end, name,
make_global):
"""Extract region as a method."""
refactor = ExtractMethod(self.project, self.resource, start, end)
return self._get_changes(
refactor, name, similar=True, global_=make_global
) | [
"def",
"refactor_extract_method",
"(",
"self",
",",
"start",
",",
"end",
",",
"name",
",",
"make_global",
")",
":",
"refactor",
"=",
"ExtractMethod",
"(",
"self",
".",
"project",
",",
"self",
".",
"resource",
",",
"start",
",",
"end",
")",
"return",
"sel... | Extract region as a method. | [
"Extract",
"region",
"as",
"a",
"method",
"."
] | ffd982f829b11e53f2be187c7b770423341f29bc | https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/refactor.py#L297-L303 |
233,505 | jorgenschaefer/elpy | elpy/refactor.py | Refactor.refactor_use_function | def refactor_use_function(self, offset):
"""Use the function at point wherever possible."""
try:
refactor = UseFunction(self.project, self.resource, offset)
except RefactoringError as e:
raise Fault(
'Refactoring error: {}'.format(e),
code=... | python | def refactor_use_function(self, offset):
"""Use the function at point wherever possible."""
try:
refactor = UseFunction(self.project, self.resource, offset)
except RefactoringError as e:
raise Fault(
'Refactoring error: {}'.format(e),
code=... | [
"def",
"refactor_use_function",
"(",
"self",
",",
"offset",
")",
":",
"try",
":",
"refactor",
"=",
"UseFunction",
"(",
"self",
".",
"project",
",",
"self",
".",
"resource",
",",
"offset",
")",
"except",
"RefactoringError",
"as",
"e",
":",
"raise",
"Fault",... | Use the function at point wherever possible. | [
"Use",
"the",
"function",
"at",
"point",
"wherever",
"possible",
"."
] | ffd982f829b11e53f2be187c7b770423341f29bc | https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/refactor.py#L308-L317 |
233,506 | clach04/python-tuya | pytuya/__init__.py | XenonDevice.generate_payload | def generate_payload(self, command, data=None):
"""
Generate the payload to send.
Args:
command(str): The type of command.
This is one of the entries from payload_dict
data(dict, optional): The data to be send.
This is what will be passed ... | python | def generate_payload(self, command, data=None):
"""
Generate the payload to send.
Args:
command(str): The type of command.
This is one of the entries from payload_dict
data(dict, optional): The data to be send.
This is what will be passed ... | [
"def",
"generate_payload",
"(",
"self",
",",
"command",
",",
"data",
"=",
"None",
")",
":",
"json_data",
"=",
"payload_dict",
"[",
"self",
".",
"dev_type",
"]",
"[",
"command",
"]",
"[",
"'command'",
"]",
"if",
"'gwId'",
"in",
"json_data",
":",
"json_dat... | Generate the payload to send.
Args:
command(str): The type of command.
This is one of the entries from payload_dict
data(dict, optional): The data to be send.
This is what will be passed via the 'dps' entry | [
"Generate",
"the",
"payload",
"to",
"send",
"."
] | 7b89d38c56f6e25700e2a333000d25bc8d923622 | https://github.com/clach04/python-tuya/blob/7b89d38c56f6e25700e2a333000d25bc8d923622/pytuya/__init__.py#L176-L249 |
233,507 | clach04/python-tuya | pytuya/__init__.py | BulbDevice.set_colour | def set_colour(self, r, g, b):
"""
Set colour of an rgb bulb.
Args:
r(int): Value for the colour red as int from 0-255.
g(int): Value for the colour green as int from 0-255.
b(int): Value for the colour blue as int from 0-255.
"""
if not 0 <= ... | python | def set_colour(self, r, g, b):
"""
Set colour of an rgb bulb.
Args:
r(int): Value for the colour red as int from 0-255.
g(int): Value for the colour green as int from 0-255.
b(int): Value for the colour blue as int from 0-255.
"""
if not 0 <= ... | [
"def",
"set_colour",
"(",
"self",
",",
"r",
",",
"g",
",",
"b",
")",
":",
"if",
"not",
"0",
"<=",
"r",
"<=",
"255",
":",
"raise",
"ValueError",
"(",
"\"The value for red needs to be between 0 and 255.\"",
")",
"if",
"not",
"0",
"<=",
"g",
"<=",
"255",
... | Set colour of an rgb bulb.
Args:
r(int): Value for the colour red as int from 0-255.
g(int): Value for the colour green as int from 0-255.
b(int): Value for the colour blue as int from 0-255. | [
"Set",
"colour",
"of",
"an",
"rgb",
"bulb",
"."
] | 7b89d38c56f6e25700e2a333000d25bc8d923622 | https://github.com/clach04/python-tuya/blob/7b89d38c56f6e25700e2a333000d25bc8d923622/pytuya/__init__.py#L437-L460 |
233,508 | clach04/python-tuya | pytuya/__init__.py | BulbDevice.set_white | def set_white(self, brightness, colourtemp):
"""
Set white coloured theme of an rgb bulb.
Args:
brightness(int): Value for the brightness (25-255).
colourtemp(int): Value for the colour temperature (0-255).
"""
if not 25 <= brightness <= 255:
... | python | def set_white(self, brightness, colourtemp):
"""
Set white coloured theme of an rgb bulb.
Args:
brightness(int): Value for the brightness (25-255).
colourtemp(int): Value for the colour temperature (0-255).
"""
if not 25 <= brightness <= 255:
... | [
"def",
"set_white",
"(",
"self",
",",
"brightness",
",",
"colourtemp",
")",
":",
"if",
"not",
"25",
"<=",
"brightness",
"<=",
"255",
":",
"raise",
"ValueError",
"(",
"\"The brightness needs to be between 25 and 255.\"",
")",
"if",
"not",
"0",
"<=",
"colourtemp",... | Set white coloured theme of an rgb bulb.
Args:
brightness(int): Value for the brightness (25-255).
colourtemp(int): Value for the colour temperature (0-255). | [
"Set",
"white",
"coloured",
"theme",
"of",
"an",
"rgb",
"bulb",
"."
] | 7b89d38c56f6e25700e2a333000d25bc8d923622 | https://github.com/clach04/python-tuya/blob/7b89d38c56f6e25700e2a333000d25bc8d923622/pytuya/__init__.py#L462-L481 |
233,509 | clach04/python-tuya | pytuya/__init__.py | BulbDevice.set_brightness | def set_brightness(self, brightness):
"""
Set the brightness value of an rgb bulb.
Args:
brightness(int): Value for the brightness (25-255).
"""
if not 25 <= brightness <= 255:
raise ValueError("The brightness needs to be between 25 and 255.")
pa... | python | def set_brightness(self, brightness):
"""
Set the brightness value of an rgb bulb.
Args:
brightness(int): Value for the brightness (25-255).
"""
if not 25 <= brightness <= 255:
raise ValueError("The brightness needs to be between 25 and 255.")
pa... | [
"def",
"set_brightness",
"(",
"self",
",",
"brightness",
")",
":",
"if",
"not",
"25",
"<=",
"brightness",
"<=",
"255",
":",
"raise",
"ValueError",
"(",
"\"The brightness needs to be between 25 and 255.\"",
")",
"payload",
"=",
"self",
".",
"generate_payload",
"(",... | Set the brightness value of an rgb bulb.
Args:
brightness(int): Value for the brightness (25-255). | [
"Set",
"the",
"brightness",
"value",
"of",
"an",
"rgb",
"bulb",
"."
] | 7b89d38c56f6e25700e2a333000d25bc8d923622 | https://github.com/clach04/python-tuya/blob/7b89d38c56f6e25700e2a333000d25bc8d923622/pytuya/__init__.py#L483-L495 |
233,510 | clach04/python-tuya | pytuya/__init__.py | BulbDevice.set_colourtemp | def set_colourtemp(self, colourtemp):
"""
Set the colour temperature of an rgb bulb.
Args:
colourtemp(int): Value for the colour temperature (0-255).
"""
if not 0 <= colourtemp <= 255:
raise ValueError("The colour temperature needs to be between 0 and 255... | python | def set_colourtemp(self, colourtemp):
"""
Set the colour temperature of an rgb bulb.
Args:
colourtemp(int): Value for the colour temperature (0-255).
"""
if not 0 <= colourtemp <= 255:
raise ValueError("The colour temperature needs to be between 0 and 255... | [
"def",
"set_colourtemp",
"(",
"self",
",",
"colourtemp",
")",
":",
"if",
"not",
"0",
"<=",
"colourtemp",
"<=",
"255",
":",
"raise",
"ValueError",
"(",
"\"The colour temperature needs to be between 0 and 255.\"",
")",
"payload",
"=",
"self",
".",
"generate_payload",
... | Set the colour temperature of an rgb bulb.
Args:
colourtemp(int): Value for the colour temperature (0-255). | [
"Set",
"the",
"colour",
"temperature",
"of",
"an",
"rgb",
"bulb",
"."
] | 7b89d38c56f6e25700e2a333000d25bc8d923622 | https://github.com/clach04/python-tuya/blob/7b89d38c56f6e25700e2a333000d25bc8d923622/pytuya/__init__.py#L497-L509 |
233,511 | clach04/python-tuya | pytuya/__init__.py | BulbDevice.colour_rgb | def colour_rgb(self):
"""Return colour as RGB value"""
hexvalue = self.status()[self.DPS][self.DPS_INDEX_COLOUR]
return BulbDevice._hexvalue_to_rgb(hexvalue) | python | def colour_rgb(self):
"""Return colour as RGB value"""
hexvalue = self.status()[self.DPS][self.DPS_INDEX_COLOUR]
return BulbDevice._hexvalue_to_rgb(hexvalue) | [
"def",
"colour_rgb",
"(",
"self",
")",
":",
"hexvalue",
"=",
"self",
".",
"status",
"(",
")",
"[",
"self",
".",
"DPS",
"]",
"[",
"self",
".",
"DPS_INDEX_COLOUR",
"]",
"return",
"BulbDevice",
".",
"_hexvalue_to_rgb",
"(",
"hexvalue",
")"
] | Return colour as RGB value | [
"Return",
"colour",
"as",
"RGB",
"value"
] | 7b89d38c56f6e25700e2a333000d25bc8d923622 | https://github.com/clach04/python-tuya/blob/7b89d38c56f6e25700e2a333000d25bc8d923622/pytuya/__init__.py#L519-L522 |
233,512 | clach04/python-tuya | pytuya/__init__.py | BulbDevice.colour_hsv | def colour_hsv(self):
"""Return colour as HSV value"""
hexvalue = self.status()[self.DPS][self.DPS_INDEX_COLOUR]
return BulbDevice._hexvalue_to_hsv(hexvalue) | python | def colour_hsv(self):
"""Return colour as HSV value"""
hexvalue = self.status()[self.DPS][self.DPS_INDEX_COLOUR]
return BulbDevice._hexvalue_to_hsv(hexvalue) | [
"def",
"colour_hsv",
"(",
"self",
")",
":",
"hexvalue",
"=",
"self",
".",
"status",
"(",
")",
"[",
"self",
".",
"DPS",
"]",
"[",
"self",
".",
"DPS_INDEX_COLOUR",
"]",
"return",
"BulbDevice",
".",
"_hexvalue_to_hsv",
"(",
"hexvalue",
")"
] | Return colour as HSV value | [
"Return",
"colour",
"as",
"HSV",
"value"
] | 7b89d38c56f6e25700e2a333000d25bc8d923622 | https://github.com/clach04/python-tuya/blob/7b89d38c56f6e25700e2a333000d25bc8d923622/pytuya/__init__.py#L524-L527 |
233,513 | bitcraze/crazyflie-lib-python | cflib/crazyflie/high_level_commander.py | HighLevelCommander.set_group_mask | def set_group_mask(self, group_mask=ALL_GROUPS):
"""
Set the group mask that the Crazyflie belongs to
:param group_mask: mask for which groups this CF belongs to
"""
self._send_packet(struct.pack('<BB',
self.COMMAND_SET_GROUP_MASK,
... | python | def set_group_mask(self, group_mask=ALL_GROUPS):
"""
Set the group mask that the Crazyflie belongs to
:param group_mask: mask for which groups this CF belongs to
"""
self._send_packet(struct.pack('<BB',
self.COMMAND_SET_GROUP_MASK,
... | [
"def",
"set_group_mask",
"(",
"self",
",",
"group_mask",
"=",
"ALL_GROUPS",
")",
":",
"self",
".",
"_send_packet",
"(",
"struct",
".",
"pack",
"(",
"'<BB'",
",",
"self",
".",
"COMMAND_SET_GROUP_MASK",
",",
"group_mask",
")",
")"
] | Set the group mask that the Crazyflie belongs to
:param group_mask: mask for which groups this CF belongs to | [
"Set",
"the",
"group",
"mask",
"that",
"the",
"Crazyflie",
"belongs",
"to"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/high_level_commander.py#L63-L71 |
233,514 | bitcraze/crazyflie-lib-python | cflib/crazyflie/high_level_commander.py | HighLevelCommander.takeoff | def takeoff(self, absolute_height_m, duration_s, group_mask=ALL_GROUPS):
"""
vertical takeoff from current x-y position to given height
:param absolute_height_m: absolut (m)
:param duration_s: time it should take until target height is
reached (s)
:par... | python | def takeoff(self, absolute_height_m, duration_s, group_mask=ALL_GROUPS):
"""
vertical takeoff from current x-y position to given height
:param absolute_height_m: absolut (m)
:param duration_s: time it should take until target height is
reached (s)
:par... | [
"def",
"takeoff",
"(",
"self",
",",
"absolute_height_m",
",",
"duration_s",
",",
"group_mask",
"=",
"ALL_GROUPS",
")",
":",
"self",
".",
"_send_packet",
"(",
"struct",
".",
"pack",
"(",
"'<BBff'",
",",
"self",
".",
"COMMAND_TAKEOFF",
",",
"group_mask",
",",
... | vertical takeoff from current x-y position to given height
:param absolute_height_m: absolut (m)
:param duration_s: time it should take until target height is
reached (s)
:param group_mask: mask for which CFs this should apply to | [
"vertical",
"takeoff",
"from",
"current",
"x",
"-",
"y",
"position",
"to",
"given",
"height"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/high_level_commander.py#L73-L86 |
233,515 | bitcraze/crazyflie-lib-python | cflib/crazyflie/high_level_commander.py | HighLevelCommander.land | def land(self, absolute_height_m, duration_s, group_mask=ALL_GROUPS):
"""
vertical land from current x-y position to given height
:param absolute_height_m: absolut (m)
:param duration_s: time it should take until target height is
reached (s)
:param gro... | python | def land(self, absolute_height_m, duration_s, group_mask=ALL_GROUPS):
"""
vertical land from current x-y position to given height
:param absolute_height_m: absolut (m)
:param duration_s: time it should take until target height is
reached (s)
:param gro... | [
"def",
"land",
"(",
"self",
",",
"absolute_height_m",
",",
"duration_s",
",",
"group_mask",
"=",
"ALL_GROUPS",
")",
":",
"self",
".",
"_send_packet",
"(",
"struct",
".",
"pack",
"(",
"'<BBff'",
",",
"self",
".",
"COMMAND_LAND",
",",
"group_mask",
",",
"abs... | vertical land from current x-y position to given height
:param absolute_height_m: absolut (m)
:param duration_s: time it should take until target height is
reached (s)
:param group_mask: mask for which CFs this should apply to | [
"vertical",
"land",
"from",
"current",
"x",
"-",
"y",
"position",
"to",
"given",
"height"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/high_level_commander.py#L88-L101 |
233,516 | bitcraze/crazyflie-lib-python | cflib/crazyflie/high_level_commander.py | HighLevelCommander.go_to | def go_to(self, x, y, z, yaw, duration_s, relative=False,
group_mask=ALL_GROUPS):
"""
Go to an absolute or relative position
:param x: x (m)
:param y: y (m)
:param z: z (m)
:param yaw: yaw (radians)
:param duration_s: time it should take to reach th... | python | def go_to(self, x, y, z, yaw, duration_s, relative=False,
group_mask=ALL_GROUPS):
"""
Go to an absolute or relative position
:param x: x (m)
:param y: y (m)
:param z: z (m)
:param yaw: yaw (radians)
:param duration_s: time it should take to reach th... | [
"def",
"go_to",
"(",
"self",
",",
"x",
",",
"y",
",",
"z",
",",
"yaw",
",",
"duration_s",
",",
"relative",
"=",
"False",
",",
"group_mask",
"=",
"ALL_GROUPS",
")",
":",
"self",
".",
"_send_packet",
"(",
"struct",
".",
"pack",
"(",
"'<BBBfffff'",
",",... | Go to an absolute or relative position
:param x: x (m)
:param y: y (m)
:param z: z (m)
:param yaw: yaw (radians)
:param duration_s: time it should take to reach the position (s)
:param relative: True if x, y, z is relative to the current position
:param group_mas... | [
"Go",
"to",
"an",
"absolute",
"or",
"relative",
"position"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/high_level_commander.py#L114-L133 |
233,517 | bitcraze/crazyflie-lib-python | cflib/crazyflie/high_level_commander.py | HighLevelCommander.start_trajectory | def start_trajectory(self, trajectory_id, time_scale=1.0, relative=False,
reversed=False, group_mask=ALL_GROUPS):
"""
starts executing a specified trajectory
:param trajectory_id: id of the trajectory (previously defined by
define_trajectory)
:par... | python | def start_trajectory(self, trajectory_id, time_scale=1.0, relative=False,
reversed=False, group_mask=ALL_GROUPS):
"""
starts executing a specified trajectory
:param trajectory_id: id of the trajectory (previously defined by
define_trajectory)
:par... | [
"def",
"start_trajectory",
"(",
"self",
",",
"trajectory_id",
",",
"time_scale",
"=",
"1.0",
",",
"relative",
"=",
"False",
",",
"reversed",
"=",
"False",
",",
"group_mask",
"=",
"ALL_GROUPS",
")",
":",
"self",
".",
"_send_packet",
"(",
"struct",
".",
"pac... | starts executing a specified trajectory
:param trajectory_id: id of the trajectory (previously defined by
define_trajectory)
:param time_scale: time factor; 1.0 = original speed;
>1.0: slower;
<1.0: faster
... | [
"starts",
"executing",
"a",
"specified",
"trajectory"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/high_level_commander.py#L135-L158 |
233,518 | bitcraze/crazyflie-lib-python | cflib/crazyflie/high_level_commander.py | HighLevelCommander.define_trajectory | def define_trajectory(self, trajectory_id, offset, n_pieces):
"""
Define a trajectory that has previously been uploaded to memory.
:param trajectory_id: The id of the trajectory
:param offset: offset in uploaded memory
:param n_pieces: Nr of pieces in the trajectory
:ret... | python | def define_trajectory(self, trajectory_id, offset, n_pieces):
"""
Define a trajectory that has previously been uploaded to memory.
:param trajectory_id: The id of the trajectory
:param offset: offset in uploaded memory
:param n_pieces: Nr of pieces in the trajectory
:ret... | [
"def",
"define_trajectory",
"(",
"self",
",",
"trajectory_id",
",",
"offset",
",",
"n_pieces",
")",
":",
"self",
".",
"_send_packet",
"(",
"struct",
".",
"pack",
"(",
"'<BBBBIB'",
",",
"self",
".",
"COMMAND_DEFINE_TRAJECTORY",
",",
"trajectory_id",
",",
"self"... | Define a trajectory that has previously been uploaded to memory.
:param trajectory_id: The id of the trajectory
:param offset: offset in uploaded memory
:param n_pieces: Nr of pieces in the trajectory
:return: | [
"Define",
"a",
"trajectory",
"that",
"has",
"previously",
"been",
"uploaded",
"to",
"memory",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/high_level_commander.py#L160-L175 |
233,519 | bitcraze/crazyflie-lib-python | examples/flash-memory.py | choose | def choose(items, title_text, question_text):
"""
Interactively choose one of the items.
"""
print(title_text)
for i, item in enumerate(items, start=1):
print('%d) %s' % (i, item))
print('%d) Abort' % (i + 1))
selected = input(question_text)
try:
index = int(selected)
... | python | def choose(items, title_text, question_text):
"""
Interactively choose one of the items.
"""
print(title_text)
for i, item in enumerate(items, start=1):
print('%d) %s' % (i, item))
print('%d) Abort' % (i + 1))
selected = input(question_text)
try:
index = int(selected)
... | [
"def",
"choose",
"(",
"items",
",",
"title_text",
",",
"question_text",
")",
":",
"print",
"(",
"title_text",
")",
"for",
"i",
",",
"item",
"in",
"enumerate",
"(",
"items",
",",
"start",
"=",
"1",
")",
":",
"print",
"(",
"'%d) %s'",
"%",
"(",
"i",
... | Interactively choose one of the items. | [
"Interactively",
"choose",
"one",
"of",
"the",
"items",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/examples/flash-memory.py#L110-L129 |
233,520 | bitcraze/crazyflie-lib-python | examples/flash-memory.py | scan | def scan():
"""
Scan for Crazyflie and return its URI.
"""
# Initiate the low level drivers
cflib.crtp.init_drivers(enable_debug_driver=False)
# Scan for Crazyflies
print('Scanning interfaces for Crazyflies...')
available = cflib.crtp.scan_interfaces()
interfaces = [uri for uri, _ ... | python | def scan():
"""
Scan for Crazyflie and return its URI.
"""
# Initiate the low level drivers
cflib.crtp.init_drivers(enable_debug_driver=False)
# Scan for Crazyflies
print('Scanning interfaces for Crazyflies...')
available = cflib.crtp.scan_interfaces()
interfaces = [uri for uri, _ ... | [
"def",
"scan",
"(",
")",
":",
"# Initiate the low level drivers",
"cflib",
".",
"crtp",
".",
"init_drivers",
"(",
"enable_debug_driver",
"=",
"False",
")",
"# Scan for Crazyflies",
"print",
"(",
"'Scanning interfaces for Crazyflies...'",
")",
"available",
"=",
"cflib",
... | Scan for Crazyflie and return its URI. | [
"Scan",
"for",
"Crazyflie",
"and",
"return",
"its",
"URI",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/examples/flash-memory.py#L132-L147 |
233,521 | bitcraze/crazyflie-lib-python | examples/flash-memory.py | Flasher.connect | def connect(self):
"""
Connect to the crazyflie.
"""
print('Connecting to %s' % self._link_uri)
self._cf.open_link(self._link_uri) | python | def connect(self):
"""
Connect to the crazyflie.
"""
print('Connecting to %s' % self._link_uri)
self._cf.open_link(self._link_uri) | [
"def",
"connect",
"(",
"self",
")",
":",
"print",
"(",
"'Connecting to %s'",
"%",
"self",
".",
"_link_uri",
")",
"self",
".",
"_cf",
".",
"open_link",
"(",
"self",
".",
"_link_uri",
")"
] | Connect to the crazyflie. | [
"Connect",
"to",
"the",
"crazyflie",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/examples/flash-memory.py#L55-L60 |
233,522 | bitcraze/crazyflie-lib-python | examples/flash-memory.py | Flasher.wait_for_connection | def wait_for_connection(self, timeout=10):
"""
Busy loop until connection is established.
Will abort after timeout (seconds). Return value is a boolean, whether
connection could be established.
"""
start_time = datetime.datetime.now()
while True:
if ... | python | def wait_for_connection(self, timeout=10):
"""
Busy loop until connection is established.
Will abort after timeout (seconds). Return value is a boolean, whether
connection could be established.
"""
start_time = datetime.datetime.now()
while True:
if ... | [
"def",
"wait_for_connection",
"(",
"self",
",",
"timeout",
"=",
"10",
")",
":",
"start_time",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"while",
"True",
":",
"if",
"self",
".",
"connected",
":",
"return",
"True",
"now",
"=",
"datetime",
"... | Busy loop until connection is established.
Will abort after timeout (seconds). Return value is a boolean, whether
connection could be established. | [
"Busy",
"loop",
"until",
"connection",
"is",
"established",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/examples/flash-memory.py#L66-L81 |
233,523 | bitcraze/crazyflie-lib-python | examples/flash-memory.py | Flasher.search_memories | def search_memories(self):
"""
Search and return list of 1-wire memories.
"""
if not self.connected:
raise NotConnected()
return self._cf.mem.get_mems(MemoryElement.TYPE_1W) | python | def search_memories(self):
"""
Search and return list of 1-wire memories.
"""
if not self.connected:
raise NotConnected()
return self._cf.mem.get_mems(MemoryElement.TYPE_1W) | [
"def",
"search_memories",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"connected",
":",
"raise",
"NotConnected",
"(",
")",
"return",
"self",
".",
"_cf",
".",
"mem",
".",
"get_mems",
"(",
"MemoryElement",
".",
"TYPE_1W",
")"
] | Search and return list of 1-wire memories. | [
"Search",
"and",
"return",
"list",
"of",
"1",
"-",
"wire",
"memories",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/examples/flash-memory.py#L83-L89 |
233,524 | bitcraze/crazyflie-lib-python | examples/cfbridge.py | RadioBridge._stab_log_data | def _stab_log_data(self, timestamp, data, logconf):
"""Callback froma the log API when data arrives"""
print('[%d][%s]: %s' % (timestamp, logconf.name, data)) | python | def _stab_log_data(self, timestamp, data, logconf):
"""Callback froma the log API when data arrives"""
print('[%d][%s]: %s' % (timestamp, logconf.name, data)) | [
"def",
"_stab_log_data",
"(",
"self",
",",
"timestamp",
",",
"data",
",",
"logconf",
")",
":",
"print",
"(",
"'[%d][%s]: %s'",
"%",
"(",
"timestamp",
",",
"logconf",
".",
"name",
",",
"data",
")",
")"
] | Callback froma the log API when data arrives | [
"Callback",
"froma",
"the",
"log",
"API",
"when",
"data",
"arrives"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/examples/cfbridge.py#L93-L95 |
233,525 | bitcraze/crazyflie-lib-python | cflib/crazyflie/platformservice.py | PlatformService.fetch_platform_informations | def fetch_platform_informations(self, callback):
"""
Fetch platform info from the firmware
Should be called at the earliest in the connection sequence
"""
self._protocolVersion = -1
self._callback = callback
self._request_protocol_version() | python | def fetch_platform_informations(self, callback):
"""
Fetch platform info from the firmware
Should be called at the earliest in the connection sequence
"""
self._protocolVersion = -1
self._callback = callback
self._request_protocol_version() | [
"def",
"fetch_platform_informations",
"(",
"self",
",",
"callback",
")",
":",
"self",
".",
"_protocolVersion",
"=",
"-",
"1",
"self",
".",
"_callback",
"=",
"callback",
"self",
".",
"_request_protocol_version",
"(",
")"
] | Fetch platform info from the firmware
Should be called at the earliest in the connection sequence | [
"Fetch",
"platform",
"info",
"from",
"the",
"firmware",
"Should",
"be",
"called",
"at",
"the",
"earliest",
"in",
"the",
"connection",
"sequence"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/platformservice.py#L74-L83 |
233,526 | bitcraze/crazyflie-lib-python | cflib/crtp/usbdriver.py | UsbDriver.receive_packet | def receive_packet(self, time=0):
"""
Receive a packet though the link. This call is blocking but will
timeout and return None if a timeout is supplied.
"""
if time == 0:
try:
return self.in_queue.get(False)
except queue.Empty:
... | python | def receive_packet(self, time=0):
"""
Receive a packet though the link. This call is blocking but will
timeout and return None if a timeout is supplied.
"""
if time == 0:
try:
return self.in_queue.get(False)
except queue.Empty:
... | [
"def",
"receive_packet",
"(",
"self",
",",
"time",
"=",
"0",
")",
":",
"if",
"time",
"==",
"0",
":",
"try",
":",
"return",
"self",
".",
"in_queue",
".",
"get",
"(",
"False",
")",
"except",
"queue",
".",
"Empty",
":",
"return",
"None",
"elif",
"time... | Receive a packet though the link. This call is blocking but will
timeout and return None if a timeout is supplied. | [
"Receive",
"a",
"packet",
"though",
"the",
"link",
".",
"This",
"call",
"is",
"blocking",
"but",
"will",
"timeout",
"and",
"return",
"None",
"if",
"a",
"timeout",
"is",
"supplied",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crtp/usbdriver.py#L116-L135 |
233,527 | bitcraze/crazyflie-lib-python | cflib/utils/callbacks.py | Caller.add_callback | def add_callback(self, cb):
""" Register cb as a new callback. Will not register duplicates. """
if ((cb in self.callbacks) is False):
self.callbacks.append(cb) | python | def add_callback(self, cb):
""" Register cb as a new callback. Will not register duplicates. """
if ((cb in self.callbacks) is False):
self.callbacks.append(cb) | [
"def",
"add_callback",
"(",
"self",
",",
"cb",
")",
":",
"if",
"(",
"(",
"cb",
"in",
"self",
".",
"callbacks",
")",
"is",
"False",
")",
":",
"self",
".",
"callbacks",
".",
"append",
"(",
"cb",
")"
] | Register cb as a new callback. Will not register duplicates. | [
"Register",
"cb",
"as",
"a",
"new",
"callback",
".",
"Will",
"not",
"register",
"duplicates",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/utils/callbacks.py#L42-L45 |
233,528 | bitcraze/crazyflie-lib-python | cflib/bootloader/__init__.py | Bootloader.read_cf1_config | def read_cf1_config(self):
"""Read a flash page from the specified target"""
target = self._cload.targets[0xFF]
config_page = target.flash_pages - 1
return self._cload.read_flash(addr=0xFF, page=config_page) | python | def read_cf1_config(self):
"""Read a flash page from the specified target"""
target = self._cload.targets[0xFF]
config_page = target.flash_pages - 1
return self._cload.read_flash(addr=0xFF, page=config_page) | [
"def",
"read_cf1_config",
"(",
"self",
")",
":",
"target",
"=",
"self",
".",
"_cload",
".",
"targets",
"[",
"0xFF",
"]",
"config_page",
"=",
"target",
".",
"flash_pages",
"-",
"1",
"return",
"self",
".",
"_cload",
".",
"read_flash",
"(",
"addr",
"=",
"... | Read a flash page from the specified target | [
"Read",
"a",
"flash",
"page",
"from",
"the",
"specified",
"target"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/bootloader/__init__.py#L122-L127 |
233,529 | bitcraze/crazyflie-lib-python | cflib/drivers/crazyradio.py | Crazyradio.set_channel | def set_channel(self, channel):
""" Set the radio channel to be used """
if channel != self.current_channel:
_send_vendor_setup(self.handle, SET_RADIO_CHANNEL, channel, 0, ())
self.current_channel = channel | python | def set_channel(self, channel):
""" Set the radio channel to be used """
if channel != self.current_channel:
_send_vendor_setup(self.handle, SET_RADIO_CHANNEL, channel, 0, ())
self.current_channel = channel | [
"def",
"set_channel",
"(",
"self",
",",
"channel",
")",
":",
"if",
"channel",
"!=",
"self",
".",
"current_channel",
":",
"_send_vendor_setup",
"(",
"self",
".",
"handle",
",",
"SET_RADIO_CHANNEL",
",",
"channel",
",",
"0",
",",
"(",
")",
")",
"self",
"."... | Set the radio channel to be used | [
"Set",
"the",
"radio",
"channel",
"to",
"be",
"used"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/drivers/crazyradio.py#L185-L189 |
233,530 | bitcraze/crazyflie-lib-python | cflib/drivers/crazyradio.py | Crazyradio.set_address | def set_address(self, address):
""" Set the radio address to be used"""
if len(address) != 5:
raise Exception('Crazyradio: the radio address shall be 5'
' bytes long')
if address != self.current_address:
_send_vendor_setup(self.handle, SET_RADI... | python | def set_address(self, address):
""" Set the radio address to be used"""
if len(address) != 5:
raise Exception('Crazyradio: the radio address shall be 5'
' bytes long')
if address != self.current_address:
_send_vendor_setup(self.handle, SET_RADI... | [
"def",
"set_address",
"(",
"self",
",",
"address",
")",
":",
"if",
"len",
"(",
"address",
")",
"!=",
"5",
":",
"raise",
"Exception",
"(",
"'Crazyradio: the radio address shall be 5'",
"' bytes long'",
")",
"if",
"address",
"!=",
"self",
".",
"current_address",
... | Set the radio address to be used | [
"Set",
"the",
"radio",
"address",
"to",
"be",
"used"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/drivers/crazyradio.py#L191-L198 |
233,531 | bitcraze/crazyflie-lib-python | cflib/drivers/crazyradio.py | Crazyradio.set_data_rate | def set_data_rate(self, datarate):
""" Set the radio datarate to be used """
if datarate != self.current_datarate:
_send_vendor_setup(self.handle, SET_DATA_RATE, datarate, 0, ())
self.current_datarate = datarate | python | def set_data_rate(self, datarate):
""" Set the radio datarate to be used """
if datarate != self.current_datarate:
_send_vendor_setup(self.handle, SET_DATA_RATE, datarate, 0, ())
self.current_datarate = datarate | [
"def",
"set_data_rate",
"(",
"self",
",",
"datarate",
")",
":",
"if",
"datarate",
"!=",
"self",
".",
"current_datarate",
":",
"_send_vendor_setup",
"(",
"self",
".",
"handle",
",",
"SET_DATA_RATE",
",",
"datarate",
",",
"0",
",",
"(",
")",
")",
"self",
"... | Set the radio datarate to be used | [
"Set",
"the",
"radio",
"datarate",
"to",
"be",
"used"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/drivers/crazyradio.py#L200-L204 |
233,532 | bitcraze/crazyflie-lib-python | cflib/drivers/crazyradio.py | Crazyradio.set_arc | def set_arc(self, arc):
""" Set the ACK retry count for radio communication """
_send_vendor_setup(self.handle, SET_RADIO_ARC, arc, 0, ())
self.arc = arc | python | def set_arc(self, arc):
""" Set the ACK retry count for radio communication """
_send_vendor_setup(self.handle, SET_RADIO_ARC, arc, 0, ())
self.arc = arc | [
"def",
"set_arc",
"(",
"self",
",",
"arc",
")",
":",
"_send_vendor_setup",
"(",
"self",
".",
"handle",
",",
"SET_RADIO_ARC",
",",
"arc",
",",
"0",
",",
"(",
")",
")",
"self",
".",
"arc",
"=",
"arc"
] | Set the ACK retry count for radio communication | [
"Set",
"the",
"ACK",
"retry",
"count",
"for",
"radio",
"communication"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/drivers/crazyradio.py#L210-L213 |
233,533 | bitcraze/crazyflie-lib-python | cflib/drivers/crazyradio.py | Crazyradio.set_ard_time | def set_ard_time(self, us):
""" Set the ACK retry delay for radio communication """
# Auto Retransmit Delay:
# 0000 - Wait 250uS
# 0001 - Wait 500uS
# 0010 - Wait 750uS
# ........
# 1111 - Wait 4000uS
# Round down, to value representing a multiple of 250u... | python | def set_ard_time(self, us):
""" Set the ACK retry delay for radio communication """
# Auto Retransmit Delay:
# 0000 - Wait 250uS
# 0001 - Wait 500uS
# 0010 - Wait 750uS
# ........
# 1111 - Wait 4000uS
# Round down, to value representing a multiple of 250u... | [
"def",
"set_ard_time",
"(",
"self",
",",
"us",
")",
":",
"# Auto Retransmit Delay:",
"# 0000 - Wait 250uS",
"# 0001 - Wait 500uS",
"# 0010 - Wait 750uS",
"# ........",
"# 1111 - Wait 4000uS",
"# Round down, to value representing a multiple of 250uS",
"t",
"=",
"int",
"(",
"(",
... | Set the ACK retry delay for radio communication | [
"Set",
"the",
"ACK",
"retry",
"delay",
"for",
"radio",
"communication"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/drivers/crazyradio.py#L215-L230 |
233,534 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toccache.py | TocCache.fetch | def fetch(self, crc):
""" Try to get a hit in the cache, return None otherwise """
cache_data = None
pattern = '%08X.json' % crc
hit = None
for name in self._cache_files:
if (name.endswith(pattern)):
hit = name
if (hit):
try:
... | python | def fetch(self, crc):
""" Try to get a hit in the cache, return None otherwise """
cache_data = None
pattern = '%08X.json' % crc
hit = None
for name in self._cache_files:
if (name.endswith(pattern)):
hit = name
if (hit):
try:
... | [
"def",
"fetch",
"(",
"self",
",",
"crc",
")",
":",
"cache_data",
"=",
"None",
"pattern",
"=",
"'%08X.json'",
"%",
"crc",
"hit",
"=",
"None",
"for",
"name",
"in",
"self",
".",
"_cache_files",
":",
"if",
"(",
"name",
".",
"endswith",
"(",
"pattern",
")... | Try to get a hit in the cache, return None otherwise | [
"Try",
"to",
"get",
"a",
"hit",
"in",
"the",
"cache",
"return",
"None",
"otherwise"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toccache.py#L62-L82 |
233,535 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toccache.py | TocCache.insert | def insert(self, crc, toc):
""" Save a new cache to file """
if self._rw_cache:
try:
filename = '%s/%08X.json' % (self._rw_cache, crc)
cache = open(filename, 'w')
cache.write(json.dumps(toc, indent=2,
defa... | python | def insert(self, crc, toc):
""" Save a new cache to file """
if self._rw_cache:
try:
filename = '%s/%08X.json' % (self._rw_cache, crc)
cache = open(filename, 'w')
cache.write(json.dumps(toc, indent=2,
defa... | [
"def",
"insert",
"(",
"self",
",",
"crc",
",",
"toc",
")",
":",
"if",
"self",
".",
"_rw_cache",
":",
"try",
":",
"filename",
"=",
"'%s/%08X.json'",
"%",
"(",
"self",
".",
"_rw_cache",
",",
"crc",
")",
"cache",
"=",
"open",
"(",
"filename",
",",
"'w... | Save a new cache to file | [
"Save",
"a",
"new",
"cache",
"to",
"file"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toccache.py#L84-L99 |
233,536 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toccache.py | TocCache._encoder | def _encoder(self, obj):
""" Encode a toc element leaf-node """
return {'__class__': obj.__class__.__name__,
'ident': obj.ident,
'group': obj.group,
'name': obj.name,
'ctype': obj.ctype,
'pytype': obj.pytype,
... | python | def _encoder(self, obj):
""" Encode a toc element leaf-node """
return {'__class__': obj.__class__.__name__,
'ident': obj.ident,
'group': obj.group,
'name': obj.name,
'ctype': obj.ctype,
'pytype': obj.pytype,
... | [
"def",
"_encoder",
"(",
"self",
",",
"obj",
")",
":",
"return",
"{",
"'__class__'",
":",
"obj",
".",
"__class__",
".",
"__name__",
",",
"'ident'",
":",
"obj",
".",
"ident",
",",
"'group'",
":",
"obj",
".",
"group",
",",
"'name'",
":",
"obj",
".",
"... | Encode a toc element leaf-node | [
"Encode",
"a",
"toc",
"element",
"leaf",
"-",
"node"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toccache.py#L101-L110 |
233,537 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toccache.py | TocCache._decoder | def _decoder(self, obj):
""" Decode a toc element leaf-node """
if '__class__' in obj:
elem = eval(obj['__class__'])()
elem.ident = obj['ident']
elem.group = str(obj['group'])
elem.name = str(obj['name'])
elem.ctype = str(obj['ctype'])
... | python | def _decoder(self, obj):
""" Decode a toc element leaf-node """
if '__class__' in obj:
elem = eval(obj['__class__'])()
elem.ident = obj['ident']
elem.group = str(obj['group'])
elem.name = str(obj['name'])
elem.ctype = str(obj['ctype'])
... | [
"def",
"_decoder",
"(",
"self",
",",
"obj",
")",
":",
"if",
"'__class__'",
"in",
"obj",
":",
"elem",
"=",
"eval",
"(",
"obj",
"[",
"'__class__'",
"]",
")",
"(",
")",
"elem",
".",
"ident",
"=",
"obj",
"[",
"'ident'",
"]",
"elem",
".",
"group",
"="... | Decode a toc element leaf-node | [
"Decode",
"a",
"toc",
"element",
"leaf",
"-",
"node"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toccache.py#L112-L123 |
233,538 | bitcraze/crazyflie-lib-python | lpslib/lopoanchor.py | LoPoAnchor.set_mode | def set_mode(self, anchor_id, mode):
"""
Send a packet to set the anchor mode. If the anchor receive the packet,
it will change mode and resets.
"""
data = struct.pack('<BB', LoPoAnchor.LPP_TYPE_MODE, mode)
self.crazyflie.loc.send_short_lpp_packet(anchor_id, data) | python | def set_mode(self, anchor_id, mode):
"""
Send a packet to set the anchor mode. If the anchor receive the packet,
it will change mode and resets.
"""
data = struct.pack('<BB', LoPoAnchor.LPP_TYPE_MODE, mode)
self.crazyflie.loc.send_short_lpp_packet(anchor_id, data) | [
"def",
"set_mode",
"(",
"self",
",",
"anchor_id",
",",
"mode",
")",
":",
"data",
"=",
"struct",
".",
"pack",
"(",
"'<BB'",
",",
"LoPoAnchor",
".",
"LPP_TYPE_MODE",
",",
"mode",
")",
"self",
".",
"crazyflie",
".",
"loc",
".",
"send_short_lpp_packet",
"(",... | Send a packet to set the anchor mode. If the anchor receive the packet,
it will change mode and resets. | [
"Send",
"a",
"packet",
"to",
"set",
"the",
"anchor",
"mode",
".",
"If",
"the",
"anchor",
"receive",
"the",
"packet",
"it",
"will",
"change",
"mode",
"and",
"resets",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/lpslib/lopoanchor.py#L66-L72 |
233,539 | bitcraze/crazyflie-lib-python | cflib/crazyflie/swarm.py | Swarm.open_links | def open_links(self):
"""
Open links to all individuals in the swarm
"""
if self._is_open:
raise Exception('Already opened')
try:
self.parallel_safe(lambda scf: scf.open_link())
self._is_open = True
except Exception as e:
s... | python | def open_links(self):
"""
Open links to all individuals in the swarm
"""
if self._is_open:
raise Exception('Already opened')
try:
self.parallel_safe(lambda scf: scf.open_link())
self._is_open = True
except Exception as e:
s... | [
"def",
"open_links",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_open",
":",
"raise",
"Exception",
"(",
"'Already opened'",
")",
"try",
":",
"self",
".",
"parallel_safe",
"(",
"lambda",
"scf",
":",
"scf",
".",
"open_link",
"(",
")",
")",
"self",
"."... | Open links to all individuals in the swarm | [
"Open",
"links",
"to",
"all",
"individuals",
"in",
"the",
"swarm"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/swarm.py#L80-L92 |
233,540 | bitcraze/crazyflie-lib-python | cflib/crazyflie/swarm.py | Swarm.close_links | def close_links(self):
"""
Close all open links
"""
for uri, cf in self._cfs.items():
cf.close_link()
self._is_open = False | python | def close_links(self):
"""
Close all open links
"""
for uri, cf in self._cfs.items():
cf.close_link()
self._is_open = False | [
"def",
"close_links",
"(",
"self",
")",
":",
"for",
"uri",
",",
"cf",
"in",
"self",
".",
"_cfs",
".",
"items",
"(",
")",
":",
"cf",
".",
"close_link",
"(",
")",
"self",
".",
"_is_open",
"=",
"False"
] | Close all open links | [
"Close",
"all",
"open",
"links"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/swarm.py#L94-L101 |
233,541 | bitcraze/crazyflie-lib-python | cflib/crazyflie/swarm.py | Swarm.sequential | def sequential(self, func, args_dict=None):
"""
Execute a function for all Crazyflies in the swarm, in sequence.
The first argument of the function that is passed in will be a
SyncCrazyflie instance connected to the Crazyflie to operate on.
A list of optional parameters (per Cra... | python | def sequential(self, func, args_dict=None):
"""
Execute a function for all Crazyflies in the swarm, in sequence.
The first argument of the function that is passed in will be a
SyncCrazyflie instance connected to the Crazyflie to operate on.
A list of optional parameters (per Cra... | [
"def",
"sequential",
"(",
"self",
",",
"func",
",",
"args_dict",
"=",
"None",
")",
":",
"for",
"uri",
",",
"cf",
"in",
"self",
".",
"_cfs",
".",
"items",
"(",
")",
":",
"args",
"=",
"self",
".",
"_process_args_dict",
"(",
"cf",
",",
"uri",
",",
"... | Execute a function for all Crazyflies in the swarm, in sequence.
The first argument of the function that is passed in will be a
SyncCrazyflie instance connected to the Crazyflie to operate on.
A list of optional parameters (per Crazyflie) may follow defined by
the args_dict. The diction... | [
"Execute",
"a",
"function",
"for",
"all",
"Crazyflies",
"in",
"the",
"swarm",
"in",
"sequence",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/swarm.py#L110-L137 |
233,542 | bitcraze/crazyflie-lib-python | cflib/crazyflie/swarm.py | Swarm.parallel_safe | def parallel_safe(self, func, args_dict=None):
"""
Execute a function for all Crazyflies in the swarm, in parallel.
One thread per Crazyflie is started to execute the function. The
threads are joined at the end and if one or more of the threads raised
an exception this function w... | python | def parallel_safe(self, func, args_dict=None):
"""
Execute a function for all Crazyflies in the swarm, in parallel.
One thread per Crazyflie is started to execute the function. The
threads are joined at the end and if one or more of the threads raised
an exception this function w... | [
"def",
"parallel_safe",
"(",
"self",
",",
"func",
",",
"args_dict",
"=",
"None",
")",
":",
"threads",
"=",
"[",
"]",
"reporter",
"=",
"self",
".",
"Reporter",
"(",
")",
"for",
"uri",
",",
"scf",
"in",
"self",
".",
"_cfs",
".",
"items",
"(",
")",
... | Execute a function for all Crazyflies in the swarm, in parallel.
One thread per Crazyflie is started to execute the function. The
threads are joined at the end and if one or more of the threads raised
an exception this function will also raise an exception.
For a description of the argu... | [
"Execute",
"a",
"function",
"for",
"all",
"Crazyflies",
"in",
"the",
"swarm",
"in",
"parallel",
".",
"One",
"thread",
"per",
"Crazyflie",
"is",
"started",
"to",
"execute",
"the",
"function",
".",
"The",
"threads",
"are",
"joined",
"at",
"the",
"end",
"and"... | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/swarm.py#L156-L184 |
233,543 | bitcraze/crazyflie-lib-python | cflib/positioning/position_hl_commander.py | PositionHlCommander.take_off | def take_off(self, height=DEFAULT, velocity=DEFAULT):
"""
Takes off, that is starts the motors, goes straight up and hovers.
Do not call this function if you use the with keyword. Take off is
done automatically when the context is created.
:param height: the height (meters) to h... | python | def take_off(self, height=DEFAULT, velocity=DEFAULT):
"""
Takes off, that is starts the motors, goes straight up and hovers.
Do not call this function if you use the with keyword. Take off is
done automatically when the context is created.
:param height: the height (meters) to h... | [
"def",
"take_off",
"(",
"self",
",",
"height",
"=",
"DEFAULT",
",",
"velocity",
"=",
"DEFAULT",
")",
":",
"if",
"self",
".",
"_is_flying",
":",
"raise",
"Exception",
"(",
"'Already flying'",
")",
"if",
"not",
"self",
".",
"_cf",
".",
"is_connected",
"(",... | Takes off, that is starts the motors, goes straight up and hovers.
Do not call this function if you use the with keyword. Take off is
done automatically when the context is created.
:param height: the height (meters) to hover at. None uses the default
height set when cons... | [
"Takes",
"off",
"that",
"is",
"starts",
"the",
"motors",
"goes",
"straight",
"up",
"and",
"hovers",
".",
"Do",
"not",
"call",
"this",
"function",
"if",
"you",
"use",
"the",
"with",
"keyword",
".",
"Take",
"off",
"is",
"done",
"automatically",
"when",
"th... | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/positioning/position_hl_commander.py#L82-L110 |
233,544 | bitcraze/crazyflie-lib-python | cflib/positioning/position_hl_commander.py | PositionHlCommander.go_to | def go_to(self, x, y, z=DEFAULT, velocity=DEFAULT):
"""
Go to a position
:param x: X coordinate
:param y: Y coordinate
:param z: Z coordinate
:param velocity: the velocity (meters/second)
:return:
"""
z = self._height(z)
dx = x - self._x... | python | def go_to(self, x, y, z=DEFAULT, velocity=DEFAULT):
"""
Go to a position
:param x: X coordinate
:param y: Y coordinate
:param z: Z coordinate
:param velocity: the velocity (meters/second)
:return:
"""
z = self._height(z)
dx = x - self._x... | [
"def",
"go_to",
"(",
"self",
",",
"x",
",",
"y",
",",
"z",
"=",
"DEFAULT",
",",
"velocity",
"=",
"DEFAULT",
")",
":",
"z",
"=",
"self",
".",
"_height",
"(",
"z",
")",
"dx",
"=",
"x",
"-",
"self",
".",
"_x",
"dy",
"=",
"y",
"-",
"self",
".",... | Go to a position
:param x: X coordinate
:param y: Y coordinate
:param z: Z coordinate
:param velocity: the velocity (meters/second)
:return: | [
"Go",
"to",
"a",
"position"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/positioning/position_hl_commander.py#L219-L243 |
233,545 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param.request_update_of_all_params | def request_update_of_all_params(self):
"""Request an update of all the parameters in the TOC"""
for group in self.toc.toc:
for name in self.toc.toc[group]:
complete_name = '%s.%s' % (group, name)
self.request_param_update(complete_name) | python | def request_update_of_all_params(self):
"""Request an update of all the parameters in the TOC"""
for group in self.toc.toc:
for name in self.toc.toc[group]:
complete_name = '%s.%s' % (group, name)
self.request_param_update(complete_name) | [
"def",
"request_update_of_all_params",
"(",
"self",
")",
":",
"for",
"group",
"in",
"self",
".",
"toc",
".",
"toc",
":",
"for",
"name",
"in",
"self",
".",
"toc",
".",
"toc",
"[",
"group",
"]",
":",
"complete_name",
"=",
"'%s.%s'",
"%",
"(",
"group",
... | Request an update of all the parameters in the TOC | [
"Request",
"an",
"update",
"of",
"all",
"the",
"parameters",
"in",
"the",
"TOC"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L145-L150 |
233,546 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param._check_if_all_updated | def _check_if_all_updated(self):
"""Check if all parameters from the TOC has at least been fetched
once"""
for g in self.toc.toc:
if g not in self.values:
return False
for n in self.toc.toc[g]:
if n not in self.values[g]:
... | python | def _check_if_all_updated(self):
"""Check if all parameters from the TOC has at least been fetched
once"""
for g in self.toc.toc:
if g not in self.values:
return False
for n in self.toc.toc[g]:
if n not in self.values[g]:
... | [
"def",
"_check_if_all_updated",
"(",
"self",
")",
":",
"for",
"g",
"in",
"self",
".",
"toc",
".",
"toc",
":",
"if",
"g",
"not",
"in",
"self",
".",
"values",
":",
"return",
"False",
"for",
"n",
"in",
"self",
".",
"toc",
".",
"toc",
"[",
"g",
"]",
... | Check if all parameters from the TOC has at least been fetched
once | [
"Check",
"if",
"all",
"parameters",
"from",
"the",
"TOC",
"has",
"at",
"least",
"been",
"fetched",
"once"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L152-L162 |
233,547 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param._param_updated | def _param_updated(self, pk):
"""Callback with data for an updated parameter"""
if self._useV2:
var_id = struct.unpack('<H', pk.data[:2])[0]
else:
var_id = pk.data[0]
element = self.toc.get_element_by_id(var_id)
if element:
if self._useV2:
... | python | def _param_updated(self, pk):
"""Callback with data for an updated parameter"""
if self._useV2:
var_id = struct.unpack('<H', pk.data[:2])[0]
else:
var_id = pk.data[0]
element = self.toc.get_element_by_id(var_id)
if element:
if self._useV2:
... | [
"def",
"_param_updated",
"(",
"self",
",",
"pk",
")",
":",
"if",
"self",
".",
"_useV2",
":",
"var_id",
"=",
"struct",
".",
"unpack",
"(",
"'<H'",
",",
"pk",
".",
"data",
"[",
":",
"2",
"]",
")",
"[",
"0",
"]",
"else",
":",
"var_id",
"=",
"pk",
... | Callback with data for an updated parameter | [
"Callback",
"with",
"data",
"for",
"an",
"updated",
"parameter"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L164-L200 |
233,548 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param.remove_update_callback | def remove_update_callback(self, group, name=None, cb=None):
"""Remove the supplied callback for a group or a group.name"""
if not cb:
return
if not name:
if group in self.group_update_callbacks:
self.group_update_callbacks[group].remove_callback(cb)
... | python | def remove_update_callback(self, group, name=None, cb=None):
"""Remove the supplied callback for a group or a group.name"""
if not cb:
return
if not name:
if group in self.group_update_callbacks:
self.group_update_callbacks[group].remove_callback(cb)
... | [
"def",
"remove_update_callback",
"(",
"self",
",",
"group",
",",
"name",
"=",
"None",
",",
"cb",
"=",
"None",
")",
":",
"if",
"not",
"cb",
":",
"return",
"if",
"not",
"name",
":",
"if",
"group",
"in",
"self",
".",
"group_update_callbacks",
":",
"self",... | Remove the supplied callback for a group or a group.name | [
"Remove",
"the",
"supplied",
"callback",
"for",
"a",
"group",
"or",
"a",
"group",
".",
"name"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L202-L213 |
233,549 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param.add_update_callback | def add_update_callback(self, group=None, name=None, cb=None):
"""
Add a callback for a specific parameter name. This callback will be
executed when a new value is read from the Crazyflie.
"""
if not group and not name:
self.all_update_callback.add_callback(cb)
... | python | def add_update_callback(self, group=None, name=None, cb=None):
"""
Add a callback for a specific parameter name. This callback will be
executed when a new value is read from the Crazyflie.
"""
if not group and not name:
self.all_update_callback.add_callback(cb)
... | [
"def",
"add_update_callback",
"(",
"self",
",",
"group",
"=",
"None",
",",
"name",
"=",
"None",
",",
"cb",
"=",
"None",
")",
":",
"if",
"not",
"group",
"and",
"not",
"name",
":",
"self",
".",
"all_update_callback",
".",
"add_callback",
"(",
"cb",
")",
... | Add a callback for a specific parameter name. This callback will be
executed when a new value is read from the Crazyflie. | [
"Add",
"a",
"callback",
"for",
"a",
"specific",
"parameter",
"name",
".",
"This",
"callback",
"will",
"be",
"executed",
"when",
"a",
"new",
"value",
"is",
"read",
"from",
"the",
"Crazyflie",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L215-L230 |
233,550 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param.refresh_toc | def refresh_toc(self, refresh_done_callback, toc_cache):
"""
Initiate a refresh of the parameter TOC.
"""
self._useV2 = self.cf.platform.get_protocol_version() >= 4
toc_fetcher = TocFetcher(self.cf, ParamTocElement,
CRTPPort.PARAM, self.toc,
... | python | def refresh_toc(self, refresh_done_callback, toc_cache):
"""
Initiate a refresh of the parameter TOC.
"""
self._useV2 = self.cf.platform.get_protocol_version() >= 4
toc_fetcher = TocFetcher(self.cf, ParamTocElement,
CRTPPort.PARAM, self.toc,
... | [
"def",
"refresh_toc",
"(",
"self",
",",
"refresh_done_callback",
",",
"toc_cache",
")",
":",
"self",
".",
"_useV2",
"=",
"self",
".",
"cf",
".",
"platform",
".",
"get_protocol_version",
"(",
")",
">=",
"4",
"toc_fetcher",
"=",
"TocFetcher",
"(",
"self",
".... | Initiate a refresh of the parameter TOC. | [
"Initiate",
"a",
"refresh",
"of",
"the",
"parameter",
"TOC",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L232-L240 |
233,551 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param._disconnected | def _disconnected(self, uri):
"""Disconnected callback from Crazyflie API"""
self.param_updater.close()
self.is_updated = False
# Clear all values from the previous Crazyflie
self.toc = Toc()
self.values = {} | python | def _disconnected(self, uri):
"""Disconnected callback from Crazyflie API"""
self.param_updater.close()
self.is_updated = False
# Clear all values from the previous Crazyflie
self.toc = Toc()
self.values = {} | [
"def",
"_disconnected",
"(",
"self",
",",
"uri",
")",
":",
"self",
".",
"param_updater",
".",
"close",
"(",
")",
"self",
".",
"is_updated",
"=",
"False",
"# Clear all values from the previous Crazyflie",
"self",
".",
"toc",
"=",
"Toc",
"(",
")",
"self",
".",... | Disconnected callback from Crazyflie API | [
"Disconnected",
"callback",
"from",
"Crazyflie",
"API"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L242-L248 |
233,552 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param.request_param_update | def request_param_update(self, complete_name):
"""
Request an update of the value for the supplied parameter.
"""
self.param_updater.request_param_update(
self.toc.get_element_id(complete_name)) | python | def request_param_update(self, complete_name):
"""
Request an update of the value for the supplied parameter.
"""
self.param_updater.request_param_update(
self.toc.get_element_id(complete_name)) | [
"def",
"request_param_update",
"(",
"self",
",",
"complete_name",
")",
":",
"self",
".",
"param_updater",
".",
"request_param_update",
"(",
"self",
".",
"toc",
".",
"get_element_id",
"(",
"complete_name",
")",
")"
] | Request an update of the value for the supplied parameter. | [
"Request",
"an",
"update",
"of",
"the",
"value",
"for",
"the",
"supplied",
"parameter",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L250-L255 |
233,553 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | Param.set_value | def set_value(self, complete_name, value):
"""
Set the value for the supplied parameter.
"""
element = self.toc.get_element_by_complete_name(complete_name)
if not element:
logger.warning("Cannot set value for [%s], it's not in the TOC!",
co... | python | def set_value(self, complete_name, value):
"""
Set the value for the supplied parameter.
"""
element = self.toc.get_element_by_complete_name(complete_name)
if not element:
logger.warning("Cannot set value for [%s], it's not in the TOC!",
co... | [
"def",
"set_value",
"(",
"self",
",",
"complete_name",
",",
"value",
")",
":",
"element",
"=",
"self",
".",
"toc",
".",
"get_element_by_complete_name",
"(",
"complete_name",
")",
"if",
"not",
"element",
":",
"logger",
".",
"warning",
"(",
"\"Cannot set value f... | Set the value for the supplied parameter. | [
"Set",
"the",
"value",
"for",
"the",
"supplied",
"parameter",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L257-L286 |
233,554 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | _ParamUpdater._new_packet_cb | def _new_packet_cb(self, pk):
"""Callback for newly arrived packets"""
if pk.channel == READ_CHANNEL or pk.channel == WRITE_CHANNEL:
if self._useV2:
var_id = struct.unpack('<H', pk.data[:2])[0]
if pk.channel == READ_CHANNEL:
pk.data = pk.da... | python | def _new_packet_cb(self, pk):
"""Callback for newly arrived packets"""
if pk.channel == READ_CHANNEL or pk.channel == WRITE_CHANNEL:
if self._useV2:
var_id = struct.unpack('<H', pk.data[:2])[0]
if pk.channel == READ_CHANNEL:
pk.data = pk.da... | [
"def",
"_new_packet_cb",
"(",
"self",
",",
"pk",
")",
":",
"if",
"pk",
".",
"channel",
"==",
"READ_CHANNEL",
"or",
"pk",
".",
"channel",
"==",
"WRITE_CHANNEL",
":",
"if",
"self",
".",
"_useV2",
":",
"var_id",
"=",
"struct",
".",
"unpack",
"(",
"'<H'",
... | Callback for newly arrived packets | [
"Callback",
"for",
"newly",
"arrived",
"packets"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L322-L338 |
233,555 | bitcraze/crazyflie-lib-python | cflib/crazyflie/param.py | _ParamUpdater.request_param_update | def request_param_update(self, var_id):
"""Place a param update request on the queue"""
self._useV2 = self.cf.platform.get_protocol_version() >= 4
pk = CRTPPacket()
pk.set_header(CRTPPort.PARAM, READ_CHANNEL)
if self._useV2:
pk.data = struct.pack('<H', var_id)
... | python | def request_param_update(self, var_id):
"""Place a param update request on the queue"""
self._useV2 = self.cf.platform.get_protocol_version() >= 4
pk = CRTPPacket()
pk.set_header(CRTPPort.PARAM, READ_CHANNEL)
if self._useV2:
pk.data = struct.pack('<H', var_id)
... | [
"def",
"request_param_update",
"(",
"self",
",",
"var_id",
")",
":",
"self",
".",
"_useV2",
"=",
"self",
".",
"cf",
".",
"platform",
".",
"get_protocol_version",
"(",
")",
">=",
"4",
"pk",
"=",
"CRTPPacket",
"(",
")",
"pk",
".",
"set_header",
"(",
"CRT... | Place a param update request on the queue | [
"Place",
"a",
"param",
"update",
"request",
"on",
"the",
"queue"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L340-L350 |
233,556 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toc.py | Toc.add_element | def add_element(self, element):
"""Add a new TocElement to the TOC container."""
try:
self.toc[element.group][element.name] = element
except KeyError:
self.toc[element.group] = {}
self.toc[element.group][element.name] = element | python | def add_element(self, element):
"""Add a new TocElement to the TOC container."""
try:
self.toc[element.group][element.name] = element
except KeyError:
self.toc[element.group] = {}
self.toc[element.group][element.name] = element | [
"def",
"add_element",
"(",
"self",
",",
"element",
")",
":",
"try",
":",
"self",
".",
"toc",
"[",
"element",
".",
"group",
"]",
"[",
"element",
".",
"name",
"]",
"=",
"element",
"except",
"KeyError",
":",
"self",
".",
"toc",
"[",
"element",
".",
"g... | Add a new TocElement to the TOC container. | [
"Add",
"a",
"new",
"TocElement",
"to",
"the",
"TOC",
"container",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toc.py#L65-L71 |
233,557 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toc.py | Toc.get_element_id | def get_element_id(self, complete_name):
"""Get the TocElement element id-number of the element with the
supplied name."""
[group, name] = complete_name.split('.')
element = self.get_element(group, name)
if element:
return element.ident
else:
logge... | python | def get_element_id(self, complete_name):
"""Get the TocElement element id-number of the element with the
supplied name."""
[group, name] = complete_name.split('.')
element = self.get_element(group, name)
if element:
return element.ident
else:
logge... | [
"def",
"get_element_id",
"(",
"self",
",",
"complete_name",
")",
":",
"[",
"group",
",",
"name",
"]",
"=",
"complete_name",
".",
"split",
"(",
"'.'",
")",
"element",
"=",
"self",
".",
"get_element",
"(",
"group",
",",
"name",
")",
"if",
"element",
":",... | Get the TocElement element id-number of the element with the
supplied name. | [
"Get",
"the",
"TocElement",
"element",
"id",
"-",
"number",
"of",
"the",
"element",
"with",
"the",
"supplied",
"name",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toc.py#L82-L91 |
233,558 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toc.py | Toc.get_element_by_id | def get_element_by_id(self, ident):
"""Get a TocElement element identified by index number from the
container."""
for group in list(self.toc.keys()):
for name in list(self.toc[group].keys()):
if self.toc[group][name].ident == ident:
return self.toc... | python | def get_element_by_id(self, ident):
"""Get a TocElement element identified by index number from the
container."""
for group in list(self.toc.keys()):
for name in list(self.toc[group].keys()):
if self.toc[group][name].ident == ident:
return self.toc... | [
"def",
"get_element_by_id",
"(",
"self",
",",
"ident",
")",
":",
"for",
"group",
"in",
"list",
"(",
"self",
".",
"toc",
".",
"keys",
"(",
")",
")",
":",
"for",
"name",
"in",
"list",
"(",
"self",
".",
"toc",
"[",
"group",
"]",
".",
"keys",
"(",
... | Get a TocElement element identified by index number from the
container. | [
"Get",
"a",
"TocElement",
"element",
"identified",
"by",
"index",
"number",
"from",
"the",
"container",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toc.py#L101-L108 |
233,559 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toc.py | TocFetcher.start | def start(self):
"""Initiate fetching of the TOC."""
self._useV2 = self.cf.platform.get_protocol_version() >= 4
logger.debug('[%d]: Using V2 protocol: %d', self.port, self._useV2)
logger.debug('[%d]: Start fetching...', self.port)
# Register callback in this class for the port
... | python | def start(self):
"""Initiate fetching of the TOC."""
self._useV2 = self.cf.platform.get_protocol_version() >= 4
logger.debug('[%d]: Using V2 protocol: %d', self.port, self._useV2)
logger.debug('[%d]: Start fetching...', self.port)
# Register callback in this class for the port
... | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"_useV2",
"=",
"self",
".",
"cf",
".",
"platform",
".",
"get_protocol_version",
"(",
")",
">=",
"4",
"logger",
".",
"debug",
"(",
"'[%d]: Using V2 protocol: %d'",
",",
"self",
".",
"port",
",",
"self",
... | Initiate fetching of the TOC. | [
"Initiate",
"fetching",
"of",
"the",
"TOC",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toc.py#L128-L147 |
233,560 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toc.py | TocFetcher._toc_fetch_finished | def _toc_fetch_finished(self):
"""Callback for when the TOC fetching is finished"""
self.cf.remove_port_callback(self.port, self._new_packet_cb)
logger.debug('[%d]: Done!', self.port)
self.finished_callback() | python | def _toc_fetch_finished(self):
"""Callback for when the TOC fetching is finished"""
self.cf.remove_port_callback(self.port, self._new_packet_cb)
logger.debug('[%d]: Done!', self.port)
self.finished_callback() | [
"def",
"_toc_fetch_finished",
"(",
"self",
")",
":",
"self",
".",
"cf",
".",
"remove_port_callback",
"(",
"self",
".",
"port",
",",
"self",
".",
"_new_packet_cb",
")",
"logger",
".",
"debug",
"(",
"'[%d]: Done!'",
",",
"self",
".",
"port",
")",
"self",
"... | Callback for when the TOC fetching is finished | [
"Callback",
"for",
"when",
"the",
"TOC",
"fetching",
"is",
"finished"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toc.py#L149-L153 |
233,561 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toc.py | TocFetcher._new_packet_cb | def _new_packet_cb(self, packet):
"""Handle a newly arrived packet"""
chan = packet.channel
if (chan != 0):
return
payload = packet.data[1:]
if (self.state == GET_TOC_INFO):
if self._useV2:
[self.nbr_of_items, self._crc] = struct.unpack(
... | python | def _new_packet_cb(self, packet):
"""Handle a newly arrived packet"""
chan = packet.channel
if (chan != 0):
return
payload = packet.data[1:]
if (self.state == GET_TOC_INFO):
if self._useV2:
[self.nbr_of_items, self._crc] = struct.unpack(
... | [
"def",
"_new_packet_cb",
"(",
"self",
",",
"packet",
")",
":",
"chan",
"=",
"packet",
".",
"channel",
"if",
"(",
"chan",
"!=",
"0",
")",
":",
"return",
"payload",
"=",
"packet",
".",
"data",
"[",
"1",
":",
"]",
"if",
"(",
"self",
".",
"state",
"=... | Handle a newly arrived packet | [
"Handle",
"a",
"newly",
"arrived",
"packet"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toc.py#L155-L204 |
233,562 | bitcraze/crazyflie-lib-python | cflib/crazyflie/toc.py | TocFetcher._request_toc_element | def _request_toc_element(self, index):
"""Request information about a specific item in the TOC"""
logger.debug('Requesting index %d on port %d', index, self.port)
pk = CRTPPacket()
if self._useV2:
pk.set_header(self.port, TOC_CHANNEL)
pk.data = (CMD_TOC_ITEM_V2, i... | python | def _request_toc_element(self, index):
"""Request information about a specific item in the TOC"""
logger.debug('Requesting index %d on port %d', index, self.port)
pk = CRTPPacket()
if self._useV2:
pk.set_header(self.port, TOC_CHANNEL)
pk.data = (CMD_TOC_ITEM_V2, i... | [
"def",
"_request_toc_element",
"(",
"self",
",",
"index",
")",
":",
"logger",
".",
"debug",
"(",
"'Requesting index %d on port %d'",
",",
"index",
",",
"self",
".",
"port",
")",
"pk",
"=",
"CRTPPacket",
"(",
")",
"if",
"self",
".",
"_useV2",
":",
"pk",
"... | Request information about a specific item in the TOC | [
"Request",
"information",
"about",
"a",
"specific",
"item",
"in",
"the",
"TOC"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/toc.py#L206-L218 |
233,563 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie._start_connection_setup | def _start_connection_setup(self):
"""Start the connection setup by refreshing the TOCs"""
logger.info('We are connected[%s], request connection setup',
self.link_uri)
self.platform.fetch_platform_informations(self._platform_info_fetched) | python | def _start_connection_setup(self):
"""Start the connection setup by refreshing the TOCs"""
logger.info('We are connected[%s], request connection setup',
self.link_uri)
self.platform.fetch_platform_informations(self._platform_info_fetched) | [
"def",
"_start_connection_setup",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'We are connected[%s], request connection setup'",
",",
"self",
".",
"link_uri",
")",
"self",
".",
"platform",
".",
"fetch_platform_informations",
"(",
"self",
".",
"_platform_info_f... | Start the connection setup by refreshing the TOCs | [
"Start",
"the",
"connection",
"setup",
"by",
"refreshing",
"the",
"TOCs"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L156-L160 |
233,564 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie._param_toc_updated_cb | def _param_toc_updated_cb(self):
"""Called when the param TOC has been fully updated"""
logger.info('Param TOC finished updating')
self.connected_ts = datetime.datetime.now()
self.connected.call(self.link_uri)
# Trigger the update for all the parameters
self.param.request... | python | def _param_toc_updated_cb(self):
"""Called when the param TOC has been fully updated"""
logger.info('Param TOC finished updating')
self.connected_ts = datetime.datetime.now()
self.connected.call(self.link_uri)
# Trigger the update for all the parameters
self.param.request... | [
"def",
"_param_toc_updated_cb",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'Param TOC finished updating'",
")",
"self",
".",
"connected_ts",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"self",
".",
"connected",
".",
"call",
"(",
"self",
... | Called when the param TOC has been fully updated | [
"Called",
"when",
"the",
"param",
"TOC",
"has",
"been",
"fully",
"updated"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L165-L171 |
233,565 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie._mems_updated_cb | def _mems_updated_cb(self):
"""Called when the memories have been identified"""
logger.info('Memories finished updating')
self.param.refresh_toc(self._param_toc_updated_cb, self._toc_cache) | python | def _mems_updated_cb(self):
"""Called when the memories have been identified"""
logger.info('Memories finished updating')
self.param.refresh_toc(self._param_toc_updated_cb, self._toc_cache) | [
"def",
"_mems_updated_cb",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'Memories finished updating'",
")",
"self",
".",
"param",
".",
"refresh_toc",
"(",
"self",
".",
"_param_toc_updated_cb",
",",
"self",
".",
"_toc_cache",
")"
] | Called when the memories have been identified | [
"Called",
"when",
"the",
"memories",
"have",
"been",
"identified"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L173-L176 |
233,566 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie._link_error_cb | def _link_error_cb(self, errmsg):
"""Called from the link driver when there's an error"""
logger.warning('Got link error callback [%s] in state [%s]',
errmsg, self.state)
if (self.link is not None):
self.link.close()
self.link = None
if (self.st... | python | def _link_error_cb(self, errmsg):
"""Called from the link driver when there's an error"""
logger.warning('Got link error callback [%s] in state [%s]',
errmsg, self.state)
if (self.link is not None):
self.link.close()
self.link = None
if (self.st... | [
"def",
"_link_error_cb",
"(",
"self",
",",
"errmsg",
")",
":",
"logger",
".",
"warning",
"(",
"'Got link error callback [%s] in state [%s]'",
",",
"errmsg",
",",
"self",
".",
"state",
")",
"if",
"(",
"self",
".",
"link",
"is",
"not",
"None",
")",
":",
"sel... | Called from the link driver when there's an error | [
"Called",
"from",
"the",
"link",
"driver",
"when",
"there",
"s",
"an",
"error"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L183-L196 |
233,567 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie._check_for_initial_packet_cb | def _check_for_initial_packet_cb(self, data):
"""
Called when first packet arrives from Crazyflie.
This is used to determine if we are connected to something that is
answering.
"""
self.state = State.CONNECTED
self.link_established.call(self.link_uri)
sel... | python | def _check_for_initial_packet_cb(self, data):
"""
Called when first packet arrives from Crazyflie.
This is used to determine if we are connected to something that is
answering.
"""
self.state = State.CONNECTED
self.link_established.call(self.link_uri)
sel... | [
"def",
"_check_for_initial_packet_cb",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"state",
"=",
"State",
".",
"CONNECTED",
"self",
".",
"link_established",
".",
"call",
"(",
"self",
".",
"link_uri",
")",
"self",
".",
"packet_received",
".",
"remove_cal... | Called when first packet arrives from Crazyflie.
This is used to determine if we are connected to something that is
answering. | [
"Called",
"when",
"first",
"packet",
"arrives",
"from",
"Crazyflie",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L202-L211 |
233,568 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie.close_link | def close_link(self):
"""Close the communication link."""
logger.info('Closing link')
if (self.link is not None):
self.commander.send_setpoint(0, 0, 0, 0)
if (self.link is not None):
self.link.close()
self.link = None
self._answer_patterns = {}... | python | def close_link(self):
"""Close the communication link."""
logger.info('Closing link')
if (self.link is not None):
self.commander.send_setpoint(0, 0, 0, 0)
if (self.link is not None):
self.link.close()
self.link = None
self._answer_patterns = {}... | [
"def",
"close_link",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'Closing link'",
")",
"if",
"(",
"self",
".",
"link",
"is",
"not",
"None",
")",
":",
"self",
".",
"commander",
".",
"send_setpoint",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
... | Close the communication link. | [
"Close",
"the",
"communication",
"link",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L251-L260 |
233,569 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie._no_answer_do_retry | def _no_answer_do_retry(self, pk, pattern):
"""Resend packets that we have not gotten answers to"""
logger.info('Resending for pattern %s', pattern)
# Set the timer to None before trying to send again
self.send_packet(pk, expected_reply=pattern, resend=True) | python | def _no_answer_do_retry(self, pk, pattern):
"""Resend packets that we have not gotten answers to"""
logger.info('Resending for pattern %s', pattern)
# Set the timer to None before trying to send again
self.send_packet(pk, expected_reply=pattern, resend=True) | [
"def",
"_no_answer_do_retry",
"(",
"self",
",",
"pk",
",",
"pattern",
")",
":",
"logger",
".",
"info",
"(",
"'Resending for pattern %s'",
",",
"pattern",
")",
"# Set the timer to None before trying to send again",
"self",
".",
"send_packet",
"(",
"pk",
",",
"expecte... | Resend packets that we have not gotten answers to | [
"Resend",
"packets",
"that",
"we",
"have",
"not",
"gotten",
"answers",
"to"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L275-L279 |
233,570 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie._check_for_answers | def _check_for_answers(self, pk):
"""
Callback called for every packet received to check if we are
waiting for an answer on this port. If so, then cancel the retry
timer.
"""
longest_match = ()
if len(self._answer_patterns) > 0:
data = (pk.header,) + t... | python | def _check_for_answers(self, pk):
"""
Callback called for every packet received to check if we are
waiting for an answer on this port. If so, then cancel the retry
timer.
"""
longest_match = ()
if len(self._answer_patterns) > 0:
data = (pk.header,) + t... | [
"def",
"_check_for_answers",
"(",
"self",
",",
"pk",
")",
":",
"longest_match",
"=",
"(",
")",
"if",
"len",
"(",
"self",
".",
"_answer_patterns",
")",
">",
"0",
":",
"data",
"=",
"(",
"pk",
".",
"header",
",",
")",
"+",
"tuple",
"(",
"pk",
".",
"... | Callback called for every packet received to check if we are
waiting for an answer on this port. If so, then cancel the retry
timer. | [
"Callback",
"called",
"for",
"every",
"packet",
"received",
"to",
"check",
"if",
"we",
"are",
"waiting",
"for",
"an",
"answer",
"on",
"this",
"port",
".",
"If",
"so",
"then",
"cancel",
"the",
"retry",
"timer",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L281-L300 |
233,571 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | Crazyflie.send_packet | def send_packet(self, pk, expected_reply=(), resend=False, timeout=0.2):
"""
Send a packet through the link interface.
pk -- Packet to send
expect_answer -- True if a packet from the Crazyflie is expected to
be sent back, otherwise false
"""
sel... | python | def send_packet(self, pk, expected_reply=(), resend=False, timeout=0.2):
"""
Send a packet through the link interface.
pk -- Packet to send
expect_answer -- True if a packet from the Crazyflie is expected to
be sent back, otherwise false
"""
sel... | [
"def",
"send_packet",
"(",
"self",
",",
"pk",
",",
"expected_reply",
"=",
"(",
")",
",",
"resend",
"=",
"False",
",",
"timeout",
"=",
"0.2",
")",
":",
"self",
".",
"_send_lock",
".",
"acquire",
"(",
")",
"if",
"self",
".",
"link",
"is",
"not",
"Non... | Send a packet through the link interface.
pk -- Packet to send
expect_answer -- True if a packet from the Crazyflie is expected to
be sent back, otherwise false | [
"Send",
"a",
"packet",
"through",
"the",
"link",
"interface",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L302-L341 |
233,572 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | _IncomingPacketHandler.add_port_callback | def add_port_callback(self, port, cb):
"""Add a callback for data that comes on a specific port"""
logger.debug('Adding callback on port [%d] to [%s]', port, cb)
self.add_header_callback(cb, port, 0, 0xff, 0x0) | python | def add_port_callback(self, port, cb):
"""Add a callback for data that comes on a specific port"""
logger.debug('Adding callback on port [%d] to [%s]', port, cb)
self.add_header_callback(cb, port, 0, 0xff, 0x0) | [
"def",
"add_port_callback",
"(",
"self",
",",
"port",
",",
"cb",
")",
":",
"logger",
".",
"debug",
"(",
"'Adding callback on port [%d] to [%s]'",
",",
"port",
",",
"cb",
")",
"self",
".",
"add_header_callback",
"(",
"cb",
",",
"port",
",",
"0",
",",
"0xff"... | Add a callback for data that comes on a specific port | [
"Add",
"a",
"callback",
"for",
"data",
"that",
"comes",
"on",
"a",
"specific",
"port"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L356-L359 |
233,573 | bitcraze/crazyflie-lib-python | cflib/crazyflie/__init__.py | _IncomingPacketHandler.remove_port_callback | def remove_port_callback(self, port, cb):
"""Remove a callback for data that comes on a specific port"""
logger.debug('Removing callback on port [%d] to [%s]', port, cb)
for port_callback in self.cb:
if port_callback.port == port and port_callback.callback == cb:
self... | python | def remove_port_callback(self, port, cb):
"""Remove a callback for data that comes on a specific port"""
logger.debug('Removing callback on port [%d] to [%s]', port, cb)
for port_callback in self.cb:
if port_callback.port == port and port_callback.callback == cb:
self... | [
"def",
"remove_port_callback",
"(",
"self",
",",
"port",
",",
"cb",
")",
":",
"logger",
".",
"debug",
"(",
"'Removing callback on port [%d] to [%s]'",
",",
"port",
",",
"cb",
")",
"for",
"port_callback",
"in",
"self",
".",
"cb",
":",
"if",
"port_callback",
"... | Remove a callback for data that comes on a specific port | [
"Remove",
"a",
"callback",
"for",
"data",
"that",
"comes",
"on",
"a",
"specific",
"port"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L361-L366 |
233,574 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | LogConfig.add_variable | def add_variable(self, name, fetch_as=None):
"""Add a new variable to the configuration.
name - Complete name of the variable in the form group.name
fetch_as - String representation of the type the variable should be
fetched as (i.e uint8_t, float, FP16, etc)
If no f... | python | def add_variable(self, name, fetch_as=None):
"""Add a new variable to the configuration.
name - Complete name of the variable in the form group.name
fetch_as - String representation of the type the variable should be
fetched as (i.e uint8_t, float, FP16, etc)
If no f... | [
"def",
"add_variable",
"(",
"self",
",",
"name",
",",
"fetch_as",
"=",
"None",
")",
":",
"if",
"fetch_as",
":",
"self",
".",
"variables",
".",
"append",
"(",
"LogVariable",
"(",
"name",
",",
"fetch_as",
")",
")",
"else",
":",
"# We cannot determine the def... | Add a new variable to the configuration.
name - Complete name of the variable in the form group.name
fetch_as - String representation of the type the variable should be
fetched as (i.e uint8_t, float, FP16, etc)
If no fetch_as type is supplied, then the stored as type will b... | [
"Add",
"a",
"new",
"variable",
"to",
"the",
"configuration",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L171-L186 |
233,575 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | LogConfig.add_memory | def add_memory(self, name, fetch_as, stored_as, address):
"""Add a raw memory position to log.
name - Arbitrary name of the variable
fetch_as - String representation of the type of the data the memory
should be fetch as (i.e uint8_t, float, FP16)
stored_as - String re... | python | def add_memory(self, name, fetch_as, stored_as, address):
"""Add a raw memory position to log.
name - Arbitrary name of the variable
fetch_as - String representation of the type of the data the memory
should be fetch as (i.e uint8_t, float, FP16)
stored_as - String re... | [
"def",
"add_memory",
"(",
"self",
",",
"name",
",",
"fetch_as",
",",
"stored_as",
",",
"address",
")",
":",
"self",
".",
"variables",
".",
"append",
"(",
"LogVariable",
"(",
"name",
",",
"fetch_as",
",",
"LogVariable",
".",
"MEM_TYPE",
",",
"stored_as",
... | Add a raw memory position to log.
name - Arbitrary name of the variable
fetch_as - String representation of the type of the data the memory
should be fetch as (i.e uint8_t, float, FP16)
stored_as - String representation of the type the data is stored as
in... | [
"Add",
"a",
"raw",
"memory",
"position",
"to",
"log",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L188-L199 |
233,576 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | LogConfig.create | def create(self):
"""Save the log configuration in the Crazyflie"""
pk = CRTPPacket()
pk.set_header(5, CHAN_SETTINGS)
if self.useV2:
pk.data = (CMD_CREATE_BLOCK_V2, self.id)
else:
pk.data = (CMD_CREATE_BLOCK, self.id)
for var in self.variables:
... | python | def create(self):
"""Save the log configuration in the Crazyflie"""
pk = CRTPPacket()
pk.set_header(5, CHAN_SETTINGS)
if self.useV2:
pk.data = (CMD_CREATE_BLOCK_V2, self.id)
else:
pk.data = (CMD_CREATE_BLOCK, self.id)
for var in self.variables:
... | [
"def",
"create",
"(",
"self",
")",
":",
"pk",
"=",
"CRTPPacket",
"(",
")",
"pk",
".",
"set_header",
"(",
"5",
",",
"CHAN_SETTINGS",
")",
"if",
"self",
".",
"useV2",
":",
"pk",
".",
"data",
"=",
"(",
"CMD_CREATE_BLOCK_V2",
",",
"self",
".",
"id",
")... | Save the log configuration in the Crazyflie | [
"Save",
"the",
"log",
"configuration",
"in",
"the",
"Crazyflie"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L220-L252 |
233,577 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | LogConfig.start | def start(self):
"""Start the logging for this entry"""
if (self.cf.link is not None):
if (self._added is False):
self.create()
logger.debug('First time block is started, add block')
else:
logger.debug('Block already registered, sta... | python | def start(self):
"""Start the logging for this entry"""
if (self.cf.link is not None):
if (self._added is False):
self.create()
logger.debug('First time block is started, add block')
else:
logger.debug('Block already registered, sta... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"cf",
".",
"link",
"is",
"not",
"None",
")",
":",
"if",
"(",
"self",
".",
"_added",
"is",
"False",
")",
":",
"self",
".",
"create",
"(",
")",
"logger",
".",
"debug",
"(",
"'First ti... | Start the logging for this entry | [
"Start",
"the",
"logging",
"for",
"this",
"entry"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L254-L267 |
233,578 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | LogConfig.stop | def stop(self):
"""Stop the logging for this entry"""
if (self.cf.link is not None):
if (self.id is None):
logger.warning('Stopping block, but no block registered')
else:
logger.debug('Sending stop logging for block id=%d', self.id)
... | python | def stop(self):
"""Stop the logging for this entry"""
if (self.cf.link is not None):
if (self.id is None):
logger.warning('Stopping block, but no block registered')
else:
logger.debug('Sending stop logging for block id=%d', self.id)
... | [
"def",
"stop",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"cf",
".",
"link",
"is",
"not",
"None",
")",
":",
"if",
"(",
"self",
".",
"id",
"is",
"None",
")",
":",
"logger",
".",
"warning",
"(",
"'Stopping block, but no block registered'",
")",
"el... | Stop the logging for this entry | [
"Stop",
"the",
"logging",
"for",
"this",
"entry"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L269-L280 |
233,579 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | LogConfig.delete | def delete(self):
"""Delete this entry in the Crazyflie"""
if (self.cf.link is not None):
if (self.id is None):
logger.warning('Delete block, but no block registered')
else:
logger.debug('LogEntry: Sending delete logging for block id=%d'
... | python | def delete(self):
"""Delete this entry in the Crazyflie"""
if (self.cf.link is not None):
if (self.id is None):
logger.warning('Delete block, but no block registered')
else:
logger.debug('LogEntry: Sending delete logging for block id=%d'
... | [
"def",
"delete",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"cf",
".",
"link",
"is",
"not",
"None",
")",
":",
"if",
"(",
"self",
".",
"id",
"is",
"None",
")",
":",
"logger",
".",
"warning",
"(",
"'Delete block, but no block registered'",
")",
"el... | Delete this entry in the Crazyflie | [
"Delete",
"this",
"entry",
"in",
"the",
"Crazyflie"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L282-L294 |
233,580 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | LogConfig.unpack_log_data | def unpack_log_data(self, log_data, timestamp):
"""Unpack received logging data so it represent real values according
to the configuration in the entry"""
ret_data = {}
data_index = 0
for var in self.variables:
size = LogTocElement.get_size_from_id(var.fetch_as)
... | python | def unpack_log_data(self, log_data, timestamp):
"""Unpack received logging data so it represent real values according
to the configuration in the entry"""
ret_data = {}
data_index = 0
for var in self.variables:
size = LogTocElement.get_size_from_id(var.fetch_as)
... | [
"def",
"unpack_log_data",
"(",
"self",
",",
"log_data",
",",
"timestamp",
")",
":",
"ret_data",
"=",
"{",
"}",
"data_index",
"=",
"0",
"for",
"var",
"in",
"self",
".",
"variables",
":",
"size",
"=",
"LogTocElement",
".",
"get_size_from_id",
"(",
"var",
"... | Unpack received logging data so it represent real values according
to the configuration in the entry | [
"Unpack",
"received",
"logging",
"data",
"so",
"it",
"represent",
"real",
"values",
"according",
"to",
"the",
"configuration",
"in",
"the",
"entry"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L296-L310 |
233,581 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | LogTocElement.get_id_from_cstring | def get_id_from_cstring(name):
"""Return variable type id given the C-storage name"""
for key in list(LogTocElement.types.keys()):
if (LogTocElement.types[key][0] == name):
return key
raise KeyError('Type [%s] not found in LogTocElement.types!' % name) | python | def get_id_from_cstring(name):
"""Return variable type id given the C-storage name"""
for key in list(LogTocElement.types.keys()):
if (LogTocElement.types[key][0] == name):
return key
raise KeyError('Type [%s] not found in LogTocElement.types!' % name) | [
"def",
"get_id_from_cstring",
"(",
"name",
")",
":",
"for",
"key",
"in",
"list",
"(",
"LogTocElement",
".",
"types",
".",
"keys",
"(",
")",
")",
":",
"if",
"(",
"LogTocElement",
".",
"types",
"[",
"key",
"]",
"[",
"0",
"]",
"==",
"name",
")",
":",
... | Return variable type id given the C-storage name | [
"Return",
"variable",
"type",
"id",
"given",
"the",
"C",
"-",
"storage",
"name"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L325-L330 |
233,582 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | Log.add_config | def add_config(self, logconf):
"""Add a log configuration to the logging framework.
When doing this the contents of the log configuration will be validated
and listeners for new log configurations will be notified. When
validating the configuration the variables are checked against the ... | python | def add_config(self, logconf):
"""Add a log configuration to the logging framework.
When doing this the contents of the log configuration will be validated
and listeners for new log configurations will be notified. When
validating the configuration the variables are checked against the ... | [
"def",
"add_config",
"(",
"self",
",",
"logconf",
")",
":",
"if",
"not",
"self",
".",
"cf",
".",
"link",
":",
"logger",
".",
"error",
"(",
"'Cannot add configs without being connected to a '",
"'Crazyflie!'",
")",
"return",
"# If the log configuration contains variabl... | Add a log configuration to the logging framework.
When doing this the contents of the log configuration will be validated
and listeners for new log configurations will be notified. When
validating the configuration the variables are checked against the TOC
to see that they actually exis... | [
"Add",
"a",
"log",
"configuration",
"to",
"the",
"logging",
"framework",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L410-L468 |
233,583 | bitcraze/crazyflie-lib-python | cflib/crazyflie/log.py | Log.refresh_toc | def refresh_toc(self, refresh_done_callback, toc_cache):
"""Start refreshing the table of loggale variables"""
self._useV2 = self.cf.platform.get_protocol_version() >= 4
self._toc_cache = toc_cache
self._refresh_callback = refresh_done_callback
self.toc = None
pk = CRT... | python | def refresh_toc(self, refresh_done_callback, toc_cache):
"""Start refreshing the table of loggale variables"""
self._useV2 = self.cf.platform.get_protocol_version() >= 4
self._toc_cache = toc_cache
self._refresh_callback = refresh_done_callback
self.toc = None
pk = CRT... | [
"def",
"refresh_toc",
"(",
"self",
",",
"refresh_done_callback",
",",
"toc_cache",
")",
":",
"self",
".",
"_useV2",
"=",
"self",
".",
"cf",
".",
"platform",
".",
"get_protocol_version",
"(",
")",
">=",
"4",
"self",
".",
"_toc_cache",
"=",
"toc_cache",
"sel... | Start refreshing the table of loggale variables | [
"Start",
"refreshing",
"the",
"table",
"of",
"loggale",
"variables"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L470-L482 |
233,584 | bitcraze/crazyflie-lib-python | cflib/crtp/__init__.py | init_drivers | def init_drivers(enable_debug_driver=False):
"""Initialize all the drivers."""
for driver in DRIVERS:
try:
if driver != DebugDriver or enable_debug_driver:
CLASSES.append(driver)
except Exception: # pylint: disable=W0703
continue | python | def init_drivers(enable_debug_driver=False):
"""Initialize all the drivers."""
for driver in DRIVERS:
try:
if driver != DebugDriver or enable_debug_driver:
CLASSES.append(driver)
except Exception: # pylint: disable=W0703
continue | [
"def",
"init_drivers",
"(",
"enable_debug_driver",
"=",
"False",
")",
":",
"for",
"driver",
"in",
"DRIVERS",
":",
"try",
":",
"if",
"driver",
"!=",
"DebugDriver",
"or",
"enable_debug_driver",
":",
"CLASSES",
".",
"append",
"(",
"driver",
")",
"except",
"Exce... | Initialize all the drivers. | [
"Initialize",
"all",
"the",
"drivers",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crtp/__init__.py#L47-L54 |
233,585 | bitcraze/crazyflie-lib-python | cflib/crtp/__init__.py | scan_interfaces | def scan_interfaces(address=None):
""" Scan all the interfaces for available Crazyflies """
available = []
found = []
for driverClass in CLASSES:
try:
logger.debug('Scanning: %s', driverClass)
instance = driverClass()
found = instance.scan_interface(address)
... | python | def scan_interfaces(address=None):
""" Scan all the interfaces for available Crazyflies """
available = []
found = []
for driverClass in CLASSES:
try:
logger.debug('Scanning: %s', driverClass)
instance = driverClass()
found = instance.scan_interface(address)
... | [
"def",
"scan_interfaces",
"(",
"address",
"=",
"None",
")",
":",
"available",
"=",
"[",
"]",
"found",
"=",
"[",
"]",
"for",
"driverClass",
"in",
"CLASSES",
":",
"try",
":",
"logger",
".",
"debug",
"(",
"'Scanning: %s'",
",",
"driverClass",
")",
"instance... | Scan all the interfaces for available Crazyflies | [
"Scan",
"all",
"the",
"interfaces",
"for",
"available",
"Crazyflies"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crtp/__init__.py#L57-L69 |
233,586 | bitcraze/crazyflie-lib-python | cflib/crtp/__init__.py | get_interfaces_status | def get_interfaces_status():
"""Get the status of all the interfaces"""
status = {}
for driverClass in CLASSES:
try:
instance = driverClass()
status[instance.get_name()] = instance.get_status()
except Exception:
raise
return status | python | def get_interfaces_status():
"""Get the status of all the interfaces"""
status = {}
for driverClass in CLASSES:
try:
instance = driverClass()
status[instance.get_name()] = instance.get_status()
except Exception:
raise
return status | [
"def",
"get_interfaces_status",
"(",
")",
":",
"status",
"=",
"{",
"}",
"for",
"driverClass",
"in",
"CLASSES",
":",
"try",
":",
"instance",
"=",
"driverClass",
"(",
")",
"status",
"[",
"instance",
".",
"get_name",
"(",
")",
"]",
"=",
"instance",
".",
"... | Get the status of all the interfaces | [
"Get",
"the",
"status",
"of",
"all",
"the",
"interfaces"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crtp/__init__.py#L72-L81 |
233,587 | bitcraze/crazyflie-lib-python | cflib/crtp/__init__.py | get_link_driver | def get_link_driver(uri, link_quality_callback=None, link_error_callback=None):
"""Return the link driver for the given URI. Returns None if no driver
was found for the URI or the URI was not well formatted for the matching
driver."""
for driverClass in CLASSES:
try:
instance = drive... | python | def get_link_driver(uri, link_quality_callback=None, link_error_callback=None):
"""Return the link driver for the given URI. Returns None if no driver
was found for the URI or the URI was not well formatted for the matching
driver."""
for driverClass in CLASSES:
try:
instance = drive... | [
"def",
"get_link_driver",
"(",
"uri",
",",
"link_quality_callback",
"=",
"None",
",",
"link_error_callback",
"=",
"None",
")",
":",
"for",
"driverClass",
"in",
"CLASSES",
":",
"try",
":",
"instance",
"=",
"driverClass",
"(",
")",
"instance",
".",
"connect",
... | Return the link driver for the given URI. Returns None if no driver
was found for the URI or the URI was not well formatted for the matching
driver. | [
"Return",
"the",
"link",
"driver",
"for",
"the",
"given",
"URI",
".",
"Returns",
"None",
"if",
"no",
"driver",
"was",
"found",
"for",
"the",
"URI",
"or",
"the",
"URI",
"was",
"not",
"well",
"formatted",
"for",
"the",
"matching",
"driver",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crtp/__init__.py#L84-L96 |
233,588 | bitcraze/crazyflie-lib-python | cflib/crazyflie/localization.py | Localization.send_short_lpp_packet | def send_short_lpp_packet(self, dest_id, data):
"""
Send ultra-wide-band LPP packet to dest_id
"""
pk = CRTPPacket()
pk.port = CRTPPort.LOCALIZATION
pk.channel = self.GENERIC_CH
pk.data = struct.pack('<BB', self.LPS_SHORT_LPP_PACKET, dest_id) + data
self.... | python | def send_short_lpp_packet(self, dest_id, data):
"""
Send ultra-wide-band LPP packet to dest_id
"""
pk = CRTPPacket()
pk.port = CRTPPort.LOCALIZATION
pk.channel = self.GENERIC_CH
pk.data = struct.pack('<BB', self.LPS_SHORT_LPP_PACKET, dest_id) + data
self.... | [
"def",
"send_short_lpp_packet",
"(",
"self",
",",
"dest_id",
",",
"data",
")",
":",
"pk",
"=",
"CRTPPacket",
"(",
")",
"pk",
".",
"port",
"=",
"CRTPPort",
".",
"LOCALIZATION",
"pk",
".",
"channel",
"=",
"self",
".",
"GENERIC_CH",
"pk",
".",
"data",
"="... | Send ultra-wide-band LPP packet to dest_id | [
"Send",
"ultra",
"-",
"wide",
"-",
"band",
"LPP",
"packet",
"to",
"dest_id"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/localization.py#L113-L122 |
233,589 | bitcraze/crazyflie-lib-python | cflib/crazyflie/commander.py | Commander.send_velocity_world_setpoint | def send_velocity_world_setpoint(self, vx, vy, vz, yawrate):
"""
Send Velocity in the world frame of reference setpoint.
vx, vy, vz are in m/s
yawrate is in degrees/s
"""
pk = CRTPPacket()
pk.port = CRTPPort.COMMANDER_GENERIC
pk.data = struct.pack('<Bffff... | python | def send_velocity_world_setpoint(self, vx, vy, vz, yawrate):
"""
Send Velocity in the world frame of reference setpoint.
vx, vy, vz are in m/s
yawrate is in degrees/s
"""
pk = CRTPPacket()
pk.port = CRTPPort.COMMANDER_GENERIC
pk.data = struct.pack('<Bffff... | [
"def",
"send_velocity_world_setpoint",
"(",
"self",
",",
"vx",
",",
"vy",
",",
"vz",
",",
"yawrate",
")",
":",
"pk",
"=",
"CRTPPacket",
"(",
")",
"pk",
".",
"port",
"=",
"CRTPPort",
".",
"COMMANDER_GENERIC",
"pk",
".",
"data",
"=",
"struct",
".",
"pack... | Send Velocity in the world frame of reference setpoint.
vx, vy, vz are in m/s
yawrate is in degrees/s | [
"Send",
"Velocity",
"in",
"the",
"world",
"frame",
"of",
"reference",
"setpoint",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/commander.py#L92-L103 |
233,590 | bitcraze/crazyflie-lib-python | cflib/crazyflie/commander.py | Commander.send_position_setpoint | def send_position_setpoint(self, x, y, z, yaw):
"""
Control mode where the position is sent as absolute x,y,z coordinate in
meter and the yaw is the absolute orientation.
x and y are in m
yaw is in degrees
"""
pk = CRTPPacket()
pk.port = CRTPPort.COMMANDE... | python | def send_position_setpoint(self, x, y, z, yaw):
"""
Control mode where the position is sent as absolute x,y,z coordinate in
meter and the yaw is the absolute orientation.
x and y are in m
yaw is in degrees
"""
pk = CRTPPacket()
pk.port = CRTPPort.COMMANDE... | [
"def",
"send_position_setpoint",
"(",
"self",
",",
"x",
",",
"y",
",",
"z",
",",
"yaw",
")",
":",
"pk",
"=",
"CRTPPacket",
"(",
")",
"pk",
".",
"port",
"=",
"CRTPPort",
".",
"COMMANDER_GENERIC",
"pk",
".",
"data",
"=",
"struct",
".",
"pack",
"(",
"... | Control mode where the position is sent as absolute x,y,z coordinate in
meter and the yaw is the absolute orientation.
x and y are in m
yaw is in degrees | [
"Control",
"mode",
"where",
"the",
"position",
"is",
"sent",
"as",
"absolute",
"x",
"y",
"z",
"coordinate",
"in",
"meter",
"and",
"the",
"yaw",
"is",
"the",
"absolute",
"orientation",
"."
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/commander.py#L132-L144 |
233,591 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | MemoryElement.type_to_string | def type_to_string(t):
"""Get string representation of memory type"""
if t == MemoryElement.TYPE_I2C:
return 'I2C'
if t == MemoryElement.TYPE_1W:
return '1-wire'
if t == MemoryElement.TYPE_DRIVER_LED:
return 'LED driver'
if t == MemoryElement.T... | python | def type_to_string(t):
"""Get string representation of memory type"""
if t == MemoryElement.TYPE_I2C:
return 'I2C'
if t == MemoryElement.TYPE_1W:
return '1-wire'
if t == MemoryElement.TYPE_DRIVER_LED:
return 'LED driver'
if t == MemoryElement.T... | [
"def",
"type_to_string",
"(",
"t",
")",
":",
"if",
"t",
"==",
"MemoryElement",
".",
"TYPE_I2C",
":",
"return",
"'I2C'",
"if",
"t",
"==",
"MemoryElement",
".",
"TYPE_1W",
":",
"return",
"'1-wire'",
"if",
"t",
"==",
"MemoryElement",
".",
"TYPE_DRIVER_LED",
"... | Get string representation of memory type | [
"Get",
"string",
"representation",
"of",
"memory",
"type"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L86-L100 |
233,592 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | LEDDriverMemory.write_data | def write_data(self, write_finished_cb):
"""Write the saved LED-ring data to the Crazyflie"""
self._write_finished_cb = write_finished_cb
data = bytearray()
for led in self.leds:
# In order to fit all the LEDs in one radio packet RGB565 is used
# to compress the c... | python | def write_data(self, write_finished_cb):
"""Write the saved LED-ring data to the Crazyflie"""
self._write_finished_cb = write_finished_cb
data = bytearray()
for led in self.leds:
# In order to fit all the LEDs in one radio packet RGB565 is used
# to compress the c... | [
"def",
"write_data",
"(",
"self",
",",
"write_finished_cb",
")",
":",
"self",
".",
"_write_finished_cb",
"=",
"write_finished_cb",
"data",
"=",
"bytearray",
"(",
")",
"for",
"led",
"in",
"self",
".",
"leds",
":",
"# In order to fit all the LEDs in one radio packet R... | Write the saved LED-ring data to the Crazyflie | [
"Write",
"the",
"saved",
"LED",
"-",
"ring",
"data",
"to",
"the",
"Crazyflie"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L151-L169 |
233,593 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | OWElement._parse_and_check_elements | def _parse_and_check_elements(self, data):
"""
Parse and check the CRC and length of the elements part of the memory
"""
crc = data[-1]
test_crc = crc32(data[:-1]) & 0x0ff
elem_data = data[2:-1]
if test_crc == crc:
while len(elem_data) > 0:
... | python | def _parse_and_check_elements(self, data):
"""
Parse and check the CRC and length of the elements part of the memory
"""
crc = data[-1]
test_crc = crc32(data[:-1]) & 0x0ff
elem_data = data[2:-1]
if test_crc == crc:
while len(elem_data) > 0:
... | [
"def",
"_parse_and_check_elements",
"(",
"self",
",",
"data",
")",
":",
"crc",
"=",
"data",
"[",
"-",
"1",
"]",
"test_crc",
"=",
"crc32",
"(",
"data",
"[",
":",
"-",
"1",
"]",
")",
"&",
"0x0ff",
"elem_data",
"=",
"data",
"[",
"2",
":",
"-",
"1",
... | Parse and check the CRC and length of the elements part of the memory | [
"Parse",
"and",
"check",
"the",
"CRC",
"and",
"length",
"of",
"the",
"elements",
"part",
"of",
"the",
"memory"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L347-L361 |
233,594 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | OWElement._parse_and_check_header | def _parse_and_check_header(self, data):
"""Parse and check the CRC of the header part of the memory"""
(start, self.pins, self.vid, self.pid, crc) = struct.unpack('<BIBBB',
data)
test_crc = crc32(data[:-1]) & 0x0ff
if s... | python | def _parse_and_check_header(self, data):
"""Parse and check the CRC of the header part of the memory"""
(start, self.pins, self.vid, self.pid, crc) = struct.unpack('<BIBBB',
data)
test_crc = crc32(data[:-1]) & 0x0ff
if s... | [
"def",
"_parse_and_check_header",
"(",
"self",
",",
"data",
")",
":",
"(",
"start",
",",
"self",
".",
"pins",
",",
"self",
".",
"vid",
",",
"self",
".",
"pid",
",",
"crc",
")",
"=",
"struct",
".",
"unpack",
"(",
"'<BIBBB'",
",",
"data",
")",
"test_... | Parse and check the CRC of the header part of the memory | [
"Parse",
"and",
"check",
"the",
"CRC",
"of",
"the",
"header",
"part",
"of",
"the",
"memory"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L412-L419 |
233,595 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | LocoMemory2.update_id_list | def update_id_list(self, update_ids_finished_cb):
"""Request an update of the id list"""
if not self._update_ids_finished_cb:
self._update_ids_finished_cb = update_ids_finished_cb
self.anchor_ids = []
self.active_anchor_ids = []
self.anchor_data = {}
... | python | def update_id_list(self, update_ids_finished_cb):
"""Request an update of the id list"""
if not self._update_ids_finished_cb:
self._update_ids_finished_cb = update_ids_finished_cb
self.anchor_ids = []
self.active_anchor_ids = []
self.anchor_data = {}
... | [
"def",
"update_id_list",
"(",
"self",
",",
"update_ids_finished_cb",
")",
":",
"if",
"not",
"self",
".",
"_update_ids_finished_cb",
":",
"self",
".",
"_update_ids_finished_cb",
"=",
"update_ids_finished_cb",
"self",
".",
"anchor_ids",
"=",
"[",
"]",
"self",
".",
... | Request an update of the id list | [
"Request",
"an",
"update",
"of",
"the",
"id",
"list"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L572-L588 |
233,596 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | LocoMemory2.update_active_id_list | def update_active_id_list(self, update_active_ids_finished_cb):
"""Request an update of the active id list"""
if not self._update_active_ids_finished_cb:
self._update_active_ids_finished_cb = update_active_ids_finished_cb
self.active_anchor_ids = []
self.active_ids_v... | python | def update_active_id_list(self, update_active_ids_finished_cb):
"""Request an update of the active id list"""
if not self._update_active_ids_finished_cb:
self._update_active_ids_finished_cb = update_active_ids_finished_cb
self.active_anchor_ids = []
self.active_ids_v... | [
"def",
"update_active_id_list",
"(",
"self",
",",
"update_active_ids_finished_cb",
")",
":",
"if",
"not",
"self",
".",
"_update_active_ids_finished_cb",
":",
"self",
".",
"_update_active_ids_finished_cb",
"=",
"update_active_ids_finished_cb",
"self",
".",
"active_anchor_ids... | Request an update of the active id list | [
"Request",
"an",
"update",
"of",
"the",
"active",
"id",
"list"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L590-L602 |
233,597 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | LocoMemory2.update_data | def update_data(self, update_data_finished_cb):
"""Request an update of the anchor data"""
if not self._update_data_finished_cb and self.nr_of_anchors > 0:
self._update_data_finished_cb = update_data_finished_cb
self.anchor_data = {}
self.data_valid = False
... | python | def update_data(self, update_data_finished_cb):
"""Request an update of the anchor data"""
if not self._update_data_finished_cb and self.nr_of_anchors > 0:
self._update_data_finished_cb = update_data_finished_cb
self.anchor_data = {}
self.data_valid = False
... | [
"def",
"update_data",
"(",
"self",
",",
"update_data_finished_cb",
")",
":",
"if",
"not",
"self",
".",
"_update_data_finished_cb",
"and",
"self",
".",
"nr_of_anchors",
">",
"0",
":",
"self",
".",
"_update_data_finished_cb",
"=",
"update_data_finished_cb",
"self",
... | Request an update of the anchor data | [
"Request",
"an",
"update",
"of",
"the",
"anchor",
"data"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L604-L617 |
233,598 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | TrajectoryMemory.write_data | def write_data(self, write_finished_cb):
"""Write trajectory data to the Crazyflie"""
self._write_finished_cb = write_finished_cb
data = bytearray()
for poly4D in self.poly4Ds:
data += struct.pack('<ffffffff', *poly4D.x.values)
data += struct.pack('<ffffffff', *p... | python | def write_data(self, write_finished_cb):
"""Write trajectory data to the Crazyflie"""
self._write_finished_cb = write_finished_cb
data = bytearray()
for poly4D in self.poly4Ds:
data += struct.pack('<ffffffff', *poly4D.x.values)
data += struct.pack('<ffffffff', *p... | [
"def",
"write_data",
"(",
"self",
",",
"write_finished_cb",
")",
":",
"self",
".",
"_write_finished_cb",
"=",
"write_finished_cb",
"data",
"=",
"bytearray",
"(",
")",
"for",
"poly4D",
"in",
"self",
".",
"poly4Ds",
":",
"data",
"+=",
"struct",
".",
"pack",
... | Write trajectory data to the Crazyflie | [
"Write",
"trajectory",
"data",
"to",
"the",
"Crazyflie"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L690-L702 |
233,599 | bitcraze/crazyflie-lib-python | cflib/crazyflie/mem.py | Memory.get_mem | def get_mem(self, id):
"""Fetch the memory with the supplied id"""
for m in self.mems:
if m.id == id:
return m
return None | python | def get_mem(self, id):
"""Fetch the memory with the supplied id"""
for m in self.mems:
if m.id == id:
return m
return None | [
"def",
"get_mem",
"(",
"self",
",",
"id",
")",
":",
"for",
"m",
"in",
"self",
".",
"mems",
":",
"if",
"m",
".",
"id",
"==",
"id",
":",
"return",
"m",
"return",
"None"
] | Fetch the memory with the supplied id | [
"Fetch",
"the",
"memory",
"with",
"the",
"supplied",
"id"
] | f6ebb4eb315bbe6e02db518936ac17fb615b2af8 | https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L911-L917 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.