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 51
19.8k
| code_tokens
sequence | docstring
stringlengths 3
17.3k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 87
242
|
---|---|---|---|---|---|---|---|---|---|---|---|
248,900 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.system_time_send | def system_time_send(self, time_unix_usec, time_boot_ms, force_mavlink1=False):
'''
The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
time_unix_usec : Timestamp of the master clock in microseconds since UNIX epoch. (uint64_t)
time_boot_ms : Timestamp of the component clock since boot time in milliseconds. (uint32_t)
'''
return self.send(self.system_time_encode(time_unix_usec, time_boot_ms), force_mavlink1=force_mavlink1) | python | def system_time_send(self, time_unix_usec, time_boot_ms, force_mavlink1=False):
'''
The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
time_unix_usec : Timestamp of the master clock in microseconds since UNIX epoch. (uint64_t)
time_boot_ms : Timestamp of the component clock since boot time in milliseconds. (uint32_t)
'''
return self.send(self.system_time_encode(time_unix_usec, time_boot_ms), force_mavlink1=force_mavlink1) | [
"def",
"system_time_send",
"(",
"self",
",",
"time_unix_usec",
",",
"time_boot_ms",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"system_time_encode",
"(",
"time_unix_usec",
",",
"time_boot_ms",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
time_unix_usec : Timestamp of the master clock in microseconds since UNIX epoch. (uint64_t)
time_boot_ms : Timestamp of the component clock since boot time in milliseconds. (uint32_t) | [
"The",
"system",
"time",
"is",
"the",
"time",
"of",
"the",
"master",
"clock",
"typically",
"the",
"computer",
"clock",
"of",
"the",
"main",
"onboard",
"computer",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8636-L8645 |
248,901 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.set_mode_send | def set_mode_send(self, target_system, base_mode, custom_mode, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as
defined by enum MAV_MODE. There is no target component
id as the mode is by definition for the overall
aircraft, not only for one component.
target_system : The system setting the mode (uint8_t)
base_mode : The new base mode (uint8_t)
custom_mode : The new autopilot-specific mode. This field can be ignored by an autopilot. (uint32_t)
'''
return self.send(self.set_mode_encode(target_system, base_mode, custom_mode), force_mavlink1=force_mavlink1) | python | def set_mode_send(self, target_system, base_mode, custom_mode, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as
defined by enum MAV_MODE. There is no target component
id as the mode is by definition for the overall
aircraft, not only for one component.
target_system : The system setting the mode (uint8_t)
base_mode : The new base mode (uint8_t)
custom_mode : The new autopilot-specific mode. This field can be ignored by an autopilot. (uint32_t)
'''
return self.send(self.set_mode_encode(target_system, base_mode, custom_mode), force_mavlink1=force_mavlink1) | [
"def",
"set_mode_send",
"(",
"self",
",",
"target_system",
",",
"base_mode",
",",
"custom_mode",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"set_mode_encode",
"(",
"target_system",
",",
"base_mode",
",",
"custom_mode",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as
defined by enum MAV_MODE. There is no target component
id as the mode is by definition for the overall
aircraft, not only for one component.
target_system : The system setting the mode (uint8_t)
base_mode : The new base mode (uint8_t)
custom_mode : The new autopilot-specific mode. This field can be ignored by an autopilot. (uint32_t) | [
"THIS",
"INTERFACE",
"IS",
"DEPRECATED",
".",
"USE",
"COMMAND_LONG",
"with",
"MAV_CMD_DO_SET_MODE",
"INSTEAD",
".",
"Set",
"the",
"system",
"mode",
"as",
"defined",
"by",
"enum",
"MAV_MODE",
".",
"There",
"is",
"no",
"target",
"component",
"id",
"as",
"the",
"mode",
"is",
"by",
"definition",
"for",
"the",
"overall",
"aircraft",
"not",
"only",
"for",
"one",
"component",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8760-L8773 |
248,902 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.param_request_list_send | def param_request_list_send(self, target_system, target_component, force_mavlink1=False):
'''
Request all parameters of this component. After this request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.param_request_list_encode(target_system, target_component), force_mavlink1=force_mavlink1) | python | def param_request_list_send(self, target_system, target_component, force_mavlink1=False):
'''
Request all parameters of this component. After this request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.param_request_list_encode(target_system, target_component), force_mavlink1=force_mavlink1) | [
"def",
"param_request_list_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"param_request_list_encode",
"(",
"target_system",
",",
"target_component",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Request all parameters of this component. After this request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Request",
"all",
"parameters",
"of",
"this",
"component",
".",
"After",
"this",
"request",
"all",
"parameters",
"are",
"emitted",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L8826-L8835 |
248,903 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.mission_current_send | def mission_current_send(self, seq, force_mavlink1=False):
'''
Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t)
'''
return self.send(self.mission_current_encode(seq), force_mavlink1=force_mavlink1) | python | def mission_current_send(self, seq, force_mavlink1=False):
'''
Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t)
'''
return self.send(self.mission_current_encode(seq), force_mavlink1=force_mavlink1) | [
"def",
"mission_current_send",
"(",
"self",
",",
"seq",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"mission_current_encode",
"(",
"seq",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t) | [
"Message",
"that",
"announces",
"the",
"sequence",
"number",
"of",
"the",
"current",
"active",
"mission",
"item",
".",
"The",
"MAV",
"will",
"fly",
"towards",
"this",
"mission",
"item",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9590-L9599 |
248,904 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.mission_count_send | def mission_count_send(self, target_system, target_component, count, force_mavlink1=False):
'''
This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then
request the individual mission item based on the
knowledge of the total number of MISSIONs.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
count : Number of mission items in the sequence (uint16_t)
'''
return self.send(self.mission_count_encode(target_system, target_component, count), force_mavlink1=force_mavlink1) | python | def mission_count_send(self, target_system, target_component, count, force_mavlink1=False):
'''
This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then
request the individual mission item based on the
knowledge of the total number of MISSIONs.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
count : Number of mission items in the sequence (uint16_t)
'''
return self.send(self.mission_count_encode(target_system, target_component, count), force_mavlink1=force_mavlink1) | [
"def",
"mission_count_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"count",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"mission_count_encode",
"(",
"target_system",
",",
"target_component",
",",
"count",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then
request the individual mission item based on the
knowledge of the total number of MISSIONs.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
count : Number of mission items in the sequence (uint16_t) | [
"This",
"message",
"is",
"emitted",
"as",
"response",
"to",
"MISSION_REQUEST_LIST",
"by",
"the",
"MAV",
"and",
"to",
"initiate",
"a",
"write",
"transaction",
".",
"The",
"GCS",
"can",
"then",
"request",
"the",
"individual",
"mission",
"item",
"based",
"on",
"the",
"knowledge",
"of",
"the",
"total",
"number",
"of",
"MISSIONs",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9635-L9647 |
248,905 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.mission_clear_all_send | def mission_clear_all_send(self, target_system, target_component, force_mavlink1=False):
'''
Delete all mission items at once.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.mission_clear_all_encode(target_system, target_component), force_mavlink1=force_mavlink1) | python | def mission_clear_all_send(self, target_system, target_component, force_mavlink1=False):
'''
Delete all mission items at once.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.mission_clear_all_encode(target_system, target_component), force_mavlink1=force_mavlink1) | [
"def",
"mission_clear_all_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"mission_clear_all_encode",
"(",
"target_system",
",",
"target_component",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Delete all mission items at once.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Delete",
"all",
"mission",
"items",
"at",
"once",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9659-L9667 |
248,906 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.data_stream_send | def data_stream_send(self, stream_id, message_rate, on_off, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The message rate (uint16_t)
on_off : 1 stream is enabled, 0 stream is stopped. (uint8_t)
'''
return self.send(self.data_stream_encode(stream_id, message_rate, on_off), force_mavlink1=force_mavlink1) | python | def data_stream_send(self, stream_id, message_rate, on_off, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The message rate (uint16_t)
on_off : 1 stream is enabled, 0 stream is stopped. (uint8_t)
'''
return self.send(self.data_stream_encode(stream_id, message_rate, on_off), force_mavlink1=force_mavlink1) | [
"def",
"data_stream_send",
"(",
"self",
",",
"stream_id",
",",
"message_rate",
",",
"on_off",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"data_stream_encode",
"(",
"stream_id",
",",
"message_rate",
",",
"on_off",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The message rate (uint16_t)
on_off : 1 stream is enabled, 0 stream is stopped. (uint8_t) | [
"THIS",
"INTERFACE",
"IS",
"DEPRECATED",
".",
"USE",
"MESSAGE_INTERVAL",
"INSTEAD",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L10178-L10187 |
248,907 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.command_ack_send | def command_ack_send(self, command, result, force_mavlink1=False):
'''
Report status of a command. Includes feedback wether the command was
executed.
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
result : See MAV_RESULT enum (uint8_t)
'''
return self.send(self.command_ack_encode(command, result), force_mavlink1=force_mavlink1) | python | def command_ack_send(self, command, result, force_mavlink1=False):
'''
Report status of a command. Includes feedback wether the command was
executed.
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
result : See MAV_RESULT enum (uint8_t)
'''
return self.send(self.command_ack_encode(command, result), force_mavlink1=force_mavlink1) | [
"def",
"command_ack_send",
"(",
"self",
",",
"command",
",",
"result",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"command_ack_encode",
"(",
"command",
",",
"result",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Report status of a command. Includes feedback wether the command was
executed.
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
result : See MAV_RESULT enum (uint8_t) | [
"Report",
"status",
"of",
"a",
"command",
".",
"Includes",
"feedback",
"wether",
"the",
"command",
"was",
"executed",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L10452-L10461 |
248,908 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.timesync_send | def timesync_send(self, tc1, ts1, force_mavlink1=False):
'''
Time synchronization message.
tc1 : Time sync timestamp 1 (int64_t)
ts1 : Time sync timestamp 2 (int64_t)
'''
return self.send(self.timesync_encode(tc1, ts1), force_mavlink1=force_mavlink1) | python | def timesync_send(self, tc1, ts1, force_mavlink1=False):
'''
Time synchronization message.
tc1 : Time sync timestamp 1 (int64_t)
ts1 : Time sync timestamp 2 (int64_t)
'''
return self.send(self.timesync_encode(tc1, ts1), force_mavlink1=force_mavlink1) | [
"def",
"timesync_send",
"(",
"self",
",",
"tc1",
",",
"ts1",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"timesync_encode",
"(",
"tc1",
",",
"ts1",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Time synchronization message.
tc1 : Time sync timestamp 1 (int64_t)
ts1 : Time sync timestamp 2 (int64_t) | [
"Time",
"synchronization",
"message",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11391-L11399 |
248,909 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.camera_trigger_send | def camera_trigger_send(self, time_usec, seq, force_mavlink1=False):
'''
Camera-IMU triggering and synchronisation message.
time_usec : Timestamp for the image frame in microseconds (uint64_t)
seq : Image frame sequence (uint32_t)
'''
return self.send(self.camera_trigger_encode(time_usec, seq), force_mavlink1=force_mavlink1) | python | def camera_trigger_send(self, time_usec, seq, force_mavlink1=False):
'''
Camera-IMU triggering and synchronisation message.
time_usec : Timestamp for the image frame in microseconds (uint64_t)
seq : Image frame sequence (uint32_t)
'''
return self.send(self.camera_trigger_encode(time_usec, seq), force_mavlink1=force_mavlink1) | [
"def",
"camera_trigger_send",
"(",
"self",
",",
"time_usec",
",",
"seq",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"camera_trigger_encode",
"(",
"time_usec",
",",
"seq",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Camera-IMU triggering and synchronisation message.
time_usec : Timestamp for the image frame in microseconds (uint64_t)
seq : Image frame sequence (uint32_t) | [
"Camera",
"-",
"IMU",
"triggering",
"and",
"synchronisation",
"message",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11411-L11419 |
248,910 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.log_erase_send | def log_erase_send(self, target_system, target_component, force_mavlink1=False):
'''
Erase all logs
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.log_erase_encode(target_system, target_component), force_mavlink1=force_mavlink1) | python | def log_erase_send(self, target_system, target_component, force_mavlink1=False):
'''
Erase all logs
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.log_erase_encode(target_system, target_component), force_mavlink1=force_mavlink1) | [
"def",
"log_erase_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"log_erase_encode",
"(",
"target_system",
",",
"target_component",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Erase all logs
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Erase",
"all",
"logs"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11721-L11729 |
248,911 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.log_request_end_send | def log_request_end_send(self, target_system, target_component, force_mavlink1=False):
'''
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.log_request_end_encode(target_system, target_component), force_mavlink1=force_mavlink1) | python | def log_request_end_send(self, target_system, target_component, force_mavlink1=False):
'''
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.log_request_end_encode(target_system, target_component), force_mavlink1=force_mavlink1) | [
"def",
"log_request_end_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"log_request_end_encode",
"(",
"target_system",
",",
"target_component",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t) | [
"Stop",
"log",
"transfer",
"and",
"resume",
"normal",
"logging"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11741-L11749 |
248,912 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.power_status_send | def power_status_send(self, Vcc, Vservo, flags, force_mavlink1=False):
'''
Power supply status
Vcc : 5V rail voltage in millivolts (uint16_t)
Vservo : servo rail voltage in millivolts (uint16_t)
flags : power supply status flags (see MAV_POWER_STATUS enum) (uint16_t)
'''
return self.send(self.power_status_encode(Vcc, Vservo, flags), force_mavlink1=force_mavlink1) | python | def power_status_send(self, Vcc, Vservo, flags, force_mavlink1=False):
'''
Power supply status
Vcc : 5V rail voltage in millivolts (uint16_t)
Vservo : servo rail voltage in millivolts (uint16_t)
flags : power supply status flags (see MAV_POWER_STATUS enum) (uint16_t)
'''
return self.send(self.power_status_encode(Vcc, Vservo, flags), force_mavlink1=force_mavlink1) | [
"def",
"power_status_send",
"(",
"self",
",",
"Vcc",
",",
"Vservo",
",",
"flags",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"power_status_encode",
"(",
"Vcc",
",",
"Vservo",
",",
"flags",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Power supply status
Vcc : 5V rail voltage in millivolts (uint16_t)
Vservo : servo rail voltage in millivolts (uint16_t)
flags : power supply status flags (see MAV_POWER_STATUS enum) (uint16_t) | [
"Power",
"supply",
"status"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11828-L11837 |
248,913 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.terrain_check_send | def terrain_check_send(self, lat, lon, force_mavlink1=False):
'''
Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data
needed for a mission.
lat : Latitude (degrees *10^7) (int32_t)
lon : Longitude (degrees *10^7) (int32_t)
'''
return self.send(self.terrain_check_encode(lat, lon), force_mavlink1=force_mavlink1) | python | def terrain_check_send(self, lat, lon, force_mavlink1=False):
'''
Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data
needed for a mission.
lat : Latitude (degrees *10^7) (int32_t)
lon : Longitude (degrees *10^7) (int32_t)
'''
return self.send(self.terrain_check_encode(lat, lon), force_mavlink1=force_mavlink1) | [
"def",
"terrain_check_send",
"(",
"self",
",",
"lat",
",",
"lon",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"terrain_check_encode",
"(",
"lat",
",",
"lon",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data
needed for a mission.
lat : Latitude (degrees *10^7) (int32_t)
lon : Longitude (degrees *10^7) (int32_t) | [
"Request",
"that",
"the",
"vehicle",
"report",
"terrain",
"height",
"at",
"the",
"given",
"location",
".",
"Used",
"by",
"GCS",
"to",
"check",
"if",
"vehicle",
"has",
"all",
"terrain",
"data",
"needed",
"for",
"a",
"mission",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12149-L12159 |
248,914 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.gps_input_encode | def gps_input_encode(self, time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible):
'''
GPS sensor input message. This is a raw sensor value sent by the GPS.
This is NOT the global position estimate of the sytem.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
gps_id : ID of the GPS for multiple GPS inputs (uint8_t)
ignore_flags : Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided. (uint16_t)
time_week_ms : GPS time (milliseconds from start of GPS week) (uint32_t)
time_week : GPS week number (uint16_t)
fix_type : 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in m (positive for up) (float)
hdop : GPS HDOP horizontal dilution of position in m (float)
vdop : GPS VDOP vertical dilution of position in m (float)
vn : GPS velocity in m/s in NORTH direction in earth-fixed NED frame (float)
ve : GPS velocity in m/s in EAST direction in earth-fixed NED frame (float)
vd : GPS velocity in m/s in DOWN direction in earth-fixed NED frame (float)
speed_accuracy : GPS speed accuracy in m/s (float)
horiz_accuracy : GPS horizontal accuracy in m (float)
vert_accuracy : GPS vertical accuracy in m (float)
satellites_visible : Number of satellites visible. (uint8_t)
'''
return MAVLink_gps_input_message(time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible) | python | def gps_input_encode(self, time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible):
'''
GPS sensor input message. This is a raw sensor value sent by the GPS.
This is NOT the global position estimate of the sytem.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
gps_id : ID of the GPS for multiple GPS inputs (uint8_t)
ignore_flags : Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided. (uint16_t)
time_week_ms : GPS time (milliseconds from start of GPS week) (uint32_t)
time_week : GPS week number (uint16_t)
fix_type : 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in m (positive for up) (float)
hdop : GPS HDOP horizontal dilution of position in m (float)
vdop : GPS VDOP vertical dilution of position in m (float)
vn : GPS velocity in m/s in NORTH direction in earth-fixed NED frame (float)
ve : GPS velocity in m/s in EAST direction in earth-fixed NED frame (float)
vd : GPS velocity in m/s in DOWN direction in earth-fixed NED frame (float)
speed_accuracy : GPS speed accuracy in m/s (float)
horiz_accuracy : GPS horizontal accuracy in m (float)
vert_accuracy : GPS vertical accuracy in m (float)
satellites_visible : Number of satellites visible. (uint8_t)
'''
return MAVLink_gps_input_message(time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible) | [
"def",
"gps_input_encode",
"(",
"self",
",",
"time_usec",
",",
"gps_id",
",",
"ignore_flags",
",",
"time_week_ms",
",",
"time_week",
",",
"fix_type",
",",
"lat",
",",
"lon",
",",
"alt",
",",
"hdop",
",",
"vdop",
",",
"vn",
",",
"ve",
",",
"vd",
",",
"speed_accuracy",
",",
"horiz_accuracy",
",",
"vert_accuracy",
",",
"satellites_visible",
")",
":",
"return",
"MAVLink_gps_input_message",
"(",
"time_usec",
",",
"gps_id",
",",
"ignore_flags",
",",
"time_week_ms",
",",
"time_week",
",",
"fix_type",
",",
"lat",
",",
"lon",
",",
"alt",
",",
"hdop",
",",
"vdop",
",",
"vn",
",",
"ve",
",",
"vd",
",",
"speed_accuracy",
",",
"horiz_accuracy",
",",
"vert_accuracy",
",",
"satellites_visible",
")"
] | GPS sensor input message. This is a raw sensor value sent by the GPS.
This is NOT the global position estimate of the sytem.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
gps_id : ID of the GPS for multiple GPS inputs (uint8_t)
ignore_flags : Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided. (uint16_t)
time_week_ms : GPS time (milliseconds from start of GPS week) (uint32_t)
time_week : GPS week number (uint16_t)
fix_type : 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in m (positive for up) (float)
hdop : GPS HDOP horizontal dilution of position in m (float)
vdop : GPS VDOP vertical dilution of position in m (float)
vn : GPS velocity in m/s in NORTH direction in earth-fixed NED frame (float)
ve : GPS velocity in m/s in EAST direction in earth-fixed NED frame (float)
vd : GPS velocity in m/s in DOWN direction in earth-fixed NED frame (float)
speed_accuracy : GPS speed accuracy in m/s (float)
horiz_accuracy : GPS horizontal accuracy in m (float)
vert_accuracy : GPS vertical accuracy in m (float)
satellites_visible : Number of satellites visible. (uint8_t) | [
"GPS",
"sensor",
"input",
"message",
".",
"This",
"is",
"a",
"raw",
"sensor",
"value",
"sent",
"by",
"the",
"GPS",
".",
"This",
"is",
"NOT",
"the",
"global",
"position",
"estimate",
"of",
"the",
"sytem",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12663-L12688 |
248,915 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.message_interval_send | def message_interval_send(self, message_id, interval_us, force_mavlink1=False):
'''
This interface replaces DATA_STREAM
message_id : The ID of the requested MAVLink message. v1.0 is limited to 254 messages. (uint16_t)
interval_us : The interval between two messages, in microseconds. A value of -1 indicates this stream is disabled, 0 indicates it is not available, > 0 indicates the interval at which it is sent. (int32_t)
'''
return self.send(self.message_interval_encode(message_id, interval_us), force_mavlink1=force_mavlink1) | python | def message_interval_send(self, message_id, interval_us, force_mavlink1=False):
'''
This interface replaces DATA_STREAM
message_id : The ID of the requested MAVLink message. v1.0 is limited to 254 messages. (uint16_t)
interval_us : The interval between two messages, in microseconds. A value of -1 indicates this stream is disabled, 0 indicates it is not available, > 0 indicates the interval at which it is sent. (int32_t)
'''
return self.send(self.message_interval_encode(message_id, interval_us), force_mavlink1=force_mavlink1) | [
"def",
"message_interval_send",
"(",
"self",
",",
"message_id",
",",
"interval_us",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"message_interval_encode",
"(",
"message_id",
",",
"interval_us",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | This interface replaces DATA_STREAM
message_id : The ID of the requested MAVLink message. v1.0 is limited to 254 messages. (uint16_t)
interval_us : The interval between two messages, in microseconds. A value of -1 indicates this stream is disabled, 0 indicates it is not available, > 0 indicates the interval at which it is sent. (int32_t) | [
"This",
"interface",
"replaces",
"DATA_STREAM"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12903-L12911 |
248,916 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.extended_sys_state_send | def extended_sys_state_send(self, vtol_state, landed_state, force_mavlink1=False):
'''
Provides state for additional features
vtol_state : The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. (uint8_t)
landed_state : The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. (uint8_t)
'''
return self.send(self.extended_sys_state_encode(vtol_state, landed_state), force_mavlink1=force_mavlink1) | python | def extended_sys_state_send(self, vtol_state, landed_state, force_mavlink1=False):
'''
Provides state for additional features
vtol_state : The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. (uint8_t)
landed_state : The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. (uint8_t)
'''
return self.send(self.extended_sys_state_encode(vtol_state, landed_state), force_mavlink1=force_mavlink1) | [
"def",
"extended_sys_state_send",
"(",
"self",
",",
"vtol_state",
",",
"landed_state",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"extended_sys_state_encode",
"(",
"vtol_state",
",",
"landed_state",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Provides state for additional features
vtol_state : The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. (uint8_t)
landed_state : The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. (uint8_t) | [
"Provides",
"state",
"for",
"additional",
"features"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12923-L12931 |
248,917 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.named_value_float_send | def named_value_float_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for
testing new messages and getting experimental debug
output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Floating point value (float)
'''
return self.send(self.named_value_float_encode(time_boot_ms, name, value), force_mavlink1=force_mavlink1) | python | def named_value_float_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for
testing new messages and getting experimental debug
output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Floating point value (float)
'''
return self.send(self.named_value_float_encode(time_boot_ms, name, value), force_mavlink1=force_mavlink1) | [
"def",
"named_value_float_send",
"(",
"self",
",",
"time_boot_ms",
",",
"name",
",",
"value",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"named_value_float_encode",
"(",
"time_boot_ms",
",",
"name",
",",
"value",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for
testing new messages and getting experimental debug
output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Floating point value (float) | [
"Send",
"a",
"key",
"-",
"value",
"pair",
"as",
"float",
".",
"The",
"use",
"of",
"this",
"message",
"is",
"discouraged",
"for",
"normal",
"packets",
"but",
"a",
"quite",
"efficient",
"way",
"for",
"testing",
"new",
"messages",
"and",
"getting",
"experimental",
"debug",
"output",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L13101-L13113 |
248,918 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.named_value_int_send | def named_value_int_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient
way for testing new messages and getting experimental
debug output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Signed integer value (int32_t)
'''
return self.send(self.named_value_int_encode(time_boot_ms, name, value), force_mavlink1=force_mavlink1) | python | def named_value_int_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient
way for testing new messages and getting experimental
debug output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Signed integer value (int32_t)
'''
return self.send(self.named_value_int_encode(time_boot_ms, name, value), force_mavlink1=force_mavlink1) | [
"def",
"named_value_int_send",
"(",
"self",
",",
"time_boot_ms",
",",
"name",
",",
"value",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"named_value_int_encode",
"(",
"time_boot_ms",
",",
"name",
",",
"value",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient
way for testing new messages and getting experimental
debug output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Signed integer value (int32_t) | [
"Send",
"a",
"key",
"-",
"value",
"pair",
"as",
"integer",
".",
"The",
"use",
"of",
"this",
"message",
"is",
"discouraged",
"for",
"normal",
"packets",
"but",
"a",
"quite",
"efficient",
"way",
"for",
"testing",
"new",
"messages",
"and",
"getting",
"experimental",
"debug",
"output",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L13129-L13141 |
248,919 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py | MAVLink.debug_send | def debug_send(self, time_boot_ms, ind, value, force_mavlink1=False):
'''
Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as
DEBUG N.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
ind : index of debug variable (uint8_t)
value : DEBUG value (float)
'''
return self.send(self.debug_encode(time_boot_ms, ind, value), force_mavlink1=force_mavlink1) | python | def debug_send(self, time_boot_ms, ind, value, force_mavlink1=False):
'''
Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as
DEBUG N.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
ind : index of debug variable (uint8_t)
value : DEBUG value (float)
'''
return self.send(self.debug_encode(time_boot_ms, ind, value), force_mavlink1=force_mavlink1) | [
"def",
"debug_send",
"(",
"self",
",",
"time_boot_ms",
",",
"ind",
",",
"value",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"debug_encode",
"(",
"time_boot_ms",
",",
"ind",
",",
"value",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as
DEBUG N.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
ind : index of debug variable (uint8_t)
value : DEBUG value (float) | [
"Send",
"a",
"debug",
"value",
".",
"The",
"index",
"is",
"used",
"to",
"discriminate",
"between",
"values",
".",
"These",
"values",
"show",
"up",
"in",
"the",
"plot",
"of",
"QGroundControl",
"as",
"DEBUG",
"N",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L13186-L13197 |
248,920 | JdeRobot/base | src/libs/comm_py/comm/ros/publisherMotors.py | PublisherMotors.sendVX | def sendVX(self, vx):
'''
Sends VX velocity.
@param vx: VX velocity
@type vx: float
'''
self.lock.acquire()
self.data.vx = vx
self.lock.release() | python | def sendVX(self, vx):
'''
Sends VX velocity.
@param vx: VX velocity
@type vx: float
'''
self.lock.acquire()
self.data.vx = vx
self.lock.release() | [
"def",
"sendVX",
"(",
"self",
",",
"vx",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"data",
".",
"vx",
"=",
"vx",
"self",
".",
"lock",
".",
"release",
"(",
")"
] | Sends VX velocity.
@param vx: VX velocity
@type vx: float | [
"Sends",
"VX",
"velocity",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/publisherMotors.py#L138-L149 |
248,921 | JdeRobot/base | src/libs/comm_py/comm/ros/publisherMotors.py | PublisherMotors.sendVY | def sendVY(self, vy):
'''
Sends VY velocity.
@param vy: VY velocity
@type vy: float
'''
self.lock.acquire()
self.data.vy = vy
self.lock.release() | python | def sendVY(self, vy):
'''
Sends VY velocity.
@param vy: VY velocity
@type vy: float
'''
self.lock.acquire()
self.data.vy = vy
self.lock.release() | [
"def",
"sendVY",
"(",
"self",
",",
"vy",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"data",
".",
"vy",
"=",
"vy",
"self",
".",
"lock",
".",
"release",
"(",
")"
] | Sends VY velocity.
@param vy: VY velocity
@type vy: float | [
"Sends",
"VY",
"velocity",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/publisherMotors.py#L151-L162 |
248,922 | JdeRobot/base | src/libs/comm_py/comm/ros/publisherMotors.py | PublisherMotors.sendAZ | def sendAZ(self, az):
'''
Sends AZ velocity.
@param az: AZ velocity
@type az: float
'''
self.lock.acquire()
self.data.az = az
self.lock.release() | python | def sendAZ(self, az):
'''
Sends AZ velocity.
@param az: AZ velocity
@type az: float
'''
self.lock.acquire()
self.data.az = az
self.lock.release() | [
"def",
"sendAZ",
"(",
"self",
",",
"az",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"data",
".",
"az",
"=",
"az",
"self",
".",
"lock",
".",
"release",
"(",
")"
] | Sends AZ velocity.
@param az: AZ velocity
@type az: float | [
"Sends",
"AZ",
"velocity",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/publisherMotors.py#L164-L175 |
248,923 | JdeRobot/base | src/libs/comm_py/comm/ros/listenerBumper.py | bumperEvent2BumperData | def bumperEvent2BumperData(event):
'''
Translates from ROS BumperScan to JderobotTypes BumperData.
@param event: ROS BumperScan to translate
@type event: BumperScan
@return a BumperData translated from event
# bumper
LEFT = 0
CENTER = 1
RIGHT = 2
# state
RELEASED = 0
PRESSED = 1
'''
bump = BumperData()
bump.state = event.state
bump.bumper = event.bumper
#bump.timeStamp = event.header.stamp.secs + (event.header.stamp.nsecs *1e-9)
return bump | python | def bumperEvent2BumperData(event):
'''
Translates from ROS BumperScan to JderobotTypes BumperData.
@param event: ROS BumperScan to translate
@type event: BumperScan
@return a BumperData translated from event
# bumper
LEFT = 0
CENTER = 1
RIGHT = 2
# state
RELEASED = 0
PRESSED = 1
'''
bump = BumperData()
bump.state = event.state
bump.bumper = event.bumper
#bump.timeStamp = event.header.stamp.secs + (event.header.stamp.nsecs *1e-9)
return bump | [
"def",
"bumperEvent2BumperData",
"(",
"event",
")",
":",
"bump",
"=",
"BumperData",
"(",
")",
"bump",
".",
"state",
"=",
"event",
".",
"state",
"bump",
".",
"bumper",
"=",
"event",
".",
"bumper",
"#bump.timeStamp = event.header.stamp.secs + (event.header.stamp.nsecs *1e-9)",
"return",
"bump"
] | Translates from ROS BumperScan to JderobotTypes BumperData.
@param event: ROS BumperScan to translate
@type event: BumperScan
@return a BumperData translated from event
# bumper
LEFT = 0
CENTER = 1
RIGHT = 2
# state
RELEASED = 0
PRESSED = 1 | [
"Translates",
"from",
"ROS",
"BumperScan",
"to",
"JderobotTypes",
"BumperData",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/listenerBumper.py#L11-L36 |
248,924 | JdeRobot/base | src/libs/comm_py/comm/ros/listenerBumper.py | ListenerBumper.__callback | def __callback (self, event):
'''
Callback function to receive and save Bumper Scans.
@param event: ROS BumperScan received
@type event: BumperScan
'''
bump = bumperEvent2BumperData(event)
if bump.state == 1:
self.lock.acquire()
self.time = current_milli_time()
self.data = bump
self.lock.release() | python | def __callback (self, event):
'''
Callback function to receive and save Bumper Scans.
@param event: ROS BumperScan received
@type event: BumperScan
'''
bump = bumperEvent2BumperData(event)
if bump.state == 1:
self.lock.acquire()
self.time = current_milli_time()
self.data = bump
self.lock.release() | [
"def",
"__callback",
"(",
"self",
",",
"event",
")",
":",
"bump",
"=",
"bumperEvent2BumperData",
"(",
"event",
")",
"if",
"bump",
".",
"state",
"==",
"1",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"self",
".",
"time",
"=",
"current_milli_time",
"(",
")",
"self",
".",
"data",
"=",
"bump",
"self",
".",
"lock",
".",
"release",
"(",
")"
] | Callback function to receive and save Bumper Scans.
@param event: ROS BumperScan received
@type event: BumperScan | [
"Callback",
"function",
"to",
"receive",
"and",
"save",
"Bumper",
"Scans",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/listenerBumper.py#L58-L73 |
248,925 | JdeRobot/base | src/libs/comm_py/comm/ros/listenerBumper.py | ListenerBumper.getBumperData | def getBumperData(self):
'''
Returns last BumperData.
@return last JdeRobotTypes BumperData saved
'''
self.lock.acquire()
t = current_milli_time()
if (t - self.time) > 500:
self.data.state = 0
bump = self.data
self.lock.release()
return bump | python | def getBumperData(self):
'''
Returns last BumperData.
@return last JdeRobotTypes BumperData saved
'''
self.lock.acquire()
t = current_milli_time()
if (t - self.time) > 500:
self.data.state = 0
bump = self.data
self.lock.release()
return bump | [
"def",
"getBumperData",
"(",
"self",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"t",
"=",
"current_milli_time",
"(",
")",
"if",
"(",
"t",
"-",
"self",
".",
"time",
")",
">",
"500",
":",
"self",
".",
"data",
".",
"state",
"=",
"0",
"bump",
"=",
"self",
".",
"data",
"self",
".",
"lock",
".",
"release",
"(",
")",
"return",
"bump"
] | Returns last BumperData.
@return last JdeRobotTypes BumperData saved | [
"Returns",
"last",
"BumperData",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ros/listenerBumper.py#L89-L103 |
248,926 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_battery.py | BatteryModule.cmd_bat | def cmd_bat(self, args):
'''show battery levels'''
print("Flight battery: %u%%" % self.battery_level)
if self.settings.numcells != 0:
print("%.2f V/cell for %u cells - approx %u%%" % (self.per_cell,
self.settings.numcells,
self.vcell_to_battery_percent(self.per_cell))) | python | def cmd_bat(self, args):
'''show battery levels'''
print("Flight battery: %u%%" % self.battery_level)
if self.settings.numcells != 0:
print("%.2f V/cell for %u cells - approx %u%%" % (self.per_cell,
self.settings.numcells,
self.vcell_to_battery_percent(self.per_cell))) | [
"def",
"cmd_bat",
"(",
"self",
",",
"args",
")",
":",
"print",
"(",
"\"Flight battery: %u%%\"",
"%",
"self",
".",
"battery_level",
")",
"if",
"self",
".",
"settings",
".",
"numcells",
"!=",
"0",
":",
"print",
"(",
"\"%.2f V/cell for %u cells - approx %u%%\"",
"%",
"(",
"self",
".",
"per_cell",
",",
"self",
".",
"settings",
".",
"numcells",
",",
"self",
".",
"vcell_to_battery_percent",
"(",
"self",
".",
"per_cell",
")",
")",
")"
] | show battery levels | [
"show",
"battery",
"levels"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_battery.py#L38-L44 |
248,927 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_battery.py | BatteryModule.battery_update | def battery_update(self, SYS_STATUS):
'''update battery level'''
# main flight battery
self.battery_level = SYS_STATUS.battery_remaining
self.voltage_level = SYS_STATUS.voltage_battery
self.current_battery = SYS_STATUS.current_battery
if self.settings.numcells != 0:
self.per_cell = (self.voltage_level*0.001) / self.settings.numcells | python | def battery_update(self, SYS_STATUS):
'''update battery level'''
# main flight battery
self.battery_level = SYS_STATUS.battery_remaining
self.voltage_level = SYS_STATUS.voltage_battery
self.current_battery = SYS_STATUS.current_battery
if self.settings.numcells != 0:
self.per_cell = (self.voltage_level*0.001) / self.settings.numcells | [
"def",
"battery_update",
"(",
"self",
",",
"SYS_STATUS",
")",
":",
"# main flight battery",
"self",
".",
"battery_level",
"=",
"SYS_STATUS",
".",
"battery_remaining",
"self",
".",
"voltage_level",
"=",
"SYS_STATUS",
".",
"voltage_battery",
"self",
".",
"current_battery",
"=",
"SYS_STATUS",
".",
"current_battery",
"if",
"self",
".",
"settings",
".",
"numcells",
"!=",
"0",
":",
"self",
".",
"per_cell",
"=",
"(",
"self",
".",
"voltage_level",
"*",
"0.001",
")",
"/",
"self",
".",
"settings",
".",
"numcells"
] | update battery level | [
"update",
"battery",
"level"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_battery.py#L92-L99 |
248,928 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py | CalibrationModule.cmd_accelcal | def cmd_accelcal(self, args):
'''do a full 3D accel calibration'''
mav = self.master
# ack the APM to begin 3D calibration of accelerometers
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, 0,
0, 0, 0, 0, 1, 0, 0)
self.accelcal_count = 0
self.accelcal_wait_enter = False | python | def cmd_accelcal(self, args):
'''do a full 3D accel calibration'''
mav = self.master
# ack the APM to begin 3D calibration of accelerometers
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, 0,
0, 0, 0, 0, 1, 0, 0)
self.accelcal_count = 0
self.accelcal_wait_enter = False | [
"def",
"cmd_accelcal",
"(",
"self",
",",
"args",
")",
":",
"mav",
"=",
"self",
".",
"master",
"# ack the APM to begin 3D calibration of accelerometers",
"mav",
".",
"mav",
".",
"command_long_send",
"(",
"mav",
".",
"target_system",
",",
"mav",
".",
"target_component",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_PREFLIGHT_CALIBRATION",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"0",
")",
"self",
".",
"accelcal_count",
"=",
"0",
"self",
".",
"accelcal_wait_enter",
"=",
"False"
] | do a full 3D accel calibration | [
"do",
"a",
"full",
"3D",
"accel",
"calibration"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py#L34-L42 |
248,929 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py | CalibrationModule.cmd_gyrocal | def cmd_gyrocal(self, args):
'''do a full gyro calibration'''
mav = self.master
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, 0,
1, 0, 0, 0, 0, 0, 0) | python | def cmd_gyrocal(self, args):
'''do a full gyro calibration'''
mav = self.master
mav.mav.command_long_send(mav.target_system, mav.target_component,
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, 0,
1, 0, 0, 0, 0, 0, 0) | [
"def",
"cmd_gyrocal",
"(",
"self",
",",
"args",
")",
":",
"mav",
"=",
"self",
".",
"master",
"mav",
".",
"mav",
".",
"command_long_send",
"(",
"mav",
".",
"target_system",
",",
"mav",
".",
"target_component",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_PREFLIGHT_CALIBRATION",
",",
"0",
",",
"1",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
")"
] | do a full gyro calibration | [
"do",
"a",
"full",
"gyro",
"calibration"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py#L44-L49 |
248,930 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py | CalibrationModule.cmd_magcal | def cmd_magcal(self, args):
'''control magnetometer calibration'''
if len(args) < 1:
print("Usage: magcal <start|accept|cancel>")
return
if args[0] == 'start':
self.master.mav.command_long_send(
self.settings.target_system, # target_system
0, # target_component
mavutil.mavlink.MAV_CMD_DO_START_MAG_CAL, # command
0, # confirmation
0, # p1: mag_mask
0, # p2: retry
1, # p3: autosave
0, # p4: delay
0, # param5
0, # param6
0) # param7
elif args[0] == 'accept':
self.master.mav.command_long_send(
self.settings.target_system, # target_system
0, # target_component
mavutil.mavlink.MAV_CMD_DO_ACCEPT_MAG_CAL, # command
0, # confirmation
0, # p1: mag_mask
0, # param2
1, # param3
0, # param4
0, # param5
0, # param6
0) # param7
elif args[0] == 'cancel':
self.master.mav.command_long_send(
self.settings.target_system, # target_system
0, # target_component
mavutil.mavlink.MAV_CMD_DO_CANCEL_MAG_CAL, # command
0, # confirmation
0, # p1: mag_mask
0, # param2
1, # param3
0, # param4
0, # param5
0, # param6
0) | python | def cmd_magcal(self, args):
'''control magnetometer calibration'''
if len(args) < 1:
print("Usage: magcal <start|accept|cancel>")
return
if args[0] == 'start':
self.master.mav.command_long_send(
self.settings.target_system, # target_system
0, # target_component
mavutil.mavlink.MAV_CMD_DO_START_MAG_CAL, # command
0, # confirmation
0, # p1: mag_mask
0, # p2: retry
1, # p3: autosave
0, # p4: delay
0, # param5
0, # param6
0) # param7
elif args[0] == 'accept':
self.master.mav.command_long_send(
self.settings.target_system, # target_system
0, # target_component
mavutil.mavlink.MAV_CMD_DO_ACCEPT_MAG_CAL, # command
0, # confirmation
0, # p1: mag_mask
0, # param2
1, # param3
0, # param4
0, # param5
0, # param6
0) # param7
elif args[0] == 'cancel':
self.master.mav.command_long_send(
self.settings.target_system, # target_system
0, # target_component
mavutil.mavlink.MAV_CMD_DO_CANCEL_MAG_CAL, # command
0, # confirmation
0, # p1: mag_mask
0, # param2
1, # param3
0, # param4
0, # param5
0, # param6
0) | [
"def",
"cmd_magcal",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"print",
"(",
"\"Usage: magcal <start|accept|cancel>\"",
")",
"return",
"if",
"args",
"[",
"0",
"]",
"==",
"'start'",
":",
"self",
".",
"master",
".",
"mav",
".",
"command_long_send",
"(",
"self",
".",
"settings",
".",
"target_system",
",",
"# target_system",
"0",
",",
"# target_component",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_DO_START_MAG_CAL",
",",
"# command",
"0",
",",
"# confirmation",
"0",
",",
"# p1: mag_mask",
"0",
",",
"# p2: retry",
"1",
",",
"# p3: autosave",
"0",
",",
"# p4: delay",
"0",
",",
"# param5",
"0",
",",
"# param6",
"0",
")",
"# param7",
"elif",
"args",
"[",
"0",
"]",
"==",
"'accept'",
":",
"self",
".",
"master",
".",
"mav",
".",
"command_long_send",
"(",
"self",
".",
"settings",
".",
"target_system",
",",
"# target_system",
"0",
",",
"# target_component",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_DO_ACCEPT_MAG_CAL",
",",
"# command",
"0",
",",
"# confirmation",
"0",
",",
"# p1: mag_mask",
"0",
",",
"# param2",
"1",
",",
"# param3",
"0",
",",
"# param4",
"0",
",",
"# param5",
"0",
",",
"# param6",
"0",
")",
"# param7",
"elif",
"args",
"[",
"0",
"]",
"==",
"'cancel'",
":",
"self",
".",
"master",
".",
"mav",
".",
"command_long_send",
"(",
"self",
".",
"settings",
".",
"target_system",
",",
"# target_system",
"0",
",",
"# target_component",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_DO_CANCEL_MAG_CAL",
",",
"# command",
"0",
",",
"# confirmation",
"0",
",",
"# p1: mag_mask",
"0",
",",
"# param2",
"1",
",",
"# param3",
"0",
",",
"# param4",
"0",
",",
"# param5",
"0",
",",
"# param6",
"0",
")"
] | control magnetometer calibration | [
"control",
"magnetometer",
"calibration"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_calibration.py#L114-L158 |
248,931 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.set_fence_enabled | def set_fence_enabled(self, do_enable):
'''Enable or disable fence'''
self.master.mav.command_long_send(
self.target_system,
self.target_component,
mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE, 0,
do_enable, 0, 0, 0, 0, 0, 0) | python | def set_fence_enabled(self, do_enable):
'''Enable or disable fence'''
self.master.mav.command_long_send(
self.target_system,
self.target_component,
mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE, 0,
do_enable, 0, 0, 0, 0, 0, 0) | [
"def",
"set_fence_enabled",
"(",
"self",
",",
"do_enable",
")",
":",
"self",
".",
"master",
".",
"mav",
".",
"command_long_send",
"(",
"self",
".",
"target_system",
",",
"self",
".",
"target_component",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_DO_FENCE_ENABLE",
",",
"0",
",",
"do_enable",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
")"
] | Enable or disable fence | [
"Enable",
"or",
"disable",
"fence"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L96-L102 |
248,932 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.cmd_fence_move | def cmd_fence_move(self, args):
'''handle fencepoint move'''
if len(args) < 1:
print("Usage: fence move FENCEPOINTNUM")
return
if not self.have_list:
print("Please list fence points first")
return
idx = int(args[0])
if idx <= 0 or idx > self.fenceloader.count():
print("Invalid fence point number %u" % idx)
return
try:
latlon = self.module('map').click_position
except Exception:
print("No map available")
return
if latlon is None:
print("No map click position available")
return
# note we don't subtract 1, as first fence point is the return point
self.fenceloader.move(idx, latlon[0], latlon[1])
if self.send_fence():
print("Moved fence point %u" % idx) | python | def cmd_fence_move(self, args):
'''handle fencepoint move'''
if len(args) < 1:
print("Usage: fence move FENCEPOINTNUM")
return
if not self.have_list:
print("Please list fence points first")
return
idx = int(args[0])
if idx <= 0 or idx > self.fenceloader.count():
print("Invalid fence point number %u" % idx)
return
try:
latlon = self.module('map').click_position
except Exception:
print("No map available")
return
if latlon is None:
print("No map click position available")
return
# note we don't subtract 1, as first fence point is the return point
self.fenceloader.move(idx, latlon[0], latlon[1])
if self.send_fence():
print("Moved fence point %u" % idx) | [
"def",
"cmd_fence_move",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"print",
"(",
"\"Usage: fence move FENCEPOINTNUM\"",
")",
"return",
"if",
"not",
"self",
".",
"have_list",
":",
"print",
"(",
"\"Please list fence points first\"",
")",
"return",
"idx",
"=",
"int",
"(",
"args",
"[",
"0",
"]",
")",
"if",
"idx",
"<=",
"0",
"or",
"idx",
">",
"self",
".",
"fenceloader",
".",
"count",
"(",
")",
":",
"print",
"(",
"\"Invalid fence point number %u\"",
"%",
"idx",
")",
"return",
"try",
":",
"latlon",
"=",
"self",
".",
"module",
"(",
"'map'",
")",
".",
"click_position",
"except",
"Exception",
":",
"print",
"(",
"\"No map available\"",
")",
"return",
"if",
"latlon",
"is",
"None",
":",
"print",
"(",
"\"No map click position available\"",
")",
"return",
"# note we don't subtract 1, as first fence point is the return point",
"self",
".",
"fenceloader",
".",
"move",
"(",
"idx",
",",
"latlon",
"[",
"0",
"]",
",",
"latlon",
"[",
"1",
"]",
")",
"if",
"self",
".",
"send_fence",
"(",
")",
":",
"print",
"(",
"\"Moved fence point %u\"",
"%",
"idx",
")"
] | handle fencepoint move | [
"handle",
"fencepoint",
"move"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L104-L130 |
248,933 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.cmd_fence_remove | def cmd_fence_remove(self, args):
'''handle fencepoint remove'''
if len(args) < 1:
print("Usage: fence remove FENCEPOINTNUM")
return
if not self.have_list:
print("Please list fence points first")
return
idx = int(args[0])
if idx <= 0 or idx > self.fenceloader.count():
print("Invalid fence point number %u" % idx)
return
# note we don't subtract 1, as first fence point is the return point
self.fenceloader.remove(idx)
if self.send_fence():
print("Removed fence point %u" % idx)
else:
print("Failed to remove fence point %u" % idx) | python | def cmd_fence_remove(self, args):
'''handle fencepoint remove'''
if len(args) < 1:
print("Usage: fence remove FENCEPOINTNUM")
return
if not self.have_list:
print("Please list fence points first")
return
idx = int(args[0])
if idx <= 0 or idx > self.fenceloader.count():
print("Invalid fence point number %u" % idx)
return
# note we don't subtract 1, as first fence point is the return point
self.fenceloader.remove(idx)
if self.send_fence():
print("Removed fence point %u" % idx)
else:
print("Failed to remove fence point %u" % idx) | [
"def",
"cmd_fence_remove",
"(",
"self",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"print",
"(",
"\"Usage: fence remove FENCEPOINTNUM\"",
")",
"return",
"if",
"not",
"self",
".",
"have_list",
":",
"print",
"(",
"\"Please list fence points first\"",
")",
"return",
"idx",
"=",
"int",
"(",
"args",
"[",
"0",
"]",
")",
"if",
"idx",
"<=",
"0",
"or",
"idx",
">",
"self",
".",
"fenceloader",
".",
"count",
"(",
")",
":",
"print",
"(",
"\"Invalid fence point number %u\"",
"%",
"idx",
")",
"return",
"# note we don't subtract 1, as first fence point is the return point",
"self",
".",
"fenceloader",
".",
"remove",
"(",
"idx",
")",
"if",
"self",
".",
"send_fence",
"(",
")",
":",
"print",
"(",
"\"Removed fence point %u\"",
"%",
"idx",
")",
"else",
":",
"print",
"(",
"\"Failed to remove fence point %u\"",
"%",
"idx",
")"
] | handle fencepoint remove | [
"handle",
"fencepoint",
"remove"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L132-L151 |
248,934 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.send_fence | def send_fence(self):
'''send fence points from fenceloader'''
# must disable geo-fencing when loading
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
self.fenceloader.reindex()
action = self.get_mav_param('FENCE_ACTION', mavutil.mavlink.FENCE_ACTION_NONE)
self.param_set('FENCE_ACTION', mavutil.mavlink.FENCE_ACTION_NONE, 3)
self.param_set('FENCE_TOTAL', self.fenceloader.count(), 3)
for i in range(self.fenceloader.count()):
p = self.fenceloader.point(i)
self.master.mav.send(p)
p2 = self.fetch_fence_point(i)
if p2 is None:
self.param_set('FENCE_ACTION', action, 3)
return False
if (p.idx != p2.idx or
abs(p.lat - p2.lat) >= 0.00003 or
abs(p.lng - p2.lng) >= 0.00003):
print("Failed to send fence point %u" % i)
self.param_set('FENCE_ACTION', action, 3)
return False
self.param_set('FENCE_ACTION', action, 3)
return True | python | def send_fence(self):
'''send fence points from fenceloader'''
# must disable geo-fencing when loading
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
self.fenceloader.reindex()
action = self.get_mav_param('FENCE_ACTION', mavutil.mavlink.FENCE_ACTION_NONE)
self.param_set('FENCE_ACTION', mavutil.mavlink.FENCE_ACTION_NONE, 3)
self.param_set('FENCE_TOTAL', self.fenceloader.count(), 3)
for i in range(self.fenceloader.count()):
p = self.fenceloader.point(i)
self.master.mav.send(p)
p2 = self.fetch_fence_point(i)
if p2 is None:
self.param_set('FENCE_ACTION', action, 3)
return False
if (p.idx != p2.idx or
abs(p.lat - p2.lat) >= 0.00003 or
abs(p.lng - p2.lng) >= 0.00003):
print("Failed to send fence point %u" % i)
self.param_set('FENCE_ACTION', action, 3)
return False
self.param_set('FENCE_ACTION', action, 3)
return True | [
"def",
"send_fence",
"(",
"self",
")",
":",
"# must disable geo-fencing when loading",
"self",
".",
"fenceloader",
".",
"target_system",
"=",
"self",
".",
"target_system",
"self",
".",
"fenceloader",
".",
"target_component",
"=",
"self",
".",
"target_component",
"self",
".",
"fenceloader",
".",
"reindex",
"(",
")",
"action",
"=",
"self",
".",
"get_mav_param",
"(",
"'FENCE_ACTION'",
",",
"mavutil",
".",
"mavlink",
".",
"FENCE_ACTION_NONE",
")",
"self",
".",
"param_set",
"(",
"'FENCE_ACTION'",
",",
"mavutil",
".",
"mavlink",
".",
"FENCE_ACTION_NONE",
",",
"3",
")",
"self",
".",
"param_set",
"(",
"'FENCE_TOTAL'",
",",
"self",
".",
"fenceloader",
".",
"count",
"(",
")",
",",
"3",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"fenceloader",
".",
"count",
"(",
")",
")",
":",
"p",
"=",
"self",
".",
"fenceloader",
".",
"point",
"(",
"i",
")",
"self",
".",
"master",
".",
"mav",
".",
"send",
"(",
"p",
")",
"p2",
"=",
"self",
".",
"fetch_fence_point",
"(",
"i",
")",
"if",
"p2",
"is",
"None",
":",
"self",
".",
"param_set",
"(",
"'FENCE_ACTION'",
",",
"action",
",",
"3",
")",
"return",
"False",
"if",
"(",
"p",
".",
"idx",
"!=",
"p2",
".",
"idx",
"or",
"abs",
"(",
"p",
".",
"lat",
"-",
"p2",
".",
"lat",
")",
">=",
"0.00003",
"or",
"abs",
"(",
"p",
".",
"lng",
"-",
"p2",
".",
"lng",
")",
">=",
"0.00003",
")",
":",
"print",
"(",
"\"Failed to send fence point %u\"",
"%",
"i",
")",
"self",
".",
"param_set",
"(",
"'FENCE_ACTION'",
",",
"action",
",",
"3",
")",
"return",
"False",
"self",
".",
"param_set",
"(",
"'FENCE_ACTION'",
",",
"action",
",",
"3",
")",
"return",
"True"
] | send fence points from fenceloader | [
"send",
"fence",
"points",
"from",
"fenceloader"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L208-L231 |
248,935 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.fetch_fence_point | def fetch_fence_point(self ,i):
'''fetch one fence point'''
self.master.mav.fence_fetch_point_send(self.target_system,
self.target_component, i)
tstart = time.time()
p = None
while time.time() - tstart < 3:
p = self.master.recv_match(type='FENCE_POINT', blocking=False)
if p is not None:
break
time.sleep(0.1)
continue
if p is None:
self.console.error("Failed to fetch point %u" % i)
return None
return p | python | def fetch_fence_point(self ,i):
'''fetch one fence point'''
self.master.mav.fence_fetch_point_send(self.target_system,
self.target_component, i)
tstart = time.time()
p = None
while time.time() - tstart < 3:
p = self.master.recv_match(type='FENCE_POINT', blocking=False)
if p is not None:
break
time.sleep(0.1)
continue
if p is None:
self.console.error("Failed to fetch point %u" % i)
return None
return p | [
"def",
"fetch_fence_point",
"(",
"self",
",",
"i",
")",
":",
"self",
".",
"master",
".",
"mav",
".",
"fence_fetch_point_send",
"(",
"self",
".",
"target_system",
",",
"self",
".",
"target_component",
",",
"i",
")",
"tstart",
"=",
"time",
".",
"time",
"(",
")",
"p",
"=",
"None",
"while",
"time",
".",
"time",
"(",
")",
"-",
"tstart",
"<",
"3",
":",
"p",
"=",
"self",
".",
"master",
".",
"recv_match",
"(",
"type",
"=",
"'FENCE_POINT'",
",",
"blocking",
"=",
"False",
")",
"if",
"p",
"is",
"not",
"None",
":",
"break",
"time",
".",
"sleep",
"(",
"0.1",
")",
"continue",
"if",
"p",
"is",
"None",
":",
"self",
".",
"console",
".",
"error",
"(",
"\"Failed to fetch point %u\"",
"%",
"i",
")",
"return",
"None",
"return",
"p"
] | fetch one fence point | [
"fetch",
"one",
"fence",
"point"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L233-L248 |
248,936 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py | FenceModule.fence_draw_callback | def fence_draw_callback(self, points):
'''callback from drawing a fence'''
self.fenceloader.clear()
if len(points) < 3:
return
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
bounds = mp_util.polygon_bounds(points)
(lat, lon, width, height) = bounds
center = (lat+width/2, lon+height/2)
self.fenceloader.add_latlon(center[0], center[1])
for p in points:
self.fenceloader.add_latlon(p[0], p[1])
# close it
self.fenceloader.add_latlon(points[0][0], points[0][1])
self.send_fence()
self.have_list = True | python | def fence_draw_callback(self, points):
'''callback from drawing a fence'''
self.fenceloader.clear()
if len(points) < 3:
return
self.fenceloader.target_system = self.target_system
self.fenceloader.target_component = self.target_component
bounds = mp_util.polygon_bounds(points)
(lat, lon, width, height) = bounds
center = (lat+width/2, lon+height/2)
self.fenceloader.add_latlon(center[0], center[1])
for p in points:
self.fenceloader.add_latlon(p[0], p[1])
# close it
self.fenceloader.add_latlon(points[0][0], points[0][1])
self.send_fence()
self.have_list = True | [
"def",
"fence_draw_callback",
"(",
"self",
",",
"points",
")",
":",
"self",
".",
"fenceloader",
".",
"clear",
"(",
")",
"if",
"len",
"(",
"points",
")",
"<",
"3",
":",
"return",
"self",
".",
"fenceloader",
".",
"target_system",
"=",
"self",
".",
"target_system",
"self",
".",
"fenceloader",
".",
"target_component",
"=",
"self",
".",
"target_component",
"bounds",
"=",
"mp_util",
".",
"polygon_bounds",
"(",
"points",
")",
"(",
"lat",
",",
"lon",
",",
"width",
",",
"height",
")",
"=",
"bounds",
"center",
"=",
"(",
"lat",
"+",
"width",
"/",
"2",
",",
"lon",
"+",
"height",
"/",
"2",
")",
"self",
".",
"fenceloader",
".",
"add_latlon",
"(",
"center",
"[",
"0",
"]",
",",
"center",
"[",
"1",
"]",
")",
"for",
"p",
"in",
"points",
":",
"self",
".",
"fenceloader",
".",
"add_latlon",
"(",
"p",
"[",
"0",
"]",
",",
"p",
"[",
"1",
"]",
")",
"# close it",
"self",
".",
"fenceloader",
".",
"add_latlon",
"(",
"points",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"points",
"[",
"0",
"]",
"[",
"1",
"]",
")",
"self",
".",
"send_fence",
"(",
")",
"self",
".",
"have_list",
"=",
"True"
] | callback from drawing a fence | [
"callback",
"from",
"drawing",
"a",
"fence"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_fence.py#L250-L266 |
248,937 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_console.py | ConsoleModule.add_menu | def add_menu(self, menu):
'''add a new menu'''
self.menu.add(menu)
self.mpstate.console.set_menu(self.menu, self.menu_callback) | python | def add_menu(self, menu):
'''add a new menu'''
self.menu.add(menu)
self.mpstate.console.set_menu(self.menu, self.menu_callback) | [
"def",
"add_menu",
"(",
"self",
",",
"menu",
")",
":",
"self",
".",
"menu",
".",
"add",
"(",
"menu",
")",
"self",
".",
"mpstate",
".",
"console",
".",
"set_menu",
"(",
"self",
".",
"menu",
",",
"self",
".",
"menu_callback",
")"
] | add a new menu | [
"add",
"a",
"new",
"menu"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_console.py#L67-L70 |
248,938 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_console.py | ConsoleModule.estimated_time_remaining | def estimated_time_remaining(self, lat, lon, wpnum, speed):
'''estimate time remaining in mission in seconds'''
idx = wpnum
if wpnum >= self.module('wp').wploader.count():
return 0
distance = 0
done = set()
while idx < self.module('wp').wploader.count():
if idx in done:
break
done.add(idx)
w = self.module('wp').wploader.wp(idx)
if w.command == mavutil.mavlink.MAV_CMD_DO_JUMP:
idx = int(w.param1)
continue
idx += 1
if (w.x != 0 or w.y != 0) and w.command in [mavutil.mavlink.MAV_CMD_NAV_WAYPOINT,
mavutil.mavlink.MAV_CMD_NAV_LOITER_UNLIM,
mavutil.mavlink.MAV_CMD_NAV_LOITER_TURNS,
mavutil.mavlink.MAV_CMD_NAV_LOITER_TIME,
mavutil.mavlink.MAV_CMD_NAV_LAND,
mavutil.mavlink.MAV_CMD_NAV_TAKEOFF]:
distance += mp_util.gps_distance(lat, lon, w.x, w.y)
lat = w.x
lon = w.y
if w.command == mavutil.mavlink.MAV_CMD_NAV_LAND:
break
return distance / speed | python | def estimated_time_remaining(self, lat, lon, wpnum, speed):
'''estimate time remaining in mission in seconds'''
idx = wpnum
if wpnum >= self.module('wp').wploader.count():
return 0
distance = 0
done = set()
while idx < self.module('wp').wploader.count():
if idx in done:
break
done.add(idx)
w = self.module('wp').wploader.wp(idx)
if w.command == mavutil.mavlink.MAV_CMD_DO_JUMP:
idx = int(w.param1)
continue
idx += 1
if (w.x != 0 or w.y != 0) and w.command in [mavutil.mavlink.MAV_CMD_NAV_WAYPOINT,
mavutil.mavlink.MAV_CMD_NAV_LOITER_UNLIM,
mavutil.mavlink.MAV_CMD_NAV_LOITER_TURNS,
mavutil.mavlink.MAV_CMD_NAV_LOITER_TIME,
mavutil.mavlink.MAV_CMD_NAV_LAND,
mavutil.mavlink.MAV_CMD_NAV_TAKEOFF]:
distance += mp_util.gps_distance(lat, lon, w.x, w.y)
lat = w.x
lon = w.y
if w.command == mavutil.mavlink.MAV_CMD_NAV_LAND:
break
return distance / speed | [
"def",
"estimated_time_remaining",
"(",
"self",
",",
"lat",
",",
"lon",
",",
"wpnum",
",",
"speed",
")",
":",
"idx",
"=",
"wpnum",
"if",
"wpnum",
">=",
"self",
".",
"module",
"(",
"'wp'",
")",
".",
"wploader",
".",
"count",
"(",
")",
":",
"return",
"0",
"distance",
"=",
"0",
"done",
"=",
"set",
"(",
")",
"while",
"idx",
"<",
"self",
".",
"module",
"(",
"'wp'",
")",
".",
"wploader",
".",
"count",
"(",
")",
":",
"if",
"idx",
"in",
"done",
":",
"break",
"done",
".",
"add",
"(",
"idx",
")",
"w",
"=",
"self",
".",
"module",
"(",
"'wp'",
")",
".",
"wploader",
".",
"wp",
"(",
"idx",
")",
"if",
"w",
".",
"command",
"==",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_DO_JUMP",
":",
"idx",
"=",
"int",
"(",
"w",
".",
"param1",
")",
"continue",
"idx",
"+=",
"1",
"if",
"(",
"w",
".",
"x",
"!=",
"0",
"or",
"w",
".",
"y",
"!=",
"0",
")",
"and",
"w",
".",
"command",
"in",
"[",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_NAV_WAYPOINT",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_NAV_LOITER_UNLIM",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_NAV_LOITER_TURNS",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_NAV_LOITER_TIME",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_NAV_LAND",
",",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_NAV_TAKEOFF",
"]",
":",
"distance",
"+=",
"mp_util",
".",
"gps_distance",
"(",
"lat",
",",
"lon",
",",
"w",
".",
"x",
",",
"w",
".",
"y",
")",
"lat",
"=",
"w",
".",
"x",
"lon",
"=",
"w",
".",
"y",
"if",
"w",
".",
"command",
"==",
"mavutil",
".",
"mavlink",
".",
"MAV_CMD_NAV_LAND",
":",
"break",
"return",
"distance",
"/",
"speed"
] | estimate time remaining in mission in seconds | [
"estimate",
"time",
"remaining",
"in",
"mission",
"in",
"seconds"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_console.py#L90-L117 |
248,939 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Vector3.angle | def angle(self, v):
'''return the angle between this vector and another vector'''
return acos((self * v) / (self.length() * v.length())) | python | def angle(self, v):
'''return the angle between this vector and another vector'''
return acos((self * v) / (self.length() * v.length())) | [
"def",
"angle",
"(",
"self",
",",
"v",
")",
":",
"return",
"acos",
"(",
"(",
"self",
"*",
"v",
")",
"/",
"(",
"self",
".",
"length",
"(",
")",
"*",
"v",
".",
"length",
"(",
")",
")",
")"
] | return the angle between this vector and another vector | [
"return",
"the",
"angle",
"between",
"this",
"vector",
"and",
"another",
"vector"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L114-L116 |
248,940 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.from_euler | def from_euler(self, roll, pitch, yaw):
'''fill the matrix from Euler angles in radians'''
cp = cos(pitch)
sp = sin(pitch)
sr = sin(roll)
cr = cos(roll)
sy = sin(yaw)
cy = cos(yaw)
self.a.x = cp * cy
self.a.y = (sr * sp * cy) - (cr * sy)
self.a.z = (cr * sp * cy) + (sr * sy)
self.b.x = cp * sy
self.b.y = (sr * sp * sy) + (cr * cy)
self.b.z = (cr * sp * sy) - (sr * cy)
self.c.x = -sp
self.c.y = sr * cp
self.c.z = cr * cp | python | def from_euler(self, roll, pitch, yaw):
'''fill the matrix from Euler angles in radians'''
cp = cos(pitch)
sp = sin(pitch)
sr = sin(roll)
cr = cos(roll)
sy = sin(yaw)
cy = cos(yaw)
self.a.x = cp * cy
self.a.y = (sr * sp * cy) - (cr * sy)
self.a.z = (cr * sp * cy) + (sr * sy)
self.b.x = cp * sy
self.b.y = (sr * sp * sy) + (cr * cy)
self.b.z = (cr * sp * sy) - (sr * cy)
self.c.x = -sp
self.c.y = sr * cp
self.c.z = cr * cp | [
"def",
"from_euler",
"(",
"self",
",",
"roll",
",",
"pitch",
",",
"yaw",
")",
":",
"cp",
"=",
"cos",
"(",
"pitch",
")",
"sp",
"=",
"sin",
"(",
"pitch",
")",
"sr",
"=",
"sin",
"(",
"roll",
")",
"cr",
"=",
"cos",
"(",
"roll",
")",
"sy",
"=",
"sin",
"(",
"yaw",
")",
"cy",
"=",
"cos",
"(",
"yaw",
")",
"self",
".",
"a",
".",
"x",
"=",
"cp",
"*",
"cy",
"self",
".",
"a",
".",
"y",
"=",
"(",
"sr",
"*",
"sp",
"*",
"cy",
")",
"-",
"(",
"cr",
"*",
"sy",
")",
"self",
".",
"a",
".",
"z",
"=",
"(",
"cr",
"*",
"sp",
"*",
"cy",
")",
"+",
"(",
"sr",
"*",
"sy",
")",
"self",
".",
"b",
".",
"x",
"=",
"cp",
"*",
"sy",
"self",
".",
"b",
".",
"y",
"=",
"(",
"sr",
"*",
"sp",
"*",
"sy",
")",
"+",
"(",
"cr",
"*",
"cy",
")",
"self",
".",
"b",
".",
"z",
"=",
"(",
"cr",
"*",
"sp",
"*",
"sy",
")",
"-",
"(",
"sr",
"*",
"cy",
")",
"self",
".",
"c",
".",
"x",
"=",
"-",
"sp",
"self",
".",
"c",
".",
"y",
"=",
"sr",
"*",
"cp",
"self",
".",
"c",
".",
"z",
"=",
"cr",
"*",
"cp"
] | fill the matrix from Euler angles in radians | [
"fill",
"the",
"matrix",
"from",
"Euler",
"angles",
"in",
"radians"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L154-L171 |
248,941 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.from_euler312 | def from_euler312(self, roll, pitch, yaw):
'''fill the matrix from Euler angles in radians in 312 convention'''
c3 = cos(pitch)
s3 = sin(pitch)
s2 = sin(roll)
c2 = cos(roll)
s1 = sin(yaw)
c1 = cos(yaw)
self.a.x = c1 * c3 - s1 * s2 * s3
self.b.y = c1 * c2
self.c.z = c3 * c2
self.a.y = -c2*s1
self.a.z = s3*c1 + c3*s2*s1
self.b.x = c3*s1 + s3*s2*c1
self.b.z = s1*s3 - s2*c1*c3
self.c.x = -s3*c2
self.c.y = s2 | python | def from_euler312(self, roll, pitch, yaw):
'''fill the matrix from Euler angles in radians in 312 convention'''
c3 = cos(pitch)
s3 = sin(pitch)
s2 = sin(roll)
c2 = cos(roll)
s1 = sin(yaw)
c1 = cos(yaw)
self.a.x = c1 * c3 - s1 * s2 * s3
self.b.y = c1 * c2
self.c.z = c3 * c2
self.a.y = -c2*s1
self.a.z = s3*c1 + c3*s2*s1
self.b.x = c3*s1 + s3*s2*c1
self.b.z = s1*s3 - s2*c1*c3
self.c.x = -s3*c2
self.c.y = s2 | [
"def",
"from_euler312",
"(",
"self",
",",
"roll",
",",
"pitch",
",",
"yaw",
")",
":",
"c3",
"=",
"cos",
"(",
"pitch",
")",
"s3",
"=",
"sin",
"(",
"pitch",
")",
"s2",
"=",
"sin",
"(",
"roll",
")",
"c2",
"=",
"cos",
"(",
"roll",
")",
"s1",
"=",
"sin",
"(",
"yaw",
")",
"c1",
"=",
"cos",
"(",
"yaw",
")",
"self",
".",
"a",
".",
"x",
"=",
"c1",
"*",
"c3",
"-",
"s1",
"*",
"s2",
"*",
"s3",
"self",
".",
"b",
".",
"y",
"=",
"c1",
"*",
"c2",
"self",
".",
"c",
".",
"z",
"=",
"c3",
"*",
"c2",
"self",
".",
"a",
".",
"y",
"=",
"-",
"c2",
"*",
"s1",
"self",
".",
"a",
".",
"z",
"=",
"s3",
"*",
"c1",
"+",
"c3",
"*",
"s2",
"*",
"s1",
"self",
".",
"b",
".",
"x",
"=",
"c3",
"*",
"s1",
"+",
"s3",
"*",
"s2",
"*",
"c1",
"self",
".",
"b",
".",
"z",
"=",
"s1",
"*",
"s3",
"-",
"s2",
"*",
"c1",
"*",
"c3",
"self",
".",
"c",
".",
"x",
"=",
"-",
"s3",
"*",
"c2",
"self",
".",
"c",
".",
"y",
"=",
"s2"
] | fill the matrix from Euler angles in radians in 312 convention | [
"fill",
"the",
"matrix",
"from",
"Euler",
"angles",
"in",
"radians",
"in",
"312",
"convention"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L201-L218 |
248,942 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.rotate | def rotate(self, g):
'''rotate the matrix by a given amount on 3 axes'''
temp_matrix = Matrix3()
a = self.a
b = self.b
c = self.c
temp_matrix.a.x = a.y * g.z - a.z * g.y
temp_matrix.a.y = a.z * g.x - a.x * g.z
temp_matrix.a.z = a.x * g.y - a.y * g.x
temp_matrix.b.x = b.y * g.z - b.z * g.y
temp_matrix.b.y = b.z * g.x - b.x * g.z
temp_matrix.b.z = b.x * g.y - b.y * g.x
temp_matrix.c.x = c.y * g.z - c.z * g.y
temp_matrix.c.y = c.z * g.x - c.x * g.z
temp_matrix.c.z = c.x * g.y - c.y * g.x
self.a += temp_matrix.a
self.b += temp_matrix.b
self.c += temp_matrix.c | python | def rotate(self, g):
'''rotate the matrix by a given amount on 3 axes'''
temp_matrix = Matrix3()
a = self.a
b = self.b
c = self.c
temp_matrix.a.x = a.y * g.z - a.z * g.y
temp_matrix.a.y = a.z * g.x - a.x * g.z
temp_matrix.a.z = a.x * g.y - a.y * g.x
temp_matrix.b.x = b.y * g.z - b.z * g.y
temp_matrix.b.y = b.z * g.x - b.x * g.z
temp_matrix.b.z = b.x * g.y - b.y * g.x
temp_matrix.c.x = c.y * g.z - c.z * g.y
temp_matrix.c.y = c.z * g.x - c.x * g.z
temp_matrix.c.z = c.x * g.y - c.y * g.x
self.a += temp_matrix.a
self.b += temp_matrix.b
self.c += temp_matrix.c | [
"def",
"rotate",
"(",
"self",
",",
"g",
")",
":",
"temp_matrix",
"=",
"Matrix3",
"(",
")",
"a",
"=",
"self",
".",
"a",
"b",
"=",
"self",
".",
"b",
"c",
"=",
"self",
".",
"c",
"temp_matrix",
".",
"a",
".",
"x",
"=",
"a",
".",
"y",
"*",
"g",
".",
"z",
"-",
"a",
".",
"z",
"*",
"g",
".",
"y",
"temp_matrix",
".",
"a",
".",
"y",
"=",
"a",
".",
"z",
"*",
"g",
".",
"x",
"-",
"a",
".",
"x",
"*",
"g",
".",
"z",
"temp_matrix",
".",
"a",
".",
"z",
"=",
"a",
".",
"x",
"*",
"g",
".",
"y",
"-",
"a",
".",
"y",
"*",
"g",
".",
"x",
"temp_matrix",
".",
"b",
".",
"x",
"=",
"b",
".",
"y",
"*",
"g",
".",
"z",
"-",
"b",
".",
"z",
"*",
"g",
".",
"y",
"temp_matrix",
".",
"b",
".",
"y",
"=",
"b",
".",
"z",
"*",
"g",
".",
"x",
"-",
"b",
".",
"x",
"*",
"g",
".",
"z",
"temp_matrix",
".",
"b",
".",
"z",
"=",
"b",
".",
"x",
"*",
"g",
".",
"y",
"-",
"b",
".",
"y",
"*",
"g",
".",
"x",
"temp_matrix",
".",
"c",
".",
"x",
"=",
"c",
".",
"y",
"*",
"g",
".",
"z",
"-",
"c",
".",
"z",
"*",
"g",
".",
"y",
"temp_matrix",
".",
"c",
".",
"y",
"=",
"c",
".",
"z",
"*",
"g",
".",
"x",
"-",
"c",
".",
"x",
"*",
"g",
".",
"z",
"temp_matrix",
".",
"c",
".",
"z",
"=",
"c",
".",
"x",
"*",
"g",
".",
"y",
"-",
"c",
".",
"y",
"*",
"g",
".",
"x",
"self",
".",
"a",
"+=",
"temp_matrix",
".",
"a",
"self",
".",
"b",
"+=",
"temp_matrix",
".",
"b",
"self",
".",
"c",
"+=",
"temp_matrix",
".",
"c"
] | rotate the matrix by a given amount on 3 axes | [
"rotate",
"the",
"matrix",
"by",
"a",
"given",
"amount",
"on",
"3",
"axes"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L262-L279 |
248,943 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.normalize | def normalize(self):
'''re-normalise a rotation matrix'''
error = self.a * self.b
t0 = self.a - (self.b * (0.5 * error))
t1 = self.b - (self.a * (0.5 * error))
t2 = t0 % t1
self.a = t0 * (1.0 / t0.length())
self.b = t1 * (1.0 / t1.length())
self.c = t2 * (1.0 / t2.length()) | python | def normalize(self):
'''re-normalise a rotation matrix'''
error = self.a * self.b
t0 = self.a - (self.b * (0.5 * error))
t1 = self.b - (self.a * (0.5 * error))
t2 = t0 % t1
self.a = t0 * (1.0 / t0.length())
self.b = t1 * (1.0 / t1.length())
self.c = t2 * (1.0 / t2.length()) | [
"def",
"normalize",
"(",
"self",
")",
":",
"error",
"=",
"self",
".",
"a",
"*",
"self",
".",
"b",
"t0",
"=",
"self",
".",
"a",
"-",
"(",
"self",
".",
"b",
"*",
"(",
"0.5",
"*",
"error",
")",
")",
"t1",
"=",
"self",
".",
"b",
"-",
"(",
"self",
".",
"a",
"*",
"(",
"0.5",
"*",
"error",
")",
")",
"t2",
"=",
"t0",
"%",
"t1",
"self",
".",
"a",
"=",
"t0",
"*",
"(",
"1.0",
"/",
"t0",
".",
"length",
"(",
")",
")",
"self",
".",
"b",
"=",
"t1",
"*",
"(",
"1.0",
"/",
"t1",
".",
"length",
"(",
")",
")",
"self",
".",
"c",
"=",
"t2",
"*",
"(",
"1.0",
"/",
"t2",
".",
"length",
"(",
")",
")"
] | re-normalise a rotation matrix | [
"re",
"-",
"normalise",
"a",
"rotation",
"matrix"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L281-L289 |
248,944 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.trace | def trace(self):
'''the trace of the matrix'''
return self.a.x + self.b.y + self.c.z | python | def trace(self):
'''the trace of the matrix'''
return self.a.x + self.b.y + self.c.z | [
"def",
"trace",
"(",
"self",
")",
":",
"return",
"self",
".",
"a",
".",
"x",
"+",
"self",
".",
"b",
".",
"y",
"+",
"self",
".",
"c",
".",
"z"
] | the trace of the matrix | [
"the",
"trace",
"of",
"the",
"matrix"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L291-L293 |
248,945 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.from_axis_angle | def from_axis_angle(self, axis, angle):
'''create a rotation matrix from axis and angle'''
ux = axis.x
uy = axis.y
uz = axis.z
ct = cos(angle)
st = sin(angle)
self.a.x = ct + (1-ct) * ux**2
self.a.y = ux*uy*(1-ct) - uz*st
self.a.z = ux*uz*(1-ct) + uy*st
self.b.x = uy*ux*(1-ct) + uz*st
self.b.y = ct + (1-ct) * uy**2
self.b.z = uy*uz*(1-ct) - ux*st
self.c.x = uz*ux*(1-ct) - uy*st
self.c.y = uz*uy*(1-ct) + ux*st
self.c.z = ct + (1-ct) * uz**2 | python | def from_axis_angle(self, axis, angle):
'''create a rotation matrix from axis and angle'''
ux = axis.x
uy = axis.y
uz = axis.z
ct = cos(angle)
st = sin(angle)
self.a.x = ct + (1-ct) * ux**2
self.a.y = ux*uy*(1-ct) - uz*st
self.a.z = ux*uz*(1-ct) + uy*st
self.b.x = uy*ux*(1-ct) + uz*st
self.b.y = ct + (1-ct) * uy**2
self.b.z = uy*uz*(1-ct) - ux*st
self.c.x = uz*ux*(1-ct) - uy*st
self.c.y = uz*uy*(1-ct) + ux*st
self.c.z = ct + (1-ct) * uz**2 | [
"def",
"from_axis_angle",
"(",
"self",
",",
"axis",
",",
"angle",
")",
":",
"ux",
"=",
"axis",
".",
"x",
"uy",
"=",
"axis",
".",
"y",
"uz",
"=",
"axis",
".",
"z",
"ct",
"=",
"cos",
"(",
"angle",
")",
"st",
"=",
"sin",
"(",
"angle",
")",
"self",
".",
"a",
".",
"x",
"=",
"ct",
"+",
"(",
"1",
"-",
"ct",
")",
"*",
"ux",
"**",
"2",
"self",
".",
"a",
".",
"y",
"=",
"ux",
"*",
"uy",
"*",
"(",
"1",
"-",
"ct",
")",
"-",
"uz",
"*",
"st",
"self",
".",
"a",
".",
"z",
"=",
"ux",
"*",
"uz",
"*",
"(",
"1",
"-",
"ct",
")",
"+",
"uy",
"*",
"st",
"self",
".",
"b",
".",
"x",
"=",
"uy",
"*",
"ux",
"*",
"(",
"1",
"-",
"ct",
")",
"+",
"uz",
"*",
"st",
"self",
".",
"b",
".",
"y",
"=",
"ct",
"+",
"(",
"1",
"-",
"ct",
")",
"*",
"uy",
"**",
"2",
"self",
".",
"b",
".",
"z",
"=",
"uy",
"*",
"uz",
"*",
"(",
"1",
"-",
"ct",
")",
"-",
"ux",
"*",
"st",
"self",
".",
"c",
".",
"x",
"=",
"uz",
"*",
"ux",
"*",
"(",
"1",
"-",
"ct",
")",
"-",
"uy",
"*",
"st",
"self",
".",
"c",
".",
"y",
"=",
"uz",
"*",
"uy",
"*",
"(",
"1",
"-",
"ct",
")",
"+",
"ux",
"*",
"st",
"self",
".",
"c",
".",
"z",
"=",
"ct",
"+",
"(",
"1",
"-",
"ct",
")",
"*",
"uz",
"**",
"2"
] | create a rotation matrix from axis and angle | [
"create",
"a",
"rotation",
"matrix",
"from",
"axis",
"and",
"angle"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L295-L310 |
248,946 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Matrix3.from_two_vectors | def from_two_vectors(self, vec1, vec2):
'''get a rotation matrix from two vectors.
This returns a rotation matrix which when applied to vec1
will produce a vector pointing in the same direction as vec2'''
angle = vec1.angle(vec2)
cross = vec1 % vec2
if cross.length() == 0:
# the two vectors are colinear
return self.from_euler(0,0,angle)
cross.normalize()
return self.from_axis_angle(cross, angle) | python | def from_two_vectors(self, vec1, vec2):
'''get a rotation matrix from two vectors.
This returns a rotation matrix which when applied to vec1
will produce a vector pointing in the same direction as vec2'''
angle = vec1.angle(vec2)
cross = vec1 % vec2
if cross.length() == 0:
# the two vectors are colinear
return self.from_euler(0,0,angle)
cross.normalize()
return self.from_axis_angle(cross, angle) | [
"def",
"from_two_vectors",
"(",
"self",
",",
"vec1",
",",
"vec2",
")",
":",
"angle",
"=",
"vec1",
".",
"angle",
"(",
"vec2",
")",
"cross",
"=",
"vec1",
"%",
"vec2",
"if",
"cross",
".",
"length",
"(",
")",
"==",
"0",
":",
"# the two vectors are colinear",
"return",
"self",
".",
"from_euler",
"(",
"0",
",",
"0",
",",
"angle",
")",
"cross",
".",
"normalize",
"(",
")",
"return",
"self",
".",
"from_axis_angle",
"(",
"cross",
",",
"angle",
")"
] | get a rotation matrix from two vectors.
This returns a rotation matrix which when applied to vec1
will produce a vector pointing in the same direction as vec2 | [
"get",
"a",
"rotation",
"matrix",
"from",
"two",
"vectors",
".",
"This",
"returns",
"a",
"rotation",
"matrix",
"which",
"when",
"applied",
"to",
"vec1",
"will",
"produce",
"a",
"vector",
"pointing",
"in",
"the",
"same",
"direction",
"as",
"vec2"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L313-L323 |
248,947 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py | Line.plane_intersection | def plane_intersection(self, plane, forward_only=False):
'''return point where line intersects with a plane'''
l_dot_n = self.vector * plane.normal
if l_dot_n == 0.0:
# line is parallel to the plane
return None
d = ((plane.point - self.point) * plane.normal) / l_dot_n
if forward_only and d < 0:
return None
return (self.vector * d) + self.point | python | def plane_intersection(self, plane, forward_only=False):
'''return point where line intersects with a plane'''
l_dot_n = self.vector * plane.normal
if l_dot_n == 0.0:
# line is parallel to the plane
return None
d = ((plane.point - self.point) * plane.normal) / l_dot_n
if forward_only and d < 0:
return None
return (self.vector * d) + self.point | [
"def",
"plane_intersection",
"(",
"self",
",",
"plane",
",",
"forward_only",
"=",
"False",
")",
":",
"l_dot_n",
"=",
"self",
".",
"vector",
"*",
"plane",
".",
"normal",
"if",
"l_dot_n",
"==",
"0.0",
":",
"# line is parallel to the plane",
"return",
"None",
"d",
"=",
"(",
"(",
"plane",
".",
"point",
"-",
"self",
".",
"point",
")",
"*",
"plane",
".",
"normal",
")",
"/",
"l_dot_n",
"if",
"forward_only",
"and",
"d",
"<",
"0",
":",
"return",
"None",
"return",
"(",
"self",
".",
"vector",
"*",
"d",
")",
"+",
"self",
".",
"point"
] | return point where line intersects with a plane | [
"return",
"point",
"where",
"line",
"intersects",
"with",
"a",
"plane"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L348-L357 |
248,948 | JdeRobot/base | src/libs/comm_py/comm/ice/rgbdIceClient.py | RgbdCamera.getRgbd | def getRgbd(self):
'''
Returns last Rgbd.
@return last JdeRobotTypes Rgbd saved
'''
img = Rgb()
if self.hasproxy():
self.lock.acquire()
img = self.image
self.lock.release()
return img | python | def getRgbd(self):
'''
Returns last Rgbd.
@return last JdeRobotTypes Rgbd saved
'''
img = Rgb()
if self.hasproxy():
self.lock.acquire()
img = self.image
self.lock.release()
return img | [
"def",
"getRgbd",
"(",
"self",
")",
":",
"img",
"=",
"Rgb",
"(",
")",
"if",
"self",
".",
"hasproxy",
"(",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"img",
"=",
"self",
".",
"image",
"self",
".",
"lock",
".",
"release",
"(",
")",
"return",
"img"
] | Returns last Rgbd.
@return last JdeRobotTypes Rgbd saved | [
"Returns",
"last",
"Rgbd",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/libs/comm_py/comm/ice/rgbdIceClient.py#L97-L109 |
248,949 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_graph.py | Graph.add_mavlink_packet | def add_mavlink_packet(self, msg):
'''add data to the graph'''
mtype = msg.get_type()
if mtype not in self.msg_types:
return
for i in range(len(self.fields)):
if mtype not in self.field_types[i]:
continue
f = self.fields[i]
self.values[i] = mavutil.evaluate_expression(f, self.state.master.messages)
if self.livegraph is not None:
self.livegraph.add_values(self.values) | python | def add_mavlink_packet(self, msg):
'''add data to the graph'''
mtype = msg.get_type()
if mtype not in self.msg_types:
return
for i in range(len(self.fields)):
if mtype not in self.field_types[i]:
continue
f = self.fields[i]
self.values[i] = mavutil.evaluate_expression(f, self.state.master.messages)
if self.livegraph is not None:
self.livegraph.add_values(self.values) | [
"def",
"add_mavlink_packet",
"(",
"self",
",",
"msg",
")",
":",
"mtype",
"=",
"msg",
".",
"get_type",
"(",
")",
"if",
"mtype",
"not",
"in",
"self",
".",
"msg_types",
":",
"return",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"fields",
")",
")",
":",
"if",
"mtype",
"not",
"in",
"self",
".",
"field_types",
"[",
"i",
"]",
":",
"continue",
"f",
"=",
"self",
".",
"fields",
"[",
"i",
"]",
"self",
".",
"values",
"[",
"i",
"]",
"=",
"mavutil",
".",
"evaluate_expression",
"(",
"f",
",",
"self",
".",
"state",
".",
"master",
".",
"messages",
")",
"if",
"self",
".",
"livegraph",
"is",
"not",
"None",
":",
"self",
".",
"livegraph",
".",
"add_values",
"(",
"self",
".",
"values",
")"
] | add data to the graph | [
"add",
"data",
"to",
"the",
"graph"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_graph.py#L104-L115 |
248,950 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_javascript.py | generate | def generate(basename, xml):
'''generate complete javascript implementation'''
if basename.endswith('.js'):
filename = basename
else:
filename = basename + '.js'
msgs = []
enums = []
filelist = []
for x in xml:
msgs.extend(x.message)
enums.extend(x.enum)
filelist.append(os.path.basename(x.filename))
for m in msgs:
if xml[0].little_endian:
m.fmtstr = '<'
else:
m.fmtstr = '>'
for f in m.ordered_fields:
m.fmtstr += mavfmt(f)
m.order_map = [ 0 ] * len(m.fieldnames)
for i in range(0, len(m.fieldnames)):
m.order_map[i] = m.ordered_fieldnames.index(m.fieldnames[i])
print("Generating %s" % filename)
outf = open(filename, "w")
generate_preamble(outf, msgs, filelist, xml[0])
generate_enums(outf, enums)
generate_message_ids(outf, msgs)
generate_classes(outf, msgs)
generate_mavlink_class(outf, msgs, xml[0])
generate_footer(outf)
outf.close()
print("Generated %s OK" % filename) | python | def generate(basename, xml):
'''generate complete javascript implementation'''
if basename.endswith('.js'):
filename = basename
else:
filename = basename + '.js'
msgs = []
enums = []
filelist = []
for x in xml:
msgs.extend(x.message)
enums.extend(x.enum)
filelist.append(os.path.basename(x.filename))
for m in msgs:
if xml[0].little_endian:
m.fmtstr = '<'
else:
m.fmtstr = '>'
for f in m.ordered_fields:
m.fmtstr += mavfmt(f)
m.order_map = [ 0 ] * len(m.fieldnames)
for i in range(0, len(m.fieldnames)):
m.order_map[i] = m.ordered_fieldnames.index(m.fieldnames[i])
print("Generating %s" % filename)
outf = open(filename, "w")
generate_preamble(outf, msgs, filelist, xml[0])
generate_enums(outf, enums)
generate_message_ids(outf, msgs)
generate_classes(outf, msgs)
generate_mavlink_class(outf, msgs, xml[0])
generate_footer(outf)
outf.close()
print("Generated %s OK" % filename) | [
"def",
"generate",
"(",
"basename",
",",
"xml",
")",
":",
"if",
"basename",
".",
"endswith",
"(",
"'.js'",
")",
":",
"filename",
"=",
"basename",
"else",
":",
"filename",
"=",
"basename",
"+",
"'.js'",
"msgs",
"=",
"[",
"]",
"enums",
"=",
"[",
"]",
"filelist",
"=",
"[",
"]",
"for",
"x",
"in",
"xml",
":",
"msgs",
".",
"extend",
"(",
"x",
".",
"message",
")",
"enums",
".",
"extend",
"(",
"x",
".",
"enum",
")",
"filelist",
".",
"append",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"x",
".",
"filename",
")",
")",
"for",
"m",
"in",
"msgs",
":",
"if",
"xml",
"[",
"0",
"]",
".",
"little_endian",
":",
"m",
".",
"fmtstr",
"=",
"'<'",
"else",
":",
"m",
".",
"fmtstr",
"=",
"'>'",
"for",
"f",
"in",
"m",
".",
"ordered_fields",
":",
"m",
".",
"fmtstr",
"+=",
"mavfmt",
"(",
"f",
")",
"m",
".",
"order_map",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"m",
".",
"fieldnames",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"m",
".",
"fieldnames",
")",
")",
":",
"m",
".",
"order_map",
"[",
"i",
"]",
"=",
"m",
".",
"ordered_fieldnames",
".",
"index",
"(",
"m",
".",
"fieldnames",
"[",
"i",
"]",
")",
"print",
"(",
"\"Generating %s\"",
"%",
"filename",
")",
"outf",
"=",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"generate_preamble",
"(",
"outf",
",",
"msgs",
",",
"filelist",
",",
"xml",
"[",
"0",
"]",
")",
"generate_enums",
"(",
"outf",
",",
"enums",
")",
"generate_message_ids",
"(",
"outf",
",",
"msgs",
")",
"generate_classes",
"(",
"outf",
",",
"msgs",
")",
"generate_mavlink_class",
"(",
"outf",
",",
"msgs",
",",
"xml",
"[",
"0",
"]",
")",
"generate_footer",
"(",
"outf",
")",
"outf",
".",
"close",
"(",
")",
"print",
"(",
"\"Generated %s OK\"",
"%",
"filename",
")"
] | generate complete javascript implementation | [
"generate",
"complete",
"javascript",
"implementation"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_javascript.py#L538-L574 |
248,951 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavflightmodes.py | flight_modes | def flight_modes(logfile):
'''show flight modes for a log file'''
print("Processing log %s" % filename)
mlog = mavutil.mavlink_connection(filename)
mode = ""
previous_mode = ""
mode_start_timestamp = -1
time_in_mode = {}
previous_percent = -1
seconds_per_percent = -1
filesize = os.path.getsize(filename)
while True:
m = mlog.recv_match(type=['SYS_STATUS','HEARTBEAT','MODE'],
condition='MAV.flightmode!="%s"' % mlog.flightmode)
if m is None:
break
print('%s MAV.flightmode=%-12s (MAV.timestamp=%u %u%%)' % (
time.asctime(time.localtime(m._timestamp)),
mlog.flightmode,
m._timestamp, mlog.percent))
mode = mlog.flightmode
if (mode not in time_in_mode):
time_in_mode[mode] = 0
if (mode_start_timestamp == -1):
mode_start_timestamp = m._timestamp
elif (previous_mode != "" and previous_mode != mode):
time_in_mode[previous_mode] = time_in_mode[previous_mode] + (m._timestamp - mode_start_timestamp)
#figure out how many seconds per percentage point so I can
#caculate how many seconds for the final mode
if (seconds_per_percent == -1 and previous_percent != -1
and previous_percent != mlog.percent):
seconds_per_percent = (m._timestamp - mode_start_timestamp) / (mlog.percent - previous_percent)
mode_start_timestamp = m._timestamp
previous_mode = mode
previous_percent = mlog.percent
#put a whitespace line before the per-mode report
print()
print("Time per mode:")
#need to get the time in the final mode
if (seconds_per_percent != -1):
seconds_remaining = (100.0 - previous_percent) * seconds_per_percent
time_in_mode[previous_mode] = time_in_mode[previous_mode] + seconds_remaining
total_flight_time = 0
for key, value in time_in_mode.iteritems():
total_flight_time = total_flight_time + value
for key, value in time_in_mode.iteritems():
print('%-12s %s %.2f%%' % (key, str(datetime.timedelta(seconds=int(value))), (value / total_flight_time) * 100.0))
else:
#can't print time in mode if only one mode during flight
print(previous_mode, " 100% of flight time") | python | def flight_modes(logfile):
'''show flight modes for a log file'''
print("Processing log %s" % filename)
mlog = mavutil.mavlink_connection(filename)
mode = ""
previous_mode = ""
mode_start_timestamp = -1
time_in_mode = {}
previous_percent = -1
seconds_per_percent = -1
filesize = os.path.getsize(filename)
while True:
m = mlog.recv_match(type=['SYS_STATUS','HEARTBEAT','MODE'],
condition='MAV.flightmode!="%s"' % mlog.flightmode)
if m is None:
break
print('%s MAV.flightmode=%-12s (MAV.timestamp=%u %u%%)' % (
time.asctime(time.localtime(m._timestamp)),
mlog.flightmode,
m._timestamp, mlog.percent))
mode = mlog.flightmode
if (mode not in time_in_mode):
time_in_mode[mode] = 0
if (mode_start_timestamp == -1):
mode_start_timestamp = m._timestamp
elif (previous_mode != "" and previous_mode != mode):
time_in_mode[previous_mode] = time_in_mode[previous_mode] + (m._timestamp - mode_start_timestamp)
#figure out how many seconds per percentage point so I can
#caculate how many seconds for the final mode
if (seconds_per_percent == -1 and previous_percent != -1
and previous_percent != mlog.percent):
seconds_per_percent = (m._timestamp - mode_start_timestamp) / (mlog.percent - previous_percent)
mode_start_timestamp = m._timestamp
previous_mode = mode
previous_percent = mlog.percent
#put a whitespace line before the per-mode report
print()
print("Time per mode:")
#need to get the time in the final mode
if (seconds_per_percent != -1):
seconds_remaining = (100.0 - previous_percent) * seconds_per_percent
time_in_mode[previous_mode] = time_in_mode[previous_mode] + seconds_remaining
total_flight_time = 0
for key, value in time_in_mode.iteritems():
total_flight_time = total_flight_time + value
for key, value in time_in_mode.iteritems():
print('%-12s %s %.2f%%' % (key, str(datetime.timedelta(seconds=int(value))), (value / total_flight_time) * 100.0))
else:
#can't print time in mode if only one mode during flight
print(previous_mode, " 100% of flight time") | [
"def",
"flight_modes",
"(",
"logfile",
")",
":",
"print",
"(",
"\"Processing log %s\"",
"%",
"filename",
")",
"mlog",
"=",
"mavutil",
".",
"mavlink_connection",
"(",
"filename",
")",
"mode",
"=",
"\"\"",
"previous_mode",
"=",
"\"\"",
"mode_start_timestamp",
"=",
"-",
"1",
"time_in_mode",
"=",
"{",
"}",
"previous_percent",
"=",
"-",
"1",
"seconds_per_percent",
"=",
"-",
"1",
"filesize",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"filename",
")",
"while",
"True",
":",
"m",
"=",
"mlog",
".",
"recv_match",
"(",
"type",
"=",
"[",
"'SYS_STATUS'",
",",
"'HEARTBEAT'",
",",
"'MODE'",
"]",
",",
"condition",
"=",
"'MAV.flightmode!=\"%s\"'",
"%",
"mlog",
".",
"flightmode",
")",
"if",
"m",
"is",
"None",
":",
"break",
"print",
"(",
"'%s MAV.flightmode=%-12s (MAV.timestamp=%u %u%%)'",
"%",
"(",
"time",
".",
"asctime",
"(",
"time",
".",
"localtime",
"(",
"m",
".",
"_timestamp",
")",
")",
",",
"mlog",
".",
"flightmode",
",",
"m",
".",
"_timestamp",
",",
"mlog",
".",
"percent",
")",
")",
"mode",
"=",
"mlog",
".",
"flightmode",
"if",
"(",
"mode",
"not",
"in",
"time_in_mode",
")",
":",
"time_in_mode",
"[",
"mode",
"]",
"=",
"0",
"if",
"(",
"mode_start_timestamp",
"==",
"-",
"1",
")",
":",
"mode_start_timestamp",
"=",
"m",
".",
"_timestamp",
"elif",
"(",
"previous_mode",
"!=",
"\"\"",
"and",
"previous_mode",
"!=",
"mode",
")",
":",
"time_in_mode",
"[",
"previous_mode",
"]",
"=",
"time_in_mode",
"[",
"previous_mode",
"]",
"+",
"(",
"m",
".",
"_timestamp",
"-",
"mode_start_timestamp",
")",
"#figure out how many seconds per percentage point so I can",
"#caculate how many seconds for the final mode",
"if",
"(",
"seconds_per_percent",
"==",
"-",
"1",
"and",
"previous_percent",
"!=",
"-",
"1",
"and",
"previous_percent",
"!=",
"mlog",
".",
"percent",
")",
":",
"seconds_per_percent",
"=",
"(",
"m",
".",
"_timestamp",
"-",
"mode_start_timestamp",
")",
"/",
"(",
"mlog",
".",
"percent",
"-",
"previous_percent",
")",
"mode_start_timestamp",
"=",
"m",
".",
"_timestamp",
"previous_mode",
"=",
"mode",
"previous_percent",
"=",
"mlog",
".",
"percent",
"#put a whitespace line before the per-mode report",
"print",
"(",
")",
"print",
"(",
"\"Time per mode:\"",
")",
"#need to get the time in the final mode",
"if",
"(",
"seconds_per_percent",
"!=",
"-",
"1",
")",
":",
"seconds_remaining",
"=",
"(",
"100.0",
"-",
"previous_percent",
")",
"*",
"seconds_per_percent",
"time_in_mode",
"[",
"previous_mode",
"]",
"=",
"time_in_mode",
"[",
"previous_mode",
"]",
"+",
"seconds_remaining",
"total_flight_time",
"=",
"0",
"for",
"key",
",",
"value",
"in",
"time_in_mode",
".",
"iteritems",
"(",
")",
":",
"total_flight_time",
"=",
"total_flight_time",
"+",
"value",
"for",
"key",
",",
"value",
"in",
"time_in_mode",
".",
"iteritems",
"(",
")",
":",
"print",
"(",
"'%-12s %s %.2f%%'",
"%",
"(",
"key",
",",
"str",
"(",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"int",
"(",
"value",
")",
")",
")",
",",
"(",
"value",
"/",
"total_flight_time",
")",
"*",
"100.0",
")",
")",
"else",
":",
"#can't print time in mode if only one mode during flight",
"print",
"(",
"previous_mode",
",",
"\" 100% of flight time\"",
")"
] | show flight modes for a log file | [
"show",
"flight",
"modes",
"for",
"a",
"log",
"file"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavflightmodes.py#L18-L80 |
248,952 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py | have_graph | def have_graph(name):
'''return true if we have a graph of the given name'''
for g in mestate.graphs:
if g.name == name:
return True
return False | python | def have_graph(name):
'''return true if we have a graph of the given name'''
for g in mestate.graphs:
if g.name == name:
return True
return False | [
"def",
"have_graph",
"(",
"name",
")",
":",
"for",
"g",
"in",
"mestate",
".",
"graphs",
":",
"if",
"g",
".",
"name",
"==",
"name",
":",
"return",
"True",
"return",
"False"
] | return true if we have a graph of the given name | [
"return",
"true",
"if",
"we",
"have",
"a",
"graph",
"of",
"the",
"given",
"name"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L67-L72 |
248,953 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py | expression_ok | def expression_ok(expression):
'''return True if an expression is OK with current messages'''
expression_ok = True
fields = expression.split()
for f in fields:
try:
if f.endswith(':2'):
f = f[:-2]
if mavutil.evaluate_expression(f, mestate.status.msgs) is None:
expression_ok = False
except Exception:
expression_ok = False
break
return expression_ok | python | def expression_ok(expression):
'''return True if an expression is OK with current messages'''
expression_ok = True
fields = expression.split()
for f in fields:
try:
if f.endswith(':2'):
f = f[:-2]
if mavutil.evaluate_expression(f, mestate.status.msgs) is None:
expression_ok = False
except Exception:
expression_ok = False
break
return expression_ok | [
"def",
"expression_ok",
"(",
"expression",
")",
":",
"expression_ok",
"=",
"True",
"fields",
"=",
"expression",
".",
"split",
"(",
")",
"for",
"f",
"in",
"fields",
":",
"try",
":",
"if",
"f",
".",
"endswith",
"(",
"':2'",
")",
":",
"f",
"=",
"f",
"[",
":",
"-",
"2",
"]",
"if",
"mavutil",
".",
"evaluate_expression",
"(",
"f",
",",
"mestate",
".",
"status",
".",
"msgs",
")",
"is",
"None",
":",
"expression_ok",
"=",
"False",
"except",
"Exception",
":",
"expression_ok",
"=",
"False",
"break",
"return",
"expression_ok"
] | return True if an expression is OK with current messages | [
"return",
"True",
"if",
"an",
"expression",
"is",
"OK",
"with",
"current",
"messages"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L129-L142 |
248,954 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py | load_graph_xml | def load_graph_xml(xml, filename, load_all=False):
'''load a graph from one xml string'''
ret = []
try:
root = objectify.fromstring(xml)
except Exception:
return []
if root.tag != 'graphs':
return []
if not hasattr(root, 'graph'):
return []
for g in root.graph:
name = g.attrib['name']
expressions = [e.text for e in g.expression]
if load_all:
ret.append(GraphDefinition(name, e, g.description.text, expressions, filename))
continue
if have_graph(name):
continue
for e in expressions:
if expression_ok(e):
ret.append(GraphDefinition(name, e, g.description.text, expressions, filename))
break
return ret | python | def load_graph_xml(xml, filename, load_all=False):
'''load a graph from one xml string'''
ret = []
try:
root = objectify.fromstring(xml)
except Exception:
return []
if root.tag != 'graphs':
return []
if not hasattr(root, 'graph'):
return []
for g in root.graph:
name = g.attrib['name']
expressions = [e.text for e in g.expression]
if load_all:
ret.append(GraphDefinition(name, e, g.description.text, expressions, filename))
continue
if have_graph(name):
continue
for e in expressions:
if expression_ok(e):
ret.append(GraphDefinition(name, e, g.description.text, expressions, filename))
break
return ret | [
"def",
"load_graph_xml",
"(",
"xml",
",",
"filename",
",",
"load_all",
"=",
"False",
")",
":",
"ret",
"=",
"[",
"]",
"try",
":",
"root",
"=",
"objectify",
".",
"fromstring",
"(",
"xml",
")",
"except",
"Exception",
":",
"return",
"[",
"]",
"if",
"root",
".",
"tag",
"!=",
"'graphs'",
":",
"return",
"[",
"]",
"if",
"not",
"hasattr",
"(",
"root",
",",
"'graph'",
")",
":",
"return",
"[",
"]",
"for",
"g",
"in",
"root",
".",
"graph",
":",
"name",
"=",
"g",
".",
"attrib",
"[",
"'name'",
"]",
"expressions",
"=",
"[",
"e",
".",
"text",
"for",
"e",
"in",
"g",
".",
"expression",
"]",
"if",
"load_all",
":",
"ret",
".",
"append",
"(",
"GraphDefinition",
"(",
"name",
",",
"e",
",",
"g",
".",
"description",
".",
"text",
",",
"expressions",
",",
"filename",
")",
")",
"continue",
"if",
"have_graph",
"(",
"name",
")",
":",
"continue",
"for",
"e",
"in",
"expressions",
":",
"if",
"expression_ok",
"(",
"e",
")",
":",
"ret",
".",
"append",
"(",
"GraphDefinition",
"(",
"name",
",",
"e",
",",
"g",
".",
"description",
".",
"text",
",",
"expressions",
",",
"filename",
")",
")",
"break",
"return",
"ret"
] | load a graph from one xml string | [
"load",
"a",
"graph",
"from",
"one",
"xml",
"string"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L144-L167 |
248,955 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py | cmd_condition | def cmd_condition(args):
'''control MAVExporer conditions'''
if len(args) == 0:
print("condition is: %s" % mestate.settings.condition)
return
mestate.settings.condition = ' '.join(args)
if len(mestate.settings.condition) == 0 or mestate.settings.condition == 'clear':
mestate.settings.condition = None | python | def cmd_condition(args):
'''control MAVExporer conditions'''
if len(args) == 0:
print("condition is: %s" % mestate.settings.condition)
return
mestate.settings.condition = ' '.join(args)
if len(mestate.settings.condition) == 0 or mestate.settings.condition == 'clear':
mestate.settings.condition = None | [
"def",
"cmd_condition",
"(",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"print",
"(",
"\"condition is: %s\"",
"%",
"mestate",
".",
"settings",
".",
"condition",
")",
"return",
"mestate",
".",
"settings",
".",
"condition",
"=",
"' '",
".",
"join",
"(",
"args",
")",
"if",
"len",
"(",
"mestate",
".",
"settings",
".",
"condition",
")",
"==",
"0",
"or",
"mestate",
".",
"settings",
".",
"condition",
"==",
"'clear'",
":",
"mestate",
".",
"settings",
".",
"condition",
"=",
"None"
] | control MAVExporer conditions | [
"control",
"MAVExporer",
"conditions"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L260-L267 |
248,956 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ualberta.py | MAVLink.ualberta_sys_status_send | def ualberta_sys_status_send(self, mode, nav_mode, pilot, force_mavlink1=False):
'''
System status specific to ualberta uav
mode : System mode, see UALBERTA_AUTOPILOT_MODE ENUM (uint8_t)
nav_mode : Navigation mode, see UALBERTA_NAV_MODE ENUM (uint8_t)
pilot : Pilot mode, see UALBERTA_PILOT_MODE (uint8_t)
'''
return self.send(self.ualberta_sys_status_encode(mode, nav_mode, pilot), force_mavlink1=force_mavlink1) | python | def ualberta_sys_status_send(self, mode, nav_mode, pilot, force_mavlink1=False):
'''
System status specific to ualberta uav
mode : System mode, see UALBERTA_AUTOPILOT_MODE ENUM (uint8_t)
nav_mode : Navigation mode, see UALBERTA_NAV_MODE ENUM (uint8_t)
pilot : Pilot mode, see UALBERTA_PILOT_MODE (uint8_t)
'''
return self.send(self.ualberta_sys_status_encode(mode, nav_mode, pilot), force_mavlink1=force_mavlink1) | [
"def",
"ualberta_sys_status_send",
"(",
"self",
",",
"mode",
",",
"nav_mode",
",",
"pilot",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"ualberta_sys_status_encode",
"(",
"mode",
",",
"nav_mode",
",",
"pilot",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | System status specific to ualberta uav
mode : System mode, see UALBERTA_AUTOPILOT_MODE ENUM (uint8_t)
nav_mode : Navigation mode, see UALBERTA_NAV_MODE ENUM (uint8_t)
pilot : Pilot mode, see UALBERTA_PILOT_MODE (uint8_t) | [
"System",
"status",
"specific",
"to",
"ualberta",
"uav"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ualberta.py#L7434-L7443 |
248,957 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ualberta.py | MAVLink.button_change_send | def button_change_send(self, time_boot_ms, last_change_ms, state, force_mavlink1=False):
'''
Report button state change
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
last_change_ms : Time of last change of button state (uint32_t)
state : Bitmap state of buttons (uint8_t)
'''
return self.send(self.button_change_encode(time_boot_ms, last_change_ms, state), force_mavlink1=force_mavlink1) | python | def button_change_send(self, time_boot_ms, last_change_ms, state, force_mavlink1=False):
'''
Report button state change
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
last_change_ms : Time of last change of button state (uint32_t)
state : Bitmap state of buttons (uint8_t)
'''
return self.send(self.button_change_encode(time_boot_ms, last_change_ms, state), force_mavlink1=force_mavlink1) | [
"def",
"button_change_send",
"(",
"self",
",",
"time_boot_ms",
",",
"last_change_ms",
",",
"state",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"button_change_encode",
"(",
"time_boot_ms",
",",
"last_change_ms",
",",
"state",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Report button state change
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
last_change_ms : Time of last change of button state (uint32_t)
state : Bitmap state of buttons (uint8_t) | [
"Report",
"button",
"state",
"change"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ualberta.py#L12186-L12195 |
248,958 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/lib/ANUGA/redfearn.py | convert_from_latlon_to_utm | def convert_from_latlon_to_utm(points=None,
latitudes=None,
longitudes=None,
false_easting=None,
false_northing=None):
"""Convert latitude and longitude data to UTM as a list of coordinates.
Input
points: list of points given in decimal degrees (latitude, longitude) or
latitudes: list of latitudes and
longitudes: list of longitudes
false_easting (optional)
false_northing (optional)
Output
points: List of converted points
zone: Common UTM zone for converted points
Notes
Assume the false_easting and false_northing are the same for each list.
If points end up in different UTM zones, an ANUGAerror is thrown.
"""
old_geo = Geo_reference()
utm_points = []
if points == None:
assert len(latitudes) == len(longitudes)
points = map(None, latitudes, longitudes)
for point in points:
zone, easting, northing = redfearn(float(point[0]),
float(point[1]),
false_easting=false_easting,
false_northing=false_northing)
new_geo = Geo_reference(zone)
old_geo.reconcile_zones(new_geo)
utm_points.append([easting, northing])
return utm_points, old_geo.get_zone() | python | def convert_from_latlon_to_utm(points=None,
latitudes=None,
longitudes=None,
false_easting=None,
false_northing=None):
old_geo = Geo_reference()
utm_points = []
if points == None:
assert len(latitudes) == len(longitudes)
points = map(None, latitudes, longitudes)
for point in points:
zone, easting, northing = redfearn(float(point[0]),
float(point[1]),
false_easting=false_easting,
false_northing=false_northing)
new_geo = Geo_reference(zone)
old_geo.reconcile_zones(new_geo)
utm_points.append([easting, northing])
return utm_points, old_geo.get_zone() | [
"def",
"convert_from_latlon_to_utm",
"(",
"points",
"=",
"None",
",",
"latitudes",
"=",
"None",
",",
"longitudes",
"=",
"None",
",",
"false_easting",
"=",
"None",
",",
"false_northing",
"=",
"None",
")",
":",
"old_geo",
"=",
"Geo_reference",
"(",
")",
"utm_points",
"=",
"[",
"]",
"if",
"points",
"==",
"None",
":",
"assert",
"len",
"(",
"latitudes",
")",
"==",
"len",
"(",
"longitudes",
")",
"points",
"=",
"map",
"(",
"None",
",",
"latitudes",
",",
"longitudes",
")",
"for",
"point",
"in",
"points",
":",
"zone",
",",
"easting",
",",
"northing",
"=",
"redfearn",
"(",
"float",
"(",
"point",
"[",
"0",
"]",
")",
",",
"float",
"(",
"point",
"[",
"1",
"]",
")",
",",
"false_easting",
"=",
"false_easting",
",",
"false_northing",
"=",
"false_northing",
")",
"new_geo",
"=",
"Geo_reference",
"(",
"zone",
")",
"old_geo",
".",
"reconcile_zones",
"(",
"new_geo",
")",
"utm_points",
".",
"append",
"(",
"[",
"easting",
",",
"northing",
"]",
")",
"return",
"utm_points",
",",
"old_geo",
".",
"get_zone",
"(",
")"
] | Convert latitude and longitude data to UTM as a list of coordinates.
Input
points: list of points given in decimal degrees (latitude, longitude) or
latitudes: list of latitudes and
longitudes: list of longitudes
false_easting (optional)
false_northing (optional)
Output
points: List of converted points
zone: Common UTM zone for converted points
Notes
Assume the false_easting and false_northing are the same for each list.
If points end up in different UTM zones, an ANUGAerror is thrown. | [
"Convert",
"latitude",
"and",
"longitude",
"data",
"to",
"UTM",
"as",
"a",
"list",
"of",
"coordinates",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/ANUGA/redfearn.py#L199-L243 |
248,959 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/quaternion.py | QuaternionBase.dcm | def dcm(self):
"""
Get the DCM
:returns: 3x3 array
"""
if self._dcm is None:
if self._q is not None:
# try to get dcm from q
self._dcm = self._q_to_dcm(self.q)
elif self._euler is not None:
# try to get get dcm from euler
self._dcm = self._euler_to_dcm(self._euler)
return self._dcm | python | def dcm(self):
if self._dcm is None:
if self._q is not None:
# try to get dcm from q
self._dcm = self._q_to_dcm(self.q)
elif self._euler is not None:
# try to get get dcm from euler
self._dcm = self._euler_to_dcm(self._euler)
return self._dcm | [
"def",
"dcm",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dcm",
"is",
"None",
":",
"if",
"self",
".",
"_q",
"is",
"not",
"None",
":",
"# try to get dcm from q",
"self",
".",
"_dcm",
"=",
"self",
".",
"_q_to_dcm",
"(",
"self",
".",
"q",
")",
"elif",
"self",
".",
"_euler",
"is",
"not",
"None",
":",
"# try to get get dcm from euler",
"self",
".",
"_dcm",
"=",
"self",
".",
"_euler_to_dcm",
"(",
"self",
".",
"_euler",
")",
"return",
"self",
".",
"_dcm"
] | Get the DCM
:returns: 3x3 array | [
"Get",
"the",
"DCM"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/quaternion.py#L128-L141 |
248,960 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavgpslock.py | lock_time | def lock_time(logfile):
'''work out gps lock times for a log file'''
print("Processing log %s" % filename)
mlog = mavutil.mavlink_connection(filename)
locked = False
start_time = 0.0
total_time = 0.0
t = None
m = mlog.recv_match(type=['GPS_RAW_INT','GPS_RAW'], condition=args.condition)
if m is None:
return 0
unlock_time = time.mktime(time.localtime(m._timestamp))
while True:
m = mlog.recv_match(type=['GPS_RAW_INT','GPS_RAW'], condition=args.condition)
if m is None:
if locked:
total_time += time.mktime(t) - start_time
if total_time > 0:
print("Lock time : %u:%02u" % (int(total_time)/60, int(total_time)%60))
return total_time
t = time.localtime(m._timestamp)
if m.fix_type >= 2 and not locked:
print("Locked at %s after %u seconds" % (time.asctime(t),
time.mktime(t) - unlock_time))
locked = True
start_time = time.mktime(t)
elif m.fix_type == 1 and locked:
print("Lost GPS lock at %s" % time.asctime(t))
locked = False
total_time += time.mktime(t) - start_time
unlock_time = time.mktime(t)
elif m.fix_type == 0 and locked:
print("Lost protocol lock at %s" % time.asctime(t))
locked = False
total_time += time.mktime(t) - start_time
unlock_time = time.mktime(t)
return total_time | python | def lock_time(logfile):
'''work out gps lock times for a log file'''
print("Processing log %s" % filename)
mlog = mavutil.mavlink_connection(filename)
locked = False
start_time = 0.0
total_time = 0.0
t = None
m = mlog.recv_match(type=['GPS_RAW_INT','GPS_RAW'], condition=args.condition)
if m is None:
return 0
unlock_time = time.mktime(time.localtime(m._timestamp))
while True:
m = mlog.recv_match(type=['GPS_RAW_INT','GPS_RAW'], condition=args.condition)
if m is None:
if locked:
total_time += time.mktime(t) - start_time
if total_time > 0:
print("Lock time : %u:%02u" % (int(total_time)/60, int(total_time)%60))
return total_time
t = time.localtime(m._timestamp)
if m.fix_type >= 2 and not locked:
print("Locked at %s after %u seconds" % (time.asctime(t),
time.mktime(t) - unlock_time))
locked = True
start_time = time.mktime(t)
elif m.fix_type == 1 and locked:
print("Lost GPS lock at %s" % time.asctime(t))
locked = False
total_time += time.mktime(t) - start_time
unlock_time = time.mktime(t)
elif m.fix_type == 0 and locked:
print("Lost protocol lock at %s" % time.asctime(t))
locked = False
total_time += time.mktime(t) - start_time
unlock_time = time.mktime(t)
return total_time | [
"def",
"lock_time",
"(",
"logfile",
")",
":",
"print",
"(",
"\"Processing log %s\"",
"%",
"filename",
")",
"mlog",
"=",
"mavutil",
".",
"mavlink_connection",
"(",
"filename",
")",
"locked",
"=",
"False",
"start_time",
"=",
"0.0",
"total_time",
"=",
"0.0",
"t",
"=",
"None",
"m",
"=",
"mlog",
".",
"recv_match",
"(",
"type",
"=",
"[",
"'GPS_RAW_INT'",
",",
"'GPS_RAW'",
"]",
",",
"condition",
"=",
"args",
".",
"condition",
")",
"if",
"m",
"is",
"None",
":",
"return",
"0",
"unlock_time",
"=",
"time",
".",
"mktime",
"(",
"time",
".",
"localtime",
"(",
"m",
".",
"_timestamp",
")",
")",
"while",
"True",
":",
"m",
"=",
"mlog",
".",
"recv_match",
"(",
"type",
"=",
"[",
"'GPS_RAW_INT'",
",",
"'GPS_RAW'",
"]",
",",
"condition",
"=",
"args",
".",
"condition",
")",
"if",
"m",
"is",
"None",
":",
"if",
"locked",
":",
"total_time",
"+=",
"time",
".",
"mktime",
"(",
"t",
")",
"-",
"start_time",
"if",
"total_time",
">",
"0",
":",
"print",
"(",
"\"Lock time : %u:%02u\"",
"%",
"(",
"int",
"(",
"total_time",
")",
"/",
"60",
",",
"int",
"(",
"total_time",
")",
"%",
"60",
")",
")",
"return",
"total_time",
"t",
"=",
"time",
".",
"localtime",
"(",
"m",
".",
"_timestamp",
")",
"if",
"m",
".",
"fix_type",
">=",
"2",
"and",
"not",
"locked",
":",
"print",
"(",
"\"Locked at %s after %u seconds\"",
"%",
"(",
"time",
".",
"asctime",
"(",
"t",
")",
",",
"time",
".",
"mktime",
"(",
"t",
")",
"-",
"unlock_time",
")",
")",
"locked",
"=",
"True",
"start_time",
"=",
"time",
".",
"mktime",
"(",
"t",
")",
"elif",
"m",
".",
"fix_type",
"==",
"1",
"and",
"locked",
":",
"print",
"(",
"\"Lost GPS lock at %s\"",
"%",
"time",
".",
"asctime",
"(",
"t",
")",
")",
"locked",
"=",
"False",
"total_time",
"+=",
"time",
".",
"mktime",
"(",
"t",
")",
"-",
"start_time",
"unlock_time",
"=",
"time",
".",
"mktime",
"(",
"t",
")",
"elif",
"m",
".",
"fix_type",
"==",
"0",
"and",
"locked",
":",
"print",
"(",
"\"Lost protocol lock at %s\"",
"%",
"time",
".",
"asctime",
"(",
"t",
")",
")",
"locked",
"=",
"False",
"total_time",
"+=",
"time",
".",
"mktime",
"(",
"t",
")",
"-",
"start_time",
"unlock_time",
"=",
"time",
".",
"mktime",
"(",
"t",
")",
"return",
"total_time"
] | work out gps lock times for a log file | [
"work",
"out",
"gps",
"lock",
"times",
"for",
"a",
"log",
"file"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavgpslock.py#L19-L58 |
248,961 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapFrame.on_menu | def on_menu(self, event):
'''handle menu selection'''
state = self.state
# see if it is a popup menu
if state.popup_object is not None:
obj = state.popup_object
ret = obj.popup_menu.find_selected(event)
if ret is not None:
ret.call_handler()
state.event_queue.put(SlipMenuEvent(state.popup_latlon, event,
[SlipObjectSelection(obj.key, 0, obj.layer, obj.selection_info())],
ret))
state.popup_object = None
state.popup_latlon = None
if state.default_popup is not None:
ret = state.default_popup.popup.find_selected(event)
if ret is not None:
ret.call_handler()
state.event_queue.put(SlipMenuEvent(state.popup_latlon, event, [], ret))
# otherwise a normal menu
ret = self.menu.find_selected(event)
if ret is None:
return
ret.call_handler()
if ret.returnkey == 'toggleGrid':
state.grid = ret.IsChecked()
elif ret.returnkey == 'toggleFollow':
state.follow = ret.IsChecked()
elif ret.returnkey == 'toggleDownload':
state.download = ret.IsChecked()
elif ret.returnkey == 'setService':
state.mt.set_service(ret.get_choice())
elif ret.returnkey == 'gotoPosition':
state.panel.enter_position()
elif ret.returnkey == 'increaseBrightness':
state.brightness *= 1.25
elif ret.returnkey == 'decreaseBrightness':
state.brightness /= 1.25
state.need_redraw = True | python | def on_menu(self, event):
'''handle menu selection'''
state = self.state
# see if it is a popup menu
if state.popup_object is not None:
obj = state.popup_object
ret = obj.popup_menu.find_selected(event)
if ret is not None:
ret.call_handler()
state.event_queue.put(SlipMenuEvent(state.popup_latlon, event,
[SlipObjectSelection(obj.key, 0, obj.layer, obj.selection_info())],
ret))
state.popup_object = None
state.popup_latlon = None
if state.default_popup is not None:
ret = state.default_popup.popup.find_selected(event)
if ret is not None:
ret.call_handler()
state.event_queue.put(SlipMenuEvent(state.popup_latlon, event, [], ret))
# otherwise a normal menu
ret = self.menu.find_selected(event)
if ret is None:
return
ret.call_handler()
if ret.returnkey == 'toggleGrid':
state.grid = ret.IsChecked()
elif ret.returnkey == 'toggleFollow':
state.follow = ret.IsChecked()
elif ret.returnkey == 'toggleDownload':
state.download = ret.IsChecked()
elif ret.returnkey == 'setService':
state.mt.set_service(ret.get_choice())
elif ret.returnkey == 'gotoPosition':
state.panel.enter_position()
elif ret.returnkey == 'increaseBrightness':
state.brightness *= 1.25
elif ret.returnkey == 'decreaseBrightness':
state.brightness /= 1.25
state.need_redraw = True | [
"def",
"on_menu",
"(",
"self",
",",
"event",
")",
":",
"state",
"=",
"self",
".",
"state",
"# see if it is a popup menu",
"if",
"state",
".",
"popup_object",
"is",
"not",
"None",
":",
"obj",
"=",
"state",
".",
"popup_object",
"ret",
"=",
"obj",
".",
"popup_menu",
".",
"find_selected",
"(",
"event",
")",
"if",
"ret",
"is",
"not",
"None",
":",
"ret",
".",
"call_handler",
"(",
")",
"state",
".",
"event_queue",
".",
"put",
"(",
"SlipMenuEvent",
"(",
"state",
".",
"popup_latlon",
",",
"event",
",",
"[",
"SlipObjectSelection",
"(",
"obj",
".",
"key",
",",
"0",
",",
"obj",
".",
"layer",
",",
"obj",
".",
"selection_info",
"(",
")",
")",
"]",
",",
"ret",
")",
")",
"state",
".",
"popup_object",
"=",
"None",
"state",
".",
"popup_latlon",
"=",
"None",
"if",
"state",
".",
"default_popup",
"is",
"not",
"None",
":",
"ret",
"=",
"state",
".",
"default_popup",
".",
"popup",
".",
"find_selected",
"(",
"event",
")",
"if",
"ret",
"is",
"not",
"None",
":",
"ret",
".",
"call_handler",
"(",
")",
"state",
".",
"event_queue",
".",
"put",
"(",
"SlipMenuEvent",
"(",
"state",
".",
"popup_latlon",
",",
"event",
",",
"[",
"]",
",",
"ret",
")",
")",
"# otherwise a normal menu",
"ret",
"=",
"self",
".",
"menu",
".",
"find_selected",
"(",
"event",
")",
"if",
"ret",
"is",
"None",
":",
"return",
"ret",
".",
"call_handler",
"(",
")",
"if",
"ret",
".",
"returnkey",
"==",
"'toggleGrid'",
":",
"state",
".",
"grid",
"=",
"ret",
".",
"IsChecked",
"(",
")",
"elif",
"ret",
".",
"returnkey",
"==",
"'toggleFollow'",
":",
"state",
".",
"follow",
"=",
"ret",
".",
"IsChecked",
"(",
")",
"elif",
"ret",
".",
"returnkey",
"==",
"'toggleDownload'",
":",
"state",
".",
"download",
"=",
"ret",
".",
"IsChecked",
"(",
")",
"elif",
"ret",
".",
"returnkey",
"==",
"'setService'",
":",
"state",
".",
"mt",
".",
"set_service",
"(",
"ret",
".",
"get_choice",
"(",
")",
")",
"elif",
"ret",
".",
"returnkey",
"==",
"'gotoPosition'",
":",
"state",
".",
"panel",
".",
"enter_position",
"(",
")",
"elif",
"ret",
".",
"returnkey",
"==",
"'increaseBrightness'",
":",
"state",
".",
"brightness",
"*=",
"1.25",
"elif",
"ret",
".",
"returnkey",
"==",
"'decreaseBrightness'",
":",
"state",
".",
"brightness",
"/=",
"1.25",
"state",
".",
"need_redraw",
"=",
"True"
] | handle menu selection | [
"handle",
"menu",
"selection"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L49-L88 |
248,962 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapFrame.follow | def follow(self, object):
'''follow an object on the map'''
state = self.state
(px,py) = state.panel.pixmapper(object.latlon)
ratio = 0.25
if (px > ratio*state.width and
px < (1.0-ratio)*state.width and
py > ratio*state.height and
py < (1.0-ratio)*state.height):
# we're in the mid part of the map already, don't move
return
if not state.follow:
# the user has disabled following
return
(lat, lon) = object.latlon
state.panel.re_center(state.width/2, state.height/2, lat, lon) | python | def follow(self, object):
'''follow an object on the map'''
state = self.state
(px,py) = state.panel.pixmapper(object.latlon)
ratio = 0.25
if (px > ratio*state.width and
px < (1.0-ratio)*state.width and
py > ratio*state.height and
py < (1.0-ratio)*state.height):
# we're in the mid part of the map already, don't move
return
if not state.follow:
# the user has disabled following
return
(lat, lon) = object.latlon
state.panel.re_center(state.width/2, state.height/2, lat, lon) | [
"def",
"follow",
"(",
"self",
",",
"object",
")",
":",
"state",
"=",
"self",
".",
"state",
"(",
"px",
",",
"py",
")",
"=",
"state",
".",
"panel",
".",
"pixmapper",
"(",
"object",
".",
"latlon",
")",
"ratio",
"=",
"0.25",
"if",
"(",
"px",
">",
"ratio",
"*",
"state",
".",
"width",
"and",
"px",
"<",
"(",
"1.0",
"-",
"ratio",
")",
"*",
"state",
".",
"width",
"and",
"py",
">",
"ratio",
"*",
"state",
".",
"height",
"and",
"py",
"<",
"(",
"1.0",
"-",
"ratio",
")",
"*",
"state",
".",
"height",
")",
":",
"# we're in the mid part of the map already, don't move",
"return",
"if",
"not",
"state",
".",
"follow",
":",
"# the user has disabled following",
"return",
"(",
"lat",
",",
"lon",
")",
"=",
"object",
".",
"latlon",
"state",
".",
"panel",
".",
"re_center",
"(",
"state",
".",
"width",
"/",
"2",
",",
"state",
".",
"height",
"/",
"2",
",",
"lat",
",",
"lon",
")"
] | follow an object on the map | [
"follow",
"an",
"object",
"on",
"the",
"map"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L101-L118 |
248,963 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapFrame.add_object | def add_object(self, obj):
'''add an object to a later'''
state = self.state
if not obj.layer in state.layers:
# its a new layer
state.layers[obj.layer] = {}
state.layers[obj.layer][obj.key] = obj
state.need_redraw = True | python | def add_object(self, obj):
'''add an object to a later'''
state = self.state
if not obj.layer in state.layers:
# its a new layer
state.layers[obj.layer] = {}
state.layers[obj.layer][obj.key] = obj
state.need_redraw = True | [
"def",
"add_object",
"(",
"self",
",",
"obj",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"not",
"obj",
".",
"layer",
"in",
"state",
".",
"layers",
":",
"# its a new layer",
"state",
".",
"layers",
"[",
"obj",
".",
"layer",
"]",
"=",
"{",
"}",
"state",
".",
"layers",
"[",
"obj",
".",
"layer",
"]",
"[",
"obj",
".",
"key",
"]",
"=",
"obj",
"state",
".",
"need_redraw",
"=",
"True"
] | add an object to a later | [
"add",
"an",
"object",
"to",
"a",
"later"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L120-L127 |
248,964 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapFrame.remove_object | def remove_object(self, key):
'''remove an object by key from all layers'''
state = self.state
for layer in state.layers:
state.layers[layer].pop(key, None)
state.need_redraw = True | python | def remove_object(self, key):
'''remove an object by key from all layers'''
state = self.state
for layer in state.layers:
state.layers[layer].pop(key, None)
state.need_redraw = True | [
"def",
"remove_object",
"(",
"self",
",",
"key",
")",
":",
"state",
"=",
"self",
".",
"state",
"for",
"layer",
"in",
"state",
".",
"layers",
":",
"state",
".",
"layers",
"[",
"layer",
"]",
".",
"pop",
"(",
"key",
",",
"None",
")",
"state",
".",
"need_redraw",
"=",
"True"
] | remove an object by key from all layers | [
"remove",
"an",
"object",
"by",
"key",
"from",
"all",
"layers"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L129-L134 |
248,965 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.current_view | def current_view(self):
'''return a tuple representing the current view'''
state = self.state
return (state.lat, state.lon, state.width, state.height,
state.ground_width, state.mt.tiles_pending()) | python | def current_view(self):
'''return a tuple representing the current view'''
state = self.state
return (state.lat, state.lon, state.width, state.height,
state.ground_width, state.mt.tiles_pending()) | [
"def",
"current_view",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"state",
"return",
"(",
"state",
".",
"lat",
",",
"state",
".",
"lon",
",",
"state",
".",
"width",
",",
"state",
".",
"height",
",",
"state",
".",
"ground_width",
",",
"state",
".",
"mt",
".",
"tiles_pending",
"(",
")",
")"
] | return a tuple representing the current view | [
"return",
"a",
"tuple",
"representing",
"the",
"current",
"view"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L276-L280 |
248,966 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.coordinates | def coordinates(self, x, y):
'''return coordinates of a pixel in the map'''
state = self.state
return state.mt.coord_from_area(x, y, state.lat, state.lon, state.width, state.ground_width) | python | def coordinates(self, x, y):
'''return coordinates of a pixel in the map'''
state = self.state
return state.mt.coord_from_area(x, y, state.lat, state.lon, state.width, state.ground_width) | [
"def",
"coordinates",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"state",
"=",
"self",
".",
"state",
"return",
"state",
".",
"mt",
".",
"coord_from_area",
"(",
"x",
",",
"y",
",",
"state",
".",
"lat",
",",
"state",
".",
"lon",
",",
"state",
".",
"width",
",",
"state",
".",
"ground_width",
")"
] | return coordinates of a pixel in the map | [
"return",
"coordinates",
"of",
"a",
"pixel",
"in",
"the",
"map"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L282-L285 |
248,967 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.re_center | def re_center(self, x, y, lat, lon):
'''re-center view for pixel x,y'''
state = self.state
if lat is None or lon is None:
return
(lat2,lon2) = self.coordinates(x, y)
distance = mp_util.gps_distance(lat2, lon2, lat, lon)
bearing = mp_util.gps_bearing(lat2, lon2, lat, lon)
(state.lat, state.lon) = mp_util.gps_newpos(state.lat, state.lon, bearing, distance) | python | def re_center(self, x, y, lat, lon):
'''re-center view for pixel x,y'''
state = self.state
if lat is None or lon is None:
return
(lat2,lon2) = self.coordinates(x, y)
distance = mp_util.gps_distance(lat2, lon2, lat, lon)
bearing = mp_util.gps_bearing(lat2, lon2, lat, lon)
(state.lat, state.lon) = mp_util.gps_newpos(state.lat, state.lon, bearing, distance) | [
"def",
"re_center",
"(",
"self",
",",
"x",
",",
"y",
",",
"lat",
",",
"lon",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"lat",
"is",
"None",
"or",
"lon",
"is",
"None",
":",
"return",
"(",
"lat2",
",",
"lon2",
")",
"=",
"self",
".",
"coordinates",
"(",
"x",
",",
"y",
")",
"distance",
"=",
"mp_util",
".",
"gps_distance",
"(",
"lat2",
",",
"lon2",
",",
"lat",
",",
"lon",
")",
"bearing",
"=",
"mp_util",
".",
"gps_bearing",
"(",
"lat2",
",",
"lon2",
",",
"lat",
",",
"lon",
")",
"(",
"state",
".",
"lat",
",",
"state",
".",
"lon",
")",
"=",
"mp_util",
".",
"gps_newpos",
"(",
"state",
".",
"lat",
",",
"state",
".",
"lon",
",",
"bearing",
",",
"distance",
")"
] | re-center view for pixel x,y | [
"re",
"-",
"center",
"view",
"for",
"pixel",
"x",
"y"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L287-L295 |
248,968 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.change_zoom | def change_zoom(self, zoom):
'''zoom in or out by zoom factor, keeping centered'''
state = self.state
if self.mouse_pos:
(x,y) = (self.mouse_pos.x, self.mouse_pos.y)
else:
(x,y) = (state.width/2, state.height/2)
(lat,lon) = self.coordinates(x, y)
state.ground_width *= zoom
# limit ground_width to sane values
state.ground_width = max(state.ground_width, 20)
state.ground_width = min(state.ground_width, 20000000)
self.re_center(x,y, lat, lon) | python | def change_zoom(self, zoom):
'''zoom in or out by zoom factor, keeping centered'''
state = self.state
if self.mouse_pos:
(x,y) = (self.mouse_pos.x, self.mouse_pos.y)
else:
(x,y) = (state.width/2, state.height/2)
(lat,lon) = self.coordinates(x, y)
state.ground_width *= zoom
# limit ground_width to sane values
state.ground_width = max(state.ground_width, 20)
state.ground_width = min(state.ground_width, 20000000)
self.re_center(x,y, lat, lon) | [
"def",
"change_zoom",
"(",
"self",
",",
"zoom",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"self",
".",
"mouse_pos",
":",
"(",
"x",
",",
"y",
")",
"=",
"(",
"self",
".",
"mouse_pos",
".",
"x",
",",
"self",
".",
"mouse_pos",
".",
"y",
")",
"else",
":",
"(",
"x",
",",
"y",
")",
"=",
"(",
"state",
".",
"width",
"/",
"2",
",",
"state",
".",
"height",
"/",
"2",
")",
"(",
"lat",
",",
"lon",
")",
"=",
"self",
".",
"coordinates",
"(",
"x",
",",
"y",
")",
"state",
".",
"ground_width",
"*=",
"zoom",
"# limit ground_width to sane values",
"state",
".",
"ground_width",
"=",
"max",
"(",
"state",
".",
"ground_width",
",",
"20",
")",
"state",
".",
"ground_width",
"=",
"min",
"(",
"state",
".",
"ground_width",
",",
"20000000",
")",
"self",
".",
"re_center",
"(",
"x",
",",
"y",
",",
"lat",
",",
"lon",
")"
] | zoom in or out by zoom factor, keeping centered | [
"zoom",
"in",
"or",
"out",
"by",
"zoom",
"factor",
"keeping",
"centered"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L297-L309 |
248,969 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.enter_position | def enter_position(self):
'''enter new position'''
state = self.state
dlg = wx.TextEntryDialog(self, 'Enter new position', 'Position')
dlg.SetValue("%f %f" % (state.lat, state.lon))
if dlg.ShowModal() == wx.ID_OK:
latlon = dlg.GetValue().split()
dlg.Destroy()
state.lat = float(latlon[0])
state.lon = float(latlon[1])
self.re_center(state.width/2,state.height/2, state.lat, state.lon)
self.redraw_map() | python | def enter_position(self):
'''enter new position'''
state = self.state
dlg = wx.TextEntryDialog(self, 'Enter new position', 'Position')
dlg.SetValue("%f %f" % (state.lat, state.lon))
if dlg.ShowModal() == wx.ID_OK:
latlon = dlg.GetValue().split()
dlg.Destroy()
state.lat = float(latlon[0])
state.lon = float(latlon[1])
self.re_center(state.width/2,state.height/2, state.lat, state.lon)
self.redraw_map() | [
"def",
"enter_position",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"state",
"dlg",
"=",
"wx",
".",
"TextEntryDialog",
"(",
"self",
",",
"'Enter new position'",
",",
"'Position'",
")",
"dlg",
".",
"SetValue",
"(",
"\"%f %f\"",
"%",
"(",
"state",
".",
"lat",
",",
"state",
".",
"lon",
")",
")",
"if",
"dlg",
".",
"ShowModal",
"(",
")",
"==",
"wx",
".",
"ID_OK",
":",
"latlon",
"=",
"dlg",
".",
"GetValue",
"(",
")",
".",
"split",
"(",
")",
"dlg",
".",
"Destroy",
"(",
")",
"state",
".",
"lat",
"=",
"float",
"(",
"latlon",
"[",
"0",
"]",
")",
"state",
".",
"lon",
"=",
"float",
"(",
"latlon",
"[",
"1",
"]",
")",
"self",
".",
"re_center",
"(",
"state",
".",
"width",
"/",
"2",
",",
"state",
".",
"height",
"/",
"2",
",",
"state",
".",
"lat",
",",
"state",
".",
"lon",
")",
"self",
".",
"redraw_map",
"(",
")"
] | enter new position | [
"enter",
"new",
"position"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L311-L322 |
248,970 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.update_position | def update_position(self):
'''update position text'''
state = self.state
pos = self.mouse_pos
newtext = ''
alt = 0
if pos is not None:
(lat,lon) = self.coordinates(pos.x, pos.y)
newtext += 'Cursor: %f %f (%s)' % (lat, lon, mp_util.latlon_to_grid((lat, lon)))
if state.elevation:
alt = self.ElevationMap.GetElevation(lat, lon)
if alt is not None:
newtext += ' %.1fm' % alt
state.mt.set_download(state.download)
pending = 0
if state.download:
pending = state.mt.tiles_pending()
if pending:
newtext += ' Map Downloading %u ' % pending
if alt == -1:
newtext += ' SRTM Downloading '
newtext += '\n'
if self.click_pos is not None:
newtext += 'Click: %f %f (%s %s) (%s)' % (self.click_pos[0], self.click_pos[1],
mp_util.degrees_to_dms(self.click_pos[0]),
mp_util.degrees_to_dms(self.click_pos[1]),
mp_util.latlon_to_grid(self.click_pos))
if self.last_click_pos is not None:
distance = mp_util.gps_distance(self.last_click_pos[0], self.last_click_pos[1],
self.click_pos[0], self.click_pos[1])
bearing = mp_util.gps_bearing(self.last_click_pos[0], self.last_click_pos[1],
self.click_pos[0], self.click_pos[1])
newtext += ' Distance: %.1fm Bearing %.1f' % (distance, bearing)
if newtext != state.oldtext:
self.position.Clear()
self.position.WriteText(newtext)
state.oldtext = newtext | python | def update_position(self):
'''update position text'''
state = self.state
pos = self.mouse_pos
newtext = ''
alt = 0
if pos is not None:
(lat,lon) = self.coordinates(pos.x, pos.y)
newtext += 'Cursor: %f %f (%s)' % (lat, lon, mp_util.latlon_to_grid((lat, lon)))
if state.elevation:
alt = self.ElevationMap.GetElevation(lat, lon)
if alt is not None:
newtext += ' %.1fm' % alt
state.mt.set_download(state.download)
pending = 0
if state.download:
pending = state.mt.tiles_pending()
if pending:
newtext += ' Map Downloading %u ' % pending
if alt == -1:
newtext += ' SRTM Downloading '
newtext += '\n'
if self.click_pos is not None:
newtext += 'Click: %f %f (%s %s) (%s)' % (self.click_pos[0], self.click_pos[1],
mp_util.degrees_to_dms(self.click_pos[0]),
mp_util.degrees_to_dms(self.click_pos[1]),
mp_util.latlon_to_grid(self.click_pos))
if self.last_click_pos is not None:
distance = mp_util.gps_distance(self.last_click_pos[0], self.last_click_pos[1],
self.click_pos[0], self.click_pos[1])
bearing = mp_util.gps_bearing(self.last_click_pos[0], self.last_click_pos[1],
self.click_pos[0], self.click_pos[1])
newtext += ' Distance: %.1fm Bearing %.1f' % (distance, bearing)
if newtext != state.oldtext:
self.position.Clear()
self.position.WriteText(newtext)
state.oldtext = newtext | [
"def",
"update_position",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"state",
"pos",
"=",
"self",
".",
"mouse_pos",
"newtext",
"=",
"''",
"alt",
"=",
"0",
"if",
"pos",
"is",
"not",
"None",
":",
"(",
"lat",
",",
"lon",
")",
"=",
"self",
".",
"coordinates",
"(",
"pos",
".",
"x",
",",
"pos",
".",
"y",
")",
"newtext",
"+=",
"'Cursor: %f %f (%s)'",
"%",
"(",
"lat",
",",
"lon",
",",
"mp_util",
".",
"latlon_to_grid",
"(",
"(",
"lat",
",",
"lon",
")",
")",
")",
"if",
"state",
".",
"elevation",
":",
"alt",
"=",
"self",
".",
"ElevationMap",
".",
"GetElevation",
"(",
"lat",
",",
"lon",
")",
"if",
"alt",
"is",
"not",
"None",
":",
"newtext",
"+=",
"' %.1fm'",
"%",
"alt",
"state",
".",
"mt",
".",
"set_download",
"(",
"state",
".",
"download",
")",
"pending",
"=",
"0",
"if",
"state",
".",
"download",
":",
"pending",
"=",
"state",
".",
"mt",
".",
"tiles_pending",
"(",
")",
"if",
"pending",
":",
"newtext",
"+=",
"' Map Downloading %u '",
"%",
"pending",
"if",
"alt",
"==",
"-",
"1",
":",
"newtext",
"+=",
"' SRTM Downloading '",
"newtext",
"+=",
"'\\n'",
"if",
"self",
".",
"click_pos",
"is",
"not",
"None",
":",
"newtext",
"+=",
"'Click: %f %f (%s %s) (%s)'",
"%",
"(",
"self",
".",
"click_pos",
"[",
"0",
"]",
",",
"self",
".",
"click_pos",
"[",
"1",
"]",
",",
"mp_util",
".",
"degrees_to_dms",
"(",
"self",
".",
"click_pos",
"[",
"0",
"]",
")",
",",
"mp_util",
".",
"degrees_to_dms",
"(",
"self",
".",
"click_pos",
"[",
"1",
"]",
")",
",",
"mp_util",
".",
"latlon_to_grid",
"(",
"self",
".",
"click_pos",
")",
")",
"if",
"self",
".",
"last_click_pos",
"is",
"not",
"None",
":",
"distance",
"=",
"mp_util",
".",
"gps_distance",
"(",
"self",
".",
"last_click_pos",
"[",
"0",
"]",
",",
"self",
".",
"last_click_pos",
"[",
"1",
"]",
",",
"self",
".",
"click_pos",
"[",
"0",
"]",
",",
"self",
".",
"click_pos",
"[",
"1",
"]",
")",
"bearing",
"=",
"mp_util",
".",
"gps_bearing",
"(",
"self",
".",
"last_click_pos",
"[",
"0",
"]",
",",
"self",
".",
"last_click_pos",
"[",
"1",
"]",
",",
"self",
".",
"click_pos",
"[",
"0",
"]",
",",
"self",
".",
"click_pos",
"[",
"1",
"]",
")",
"newtext",
"+=",
"' Distance: %.1fm Bearing %.1f'",
"%",
"(",
"distance",
",",
"bearing",
")",
"if",
"newtext",
"!=",
"state",
".",
"oldtext",
":",
"self",
".",
"position",
".",
"Clear",
"(",
")",
"self",
".",
"position",
".",
"WriteText",
"(",
"newtext",
")",
"state",
".",
"oldtext",
"=",
"newtext"
] | update position text | [
"update",
"position",
"text"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L324-L360 |
248,971 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.selected_objects | def selected_objects(self, pos):
'''return a list of matching objects for a position'''
state = self.state
selected = []
(px, py) = pos
for layer in state.layers:
for key in state.layers[layer]:
obj = state.layers[layer][key]
distance = obj.clicked(px, py)
if distance is not None:
selected.append(SlipObjectSelection(key, distance, layer, extra_info=obj.selection_info()))
selected.sort(key=lambda c: c.distance)
return selected | python | def selected_objects(self, pos):
'''return a list of matching objects for a position'''
state = self.state
selected = []
(px, py) = pos
for layer in state.layers:
for key in state.layers[layer]:
obj = state.layers[layer][key]
distance = obj.clicked(px, py)
if distance is not None:
selected.append(SlipObjectSelection(key, distance, layer, extra_info=obj.selection_info()))
selected.sort(key=lambda c: c.distance)
return selected | [
"def",
"selected_objects",
"(",
"self",
",",
"pos",
")",
":",
"state",
"=",
"self",
".",
"state",
"selected",
"=",
"[",
"]",
"(",
"px",
",",
"py",
")",
"=",
"pos",
"for",
"layer",
"in",
"state",
".",
"layers",
":",
"for",
"key",
"in",
"state",
".",
"layers",
"[",
"layer",
"]",
":",
"obj",
"=",
"state",
".",
"layers",
"[",
"layer",
"]",
"[",
"key",
"]",
"distance",
"=",
"obj",
".",
"clicked",
"(",
"px",
",",
"py",
")",
"if",
"distance",
"is",
"not",
"None",
":",
"selected",
".",
"append",
"(",
"SlipObjectSelection",
"(",
"key",
",",
"distance",
",",
"layer",
",",
"extra_info",
"=",
"obj",
".",
"selection_info",
"(",
")",
")",
")",
"selected",
".",
"sort",
"(",
"key",
"=",
"lambda",
"c",
":",
"c",
".",
"distance",
")",
"return",
"selected"
] | return a list of matching objects for a position | [
"return",
"a",
"list",
"of",
"matching",
"objects",
"for",
"a",
"position"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L458-L470 |
248,972 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.show_default_popup | def show_default_popup(self, pos):
'''show default popup menu'''
state = self.state
if state.default_popup.popup is not None:
wx_menu = state.default_popup.popup.wx_menu()
state.frame.PopupMenu(wx_menu, pos) | python | def show_default_popup(self, pos):
'''show default popup menu'''
state = self.state
if state.default_popup.popup is not None:
wx_menu = state.default_popup.popup.wx_menu()
state.frame.PopupMenu(wx_menu, pos) | [
"def",
"show_default_popup",
"(",
"self",
",",
"pos",
")",
":",
"state",
"=",
"self",
".",
"state",
"if",
"state",
".",
"default_popup",
".",
"popup",
"is",
"not",
"None",
":",
"wx_menu",
"=",
"state",
".",
"default_popup",
".",
"popup",
".",
"wx_menu",
"(",
")",
"state",
".",
"frame",
".",
"PopupMenu",
"(",
"wx_menu",
",",
"pos",
")"
] | show default popup menu | [
"show",
"default",
"popup",
"menu"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L485-L490 |
248,973 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.clear_thumbnails | def clear_thumbnails(self):
'''clear all thumbnails from the map'''
state = self.state
for l in state.layers:
keys = state.layers[l].keys()[:]
for key in keys:
if (isinstance(state.layers[l][key], SlipThumbnail)
and not isinstance(state.layers[l][key], SlipIcon)):
state.layers[l].pop(key) | python | def clear_thumbnails(self):
'''clear all thumbnails from the map'''
state = self.state
for l in state.layers:
keys = state.layers[l].keys()[:]
for key in keys:
if (isinstance(state.layers[l][key], SlipThumbnail)
and not isinstance(state.layers[l][key], SlipIcon)):
state.layers[l].pop(key) | [
"def",
"clear_thumbnails",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"state",
"for",
"l",
"in",
"state",
".",
"layers",
":",
"keys",
"=",
"state",
".",
"layers",
"[",
"l",
"]",
".",
"keys",
"(",
")",
"[",
":",
"]",
"for",
"key",
"in",
"keys",
":",
"if",
"(",
"isinstance",
"(",
"state",
".",
"layers",
"[",
"l",
"]",
"[",
"key",
"]",
",",
"SlipThumbnail",
")",
"and",
"not",
"isinstance",
"(",
"state",
".",
"layers",
"[",
"l",
"]",
"[",
"key",
"]",
",",
"SlipIcon",
")",
")",
":",
"state",
".",
"layers",
"[",
"l",
"]",
".",
"pop",
"(",
"key",
")"
] | clear all thumbnails from the map | [
"clear",
"all",
"thumbnails",
"from",
"the",
"map"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L545-L553 |
248,974 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py | MPSlipMapPanel.on_key_down | def on_key_down(self, event):
'''handle keyboard input'''
state = self.state
# send all key events to the parent
if self.mouse_pos:
latlon = self.coordinates(self.mouse_pos.x, self.mouse_pos.y)
selected = self.selected_objects(self.mouse_pos)
state.event_queue.put(SlipKeyEvent(latlon, event, selected))
c = event.GetUniChar()
if c == ord('+') or (c == ord('=') and event.ShiftDown()):
self.change_zoom(1.0/1.2)
event.Skip()
elif c == ord('-'):
self.change_zoom(1.2)
event.Skip()
elif c == ord('G'):
self.enter_position()
event.Skip()
elif c == ord('C'):
self.clear_thumbnails()
event.Skip() | python | def on_key_down(self, event):
'''handle keyboard input'''
state = self.state
# send all key events to the parent
if self.mouse_pos:
latlon = self.coordinates(self.mouse_pos.x, self.mouse_pos.y)
selected = self.selected_objects(self.mouse_pos)
state.event_queue.put(SlipKeyEvent(latlon, event, selected))
c = event.GetUniChar()
if c == ord('+') or (c == ord('=') and event.ShiftDown()):
self.change_zoom(1.0/1.2)
event.Skip()
elif c == ord('-'):
self.change_zoom(1.2)
event.Skip()
elif c == ord('G'):
self.enter_position()
event.Skip()
elif c == ord('C'):
self.clear_thumbnails()
event.Skip() | [
"def",
"on_key_down",
"(",
"self",
",",
"event",
")",
":",
"state",
"=",
"self",
".",
"state",
"# send all key events to the parent",
"if",
"self",
".",
"mouse_pos",
":",
"latlon",
"=",
"self",
".",
"coordinates",
"(",
"self",
".",
"mouse_pos",
".",
"x",
",",
"self",
".",
"mouse_pos",
".",
"y",
")",
"selected",
"=",
"self",
".",
"selected_objects",
"(",
"self",
".",
"mouse_pos",
")",
"state",
".",
"event_queue",
".",
"put",
"(",
"SlipKeyEvent",
"(",
"latlon",
",",
"event",
",",
"selected",
")",
")",
"c",
"=",
"event",
".",
"GetUniChar",
"(",
")",
"if",
"c",
"==",
"ord",
"(",
"'+'",
")",
"or",
"(",
"c",
"==",
"ord",
"(",
"'='",
")",
"and",
"event",
".",
"ShiftDown",
"(",
")",
")",
":",
"self",
".",
"change_zoom",
"(",
"1.0",
"/",
"1.2",
")",
"event",
".",
"Skip",
"(",
")",
"elif",
"c",
"==",
"ord",
"(",
"'-'",
")",
":",
"self",
".",
"change_zoom",
"(",
"1.2",
")",
"event",
".",
"Skip",
"(",
")",
"elif",
"c",
"==",
"ord",
"(",
"'G'",
")",
":",
"self",
".",
"enter_position",
"(",
")",
"event",
".",
"Skip",
"(",
")",
"elif",
"c",
"==",
"ord",
"(",
"'C'",
")",
":",
"self",
".",
"clear_thumbnails",
"(",
")",
"event",
".",
"Skip",
"(",
")"
] | handle keyboard input | [
"handle",
"keyboard",
"input"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L555-L577 |
248,975 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavexpression.py | evaluate_expression | def evaluate_expression(expression, vars):
'''evaluation an expression'''
try:
v = eval(expression, globals(), vars)
except NameError:
return None
except ZeroDivisionError:
return None
return v | python | def evaluate_expression(expression, vars):
'''evaluation an expression'''
try:
v = eval(expression, globals(), vars)
except NameError:
return None
except ZeroDivisionError:
return None
return v | [
"def",
"evaluate_expression",
"(",
"expression",
",",
"vars",
")",
":",
"try",
":",
"v",
"=",
"eval",
"(",
"expression",
",",
"globals",
"(",
")",
",",
"vars",
")",
"except",
"NameError",
":",
"return",
"None",
"except",
"ZeroDivisionError",
":",
"return",
"None",
"return",
"v"
] | evaluation an expression | [
"evaluation",
"an",
"expression"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavexpression.py#L26-L34 |
248,976 | JdeRobot/base | src/tools/colorTuner_py/QDarkStyleSheet/qdarkstyle/compile_qrc.py | compile_all | def compile_all():
"""
Compile style.qrc using rcc, pyside-rcc and pyrcc4
"""
# print("Compiling for Qt: style.qrc -> style.rcc")
# os.system("rcc style.qrc -o style.rcc")
print("Compiling for PyQt4: style.qrc -> pyqt_style_rc.py")
os.system("pyrcc4 -py3 style.qrc -o pyqt_style_rc.py")
print("Compiling for PyQt5: style.qrc -> pyqt5_style_rc.py")
os.system("pyrcc5 style.qrc -o pyqt5_style_rc.py")
print("Compiling for PySide: style.qrc -> pyside_style_rc.py")
os.system("pyside-rcc -py3 style.qrc -o pyside_style_rc.py") | python | def compile_all():
# print("Compiling for Qt: style.qrc -> style.rcc")
# os.system("rcc style.qrc -o style.rcc")
print("Compiling for PyQt4: style.qrc -> pyqt_style_rc.py")
os.system("pyrcc4 -py3 style.qrc -o pyqt_style_rc.py")
print("Compiling for PyQt5: style.qrc -> pyqt5_style_rc.py")
os.system("pyrcc5 style.qrc -o pyqt5_style_rc.py")
print("Compiling for PySide: style.qrc -> pyside_style_rc.py")
os.system("pyside-rcc -py3 style.qrc -o pyside_style_rc.py") | [
"def",
"compile_all",
"(",
")",
":",
"# print(\"Compiling for Qt: style.qrc -> style.rcc\")",
"# os.system(\"rcc style.qrc -o style.rcc\")",
"print",
"(",
"\"Compiling for PyQt4: style.qrc -> pyqt_style_rc.py\"",
")",
"os",
".",
"system",
"(",
"\"pyrcc4 -py3 style.qrc -o pyqt_style_rc.py\"",
")",
"print",
"(",
"\"Compiling for PyQt5: style.qrc -> pyqt5_style_rc.py\"",
")",
"os",
".",
"system",
"(",
"\"pyrcc5 style.qrc -o pyqt5_style_rc.py\"",
")",
"print",
"(",
"\"Compiling for PySide: style.qrc -> pyside_style_rc.py\"",
")",
"os",
".",
"system",
"(",
"\"pyside-rcc -py3 style.qrc -o pyside_style_rc.py\"",
")"
] | Compile style.qrc using rcc, pyside-rcc and pyrcc4 | [
"Compile",
"style",
".",
"qrc",
"using",
"rcc",
"pyside",
"-",
"rcc",
"and",
"pyrcc4"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/tools/colorTuner_py/QDarkStyleSheet/qdarkstyle/compile_qrc.py#L39-L50 |
248,977 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | null_term | def null_term(str):
'''null terminate a string'''
idx = str.find("\0")
if idx != -1:
str = str[:idx]
return str | python | def null_term(str):
'''null terminate a string'''
idx = str.find("\0")
if idx != -1:
str = str[:idx]
return str | [
"def",
"null_term",
"(",
"str",
")",
":",
"idx",
"=",
"str",
".",
"find",
"(",
"\"\\0\"",
")",
"if",
"idx",
"!=",
"-",
"1",
":",
"str",
"=",
"str",
"[",
":",
"idx",
"]",
"return",
"str"
] | null terminate a string | [
"null",
"terminate",
"a",
"string"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L71-L76 |
248,978 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReader_is_text_log | def DFReader_is_text_log(filename):
'''return True if a file appears to be a valid text log'''
f = open(filename)
ret = (f.read(8000).find('FMT, ') != -1)
f.close()
return ret | python | def DFReader_is_text_log(filename):
'''return True if a file appears to be a valid text log'''
f = open(filename)
ret = (f.read(8000).find('FMT, ') != -1)
f.close()
return ret | [
"def",
"DFReader_is_text_log",
"(",
"filename",
")",
":",
"f",
"=",
"open",
"(",
"filename",
")",
"ret",
"=",
"(",
"f",
".",
"read",
"(",
"8000",
")",
".",
"find",
"(",
"'FMT, '",
")",
"!=",
"-",
"1",
")",
"f",
".",
"close",
"(",
")",
"return",
"ret"
] | return True if a file appears to be a valid text log | [
"return",
"True",
"if",
"a",
"file",
"appears",
"to",
"be",
"a",
"valid",
"text",
"log"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L594-L599 |
248,979 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFMessage.get_msgbuf | def get_msgbuf(self):
'''create a binary message buffer for a message'''
values = []
for i in range(len(self.fmt.columns)):
if i >= len(self.fmt.msg_mults):
continue
mul = self.fmt.msg_mults[i]
name = self.fmt.columns[i]
if name == 'Mode' and 'ModeNum' in self.fmt.columns:
name = 'ModeNum'
v = self.__getattr__(name)
if mul is not None:
v /= mul
values.append(v)
return struct.pack("BBB", 0xA3, 0x95, self.fmt.type) + struct.pack(self.fmt.msg_struct, *values) | python | def get_msgbuf(self):
'''create a binary message buffer for a message'''
values = []
for i in range(len(self.fmt.columns)):
if i >= len(self.fmt.msg_mults):
continue
mul = self.fmt.msg_mults[i]
name = self.fmt.columns[i]
if name == 'Mode' and 'ModeNum' in self.fmt.columns:
name = 'ModeNum'
v = self.__getattr__(name)
if mul is not None:
v /= mul
values.append(v)
return struct.pack("BBB", 0xA3, 0x95, self.fmt.type) + struct.pack(self.fmt.msg_struct, *values) | [
"def",
"get_msgbuf",
"(",
"self",
")",
":",
"values",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"fmt",
".",
"columns",
")",
")",
":",
"if",
"i",
">=",
"len",
"(",
"self",
".",
"fmt",
".",
"msg_mults",
")",
":",
"continue",
"mul",
"=",
"self",
".",
"fmt",
".",
"msg_mults",
"[",
"i",
"]",
"name",
"=",
"self",
".",
"fmt",
".",
"columns",
"[",
"i",
"]",
"if",
"name",
"==",
"'Mode'",
"and",
"'ModeNum'",
"in",
"self",
".",
"fmt",
".",
"columns",
":",
"name",
"=",
"'ModeNum'",
"v",
"=",
"self",
".",
"__getattr__",
"(",
"name",
")",
"if",
"mul",
"is",
"not",
"None",
":",
"v",
"/=",
"mul",
"values",
".",
"append",
"(",
"v",
")",
"return",
"struct",
".",
"pack",
"(",
"\"BBB\"",
",",
"0xA3",
",",
"0x95",
",",
"self",
".",
"fmt",
".",
"type",
")",
"+",
"struct",
".",
"pack",
"(",
"self",
".",
"fmt",
".",
"msg_struct",
",",
"*",
"values",
")"
] | create a binary message buffer for a message | [
"create",
"a",
"binary",
"message",
"buffer",
"for",
"a",
"message"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L121-L135 |
248,980 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReaderClock_usec.find_time_base | def find_time_base(self, gps, first_us_stamp):
'''work out time basis for the log - even newer style'''
t = self._gpsTimeToTime(gps.GWk, gps.GMS)
self.set_timebase(t - gps.TimeUS*0.000001)
# this ensures FMT messages get appropriate timestamp:
self.timestamp = self.timebase + first_us_stamp*0.000001 | python | def find_time_base(self, gps, first_us_stamp):
'''work out time basis for the log - even newer style'''
t = self._gpsTimeToTime(gps.GWk, gps.GMS)
self.set_timebase(t - gps.TimeUS*0.000001)
# this ensures FMT messages get appropriate timestamp:
self.timestamp = self.timebase + first_us_stamp*0.000001 | [
"def",
"find_time_base",
"(",
"self",
",",
"gps",
",",
"first_us_stamp",
")",
":",
"t",
"=",
"self",
".",
"_gpsTimeToTime",
"(",
"gps",
".",
"GWk",
",",
"gps",
".",
"GMS",
")",
"self",
".",
"set_timebase",
"(",
"t",
"-",
"gps",
".",
"TimeUS",
"*",
"0.000001",
")",
"# this ensures FMT messages get appropriate timestamp:",
"self",
".",
"timestamp",
"=",
"self",
".",
"timebase",
"+",
"first_us_stamp",
"*",
"0.000001"
] | work out time basis for the log - even newer style | [
"work",
"out",
"time",
"basis",
"for",
"the",
"log",
"-",
"even",
"newer",
"style"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L166-L171 |
248,981 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReaderClock_msec.find_time_base | def find_time_base(self, gps, first_ms_stamp):
'''work out time basis for the log - new style'''
t = self._gpsTimeToTime(gps.Week, gps.TimeMS)
self.set_timebase(t - gps.T*0.001)
self.timestamp = self.timebase + first_ms_stamp*0.001 | python | def find_time_base(self, gps, first_ms_stamp):
'''work out time basis for the log - new style'''
t = self._gpsTimeToTime(gps.Week, gps.TimeMS)
self.set_timebase(t - gps.T*0.001)
self.timestamp = self.timebase + first_ms_stamp*0.001 | [
"def",
"find_time_base",
"(",
"self",
",",
"gps",
",",
"first_ms_stamp",
")",
":",
"t",
"=",
"self",
".",
"_gpsTimeToTime",
"(",
"gps",
".",
"Week",
",",
"gps",
".",
"TimeMS",
")",
"self",
".",
"set_timebase",
"(",
"t",
"-",
"gps",
".",
"T",
"*",
"0.001",
")",
"self",
".",
"timestamp",
"=",
"self",
".",
"timebase",
"+",
"first_ms_stamp",
"*",
"0.001"
] | work out time basis for the log - new style | [
"work",
"out",
"time",
"basis",
"for",
"the",
"log",
"-",
"new",
"style"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L204-L208 |
248,982 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReaderClock_px4.find_time_base | def find_time_base(self, gps):
'''work out time basis for the log - PX4 native'''
t = gps.GPSTime * 1.0e-6
self.timebase = t - self.px4_timebase | python | def find_time_base(self, gps):
'''work out time basis for the log - PX4 native'''
t = gps.GPSTime * 1.0e-6
self.timebase = t - self.px4_timebase | [
"def",
"find_time_base",
"(",
"self",
",",
"gps",
")",
":",
"t",
"=",
"gps",
".",
"GPSTime",
"*",
"1.0e-6",
"self",
".",
"timebase",
"=",
"t",
"-",
"self",
".",
"px4_timebase"
] | work out time basis for the log - PX4 native | [
"work",
"out",
"time",
"basis",
"for",
"the",
"log",
"-",
"PX4",
"native"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L225-L228 |
248,983 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReaderClock_gps_interpolated.gps_message_arrived | def gps_message_arrived(self, m):
'''adjust time base from GPS message'''
# msec-style GPS message?
gps_week = getattr(m, 'Week', None)
gps_timems = getattr(m, 'TimeMS', None)
if gps_week is None:
# usec-style GPS message?
gps_week = getattr(m, 'GWk', None)
gps_timems = getattr(m, 'GMS', None)
if gps_week is None:
if getattr(m, 'GPSTime', None) is not None:
# PX4-style timestamp; we've only been called
# because we were speculatively created in case no
# better clock was found.
return;
t = self._gpsTimeToTime(gps_week, gps_timems)
deltat = t - self.timebase
if deltat <= 0:
return
for type in self.counts_since_gps:
rate = self.counts_since_gps[type] / deltat
if rate > self.msg_rate.get(type, 0):
self.msg_rate[type] = rate
self.msg_rate['IMU'] = 50.0
self.timebase = t
self.counts_since_gps = {} | python | def gps_message_arrived(self, m):
'''adjust time base from GPS message'''
# msec-style GPS message?
gps_week = getattr(m, 'Week', None)
gps_timems = getattr(m, 'TimeMS', None)
if gps_week is None:
# usec-style GPS message?
gps_week = getattr(m, 'GWk', None)
gps_timems = getattr(m, 'GMS', None)
if gps_week is None:
if getattr(m, 'GPSTime', None) is not None:
# PX4-style timestamp; we've only been called
# because we were speculatively created in case no
# better clock was found.
return;
t = self._gpsTimeToTime(gps_week, gps_timems)
deltat = t - self.timebase
if deltat <= 0:
return
for type in self.counts_since_gps:
rate = self.counts_since_gps[type] / deltat
if rate > self.msg_rate.get(type, 0):
self.msg_rate[type] = rate
self.msg_rate['IMU'] = 50.0
self.timebase = t
self.counts_since_gps = {} | [
"def",
"gps_message_arrived",
"(",
"self",
",",
"m",
")",
":",
"# msec-style GPS message?",
"gps_week",
"=",
"getattr",
"(",
"m",
",",
"'Week'",
",",
"None",
")",
"gps_timems",
"=",
"getattr",
"(",
"m",
",",
"'TimeMS'",
",",
"None",
")",
"if",
"gps_week",
"is",
"None",
":",
"# usec-style GPS message?",
"gps_week",
"=",
"getattr",
"(",
"m",
",",
"'GWk'",
",",
"None",
")",
"gps_timems",
"=",
"getattr",
"(",
"m",
",",
"'GMS'",
",",
"None",
")",
"if",
"gps_week",
"is",
"None",
":",
"if",
"getattr",
"(",
"m",
",",
"'GPSTime'",
",",
"None",
")",
"is",
"not",
"None",
":",
"# PX4-style timestamp; we've only been called",
"# because we were speculatively created in case no",
"# better clock was found.",
"return",
"t",
"=",
"self",
".",
"_gpsTimeToTime",
"(",
"gps_week",
",",
"gps_timems",
")",
"deltat",
"=",
"t",
"-",
"self",
".",
"timebase",
"if",
"deltat",
"<=",
"0",
":",
"return",
"for",
"type",
"in",
"self",
".",
"counts_since_gps",
":",
"rate",
"=",
"self",
".",
"counts_since_gps",
"[",
"type",
"]",
"/",
"deltat",
"if",
"rate",
">",
"self",
".",
"msg_rate",
".",
"get",
"(",
"type",
",",
"0",
")",
":",
"self",
".",
"msg_rate",
"[",
"type",
"]",
"=",
"rate",
"self",
".",
"msg_rate",
"[",
"'IMU'",
"]",
"=",
"50.0",
"self",
".",
"timebase",
"=",
"t",
"self",
".",
"counts_since_gps",
"=",
"{",
"}"
] | adjust time base from GPS message | [
"adjust",
"time",
"base",
"from",
"GPS",
"message"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L270-L298 |
248,984 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReader._rewind | def _rewind(self):
'''reset state on rewind'''
self.messages = { 'MAV' : self }
self.flightmode = "UNKNOWN"
self.percent = 0
if self.clock:
self.clock.rewind_event() | python | def _rewind(self):
'''reset state on rewind'''
self.messages = { 'MAV' : self }
self.flightmode = "UNKNOWN"
self.percent = 0
if self.clock:
self.clock.rewind_event() | [
"def",
"_rewind",
"(",
"self",
")",
":",
"self",
".",
"messages",
"=",
"{",
"'MAV'",
":",
"self",
"}",
"self",
".",
"flightmode",
"=",
"\"UNKNOWN\"",
"self",
".",
"percent",
"=",
"0",
"if",
"self",
".",
"clock",
":",
"self",
".",
"clock",
".",
"rewind_event",
"(",
")"
] | reset state on rewind | [
"reset",
"state",
"on",
"rewind"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L318-L324 |
248,985 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReader.init_clock | def init_clock(self):
'''work out time basis for the log'''
self._rewind()
# speculatively create a gps clock in case we don't find anything
# better
gps_clock = DFReaderClock_gps_interpolated()
self.clock = gps_clock
px4_msg_time = None
px4_msg_gps = None
gps_interp_msg_gps1 = None
gps_interp_msg_gps2 = None
first_us_stamp = None
first_ms_stamp = None
have_good_clock = False
while True:
m = self.recv_msg()
if m is None:
break;
type = m.get_type()
if first_us_stamp is None:
first_us_stamp = getattr(m, "TimeUS", None);
if first_ms_stamp is None and (type != 'GPS' and type != 'GPS2'):
# Older GPS messages use TimeMS for msecs past start
# of gps week
first_ms_stamp = getattr(m, "TimeMS", None);
if type == 'GPS' or type == 'GPS2':
if getattr(m, "TimeUS", 0) != 0 and \
getattr(m, "GWk", 0) != 0: # everything-usec-timestamped
self.init_clock_usec()
if not self._zero_time_base:
self.clock.find_time_base(m, first_us_stamp)
have_good_clock = True
break
if getattr(m, "T", 0) != 0 and \
getattr(m, "Week", 0) != 0: # GPS is msec-timestamped
if first_ms_stamp is None:
first_ms_stamp = m.T
self.init_clock_msec()
if not self._zero_time_base:
self.clock.find_time_base(m, first_ms_stamp)
have_good_clock = True
break
if getattr(m, "GPSTime", 0) != 0: # px4-style-only
px4_msg_gps = m
if getattr(m, "Week", 0) != 0:
if gps_interp_msg_gps1 is not None and \
(gps_interp_msg_gps1.TimeMS != m.TimeMS or \
gps_interp_msg_gps1.Week != m.Week):
# we've received two distinct, non-zero GPS
# packets without finding a decent clock to
# use; fall back to interpolation. Q: should
# we wait a few more messages befoe doing
# this?
self.init_clock_gps_interpolated(gps_clock)
have_good_clock = True
break
gps_interp_msg_gps1 = m
elif type == 'TIME':
'''only px4-style logs use TIME'''
if getattr(m, "StartTime", None) != None:
px4_msg_time = m;
if px4_msg_time is not None and px4_msg_gps is not None:
self.init_clock_px4(px4_msg_time, px4_msg_gps)
have_good_clock = True
break
# print("clock is " + str(self.clock))
if not have_good_clock:
# we failed to find any GPS messages to set a time
# base for usec and msec clocks. Also, not a
# PX4-style log
if first_us_stamp is not None:
self.init_clock_usec()
elif first_ms_stamp is not None:
self.init_clock_msec()
self._rewind()
return | python | def init_clock(self):
'''work out time basis for the log'''
self._rewind()
# speculatively create a gps clock in case we don't find anything
# better
gps_clock = DFReaderClock_gps_interpolated()
self.clock = gps_clock
px4_msg_time = None
px4_msg_gps = None
gps_interp_msg_gps1 = None
gps_interp_msg_gps2 = None
first_us_stamp = None
first_ms_stamp = None
have_good_clock = False
while True:
m = self.recv_msg()
if m is None:
break;
type = m.get_type()
if first_us_stamp is None:
first_us_stamp = getattr(m, "TimeUS", None);
if first_ms_stamp is None and (type != 'GPS' and type != 'GPS2'):
# Older GPS messages use TimeMS for msecs past start
# of gps week
first_ms_stamp = getattr(m, "TimeMS", None);
if type == 'GPS' or type == 'GPS2':
if getattr(m, "TimeUS", 0) != 0 and \
getattr(m, "GWk", 0) != 0: # everything-usec-timestamped
self.init_clock_usec()
if not self._zero_time_base:
self.clock.find_time_base(m, first_us_stamp)
have_good_clock = True
break
if getattr(m, "T", 0) != 0 and \
getattr(m, "Week", 0) != 0: # GPS is msec-timestamped
if first_ms_stamp is None:
first_ms_stamp = m.T
self.init_clock_msec()
if not self._zero_time_base:
self.clock.find_time_base(m, first_ms_stamp)
have_good_clock = True
break
if getattr(m, "GPSTime", 0) != 0: # px4-style-only
px4_msg_gps = m
if getattr(m, "Week", 0) != 0:
if gps_interp_msg_gps1 is not None and \
(gps_interp_msg_gps1.TimeMS != m.TimeMS or \
gps_interp_msg_gps1.Week != m.Week):
# we've received two distinct, non-zero GPS
# packets without finding a decent clock to
# use; fall back to interpolation. Q: should
# we wait a few more messages befoe doing
# this?
self.init_clock_gps_interpolated(gps_clock)
have_good_clock = True
break
gps_interp_msg_gps1 = m
elif type == 'TIME':
'''only px4-style logs use TIME'''
if getattr(m, "StartTime", None) != None:
px4_msg_time = m;
if px4_msg_time is not None and px4_msg_gps is not None:
self.init_clock_px4(px4_msg_time, px4_msg_gps)
have_good_clock = True
break
# print("clock is " + str(self.clock))
if not have_good_clock:
# we failed to find any GPS messages to set a time
# base for usec and msec clocks. Also, not a
# PX4-style log
if first_us_stamp is not None:
self.init_clock_usec()
elif first_ms_stamp is not None:
self.init_clock_msec()
self._rewind()
return | [
"def",
"init_clock",
"(",
"self",
")",
":",
"self",
".",
"_rewind",
"(",
")",
"# speculatively create a gps clock in case we don't find anything",
"# better",
"gps_clock",
"=",
"DFReaderClock_gps_interpolated",
"(",
")",
"self",
".",
"clock",
"=",
"gps_clock",
"px4_msg_time",
"=",
"None",
"px4_msg_gps",
"=",
"None",
"gps_interp_msg_gps1",
"=",
"None",
"gps_interp_msg_gps2",
"=",
"None",
"first_us_stamp",
"=",
"None",
"first_ms_stamp",
"=",
"None",
"have_good_clock",
"=",
"False",
"while",
"True",
":",
"m",
"=",
"self",
".",
"recv_msg",
"(",
")",
"if",
"m",
"is",
"None",
":",
"break",
"type",
"=",
"m",
".",
"get_type",
"(",
")",
"if",
"first_us_stamp",
"is",
"None",
":",
"first_us_stamp",
"=",
"getattr",
"(",
"m",
",",
"\"TimeUS\"",
",",
"None",
")",
"if",
"first_ms_stamp",
"is",
"None",
"and",
"(",
"type",
"!=",
"'GPS'",
"and",
"type",
"!=",
"'GPS2'",
")",
":",
"# Older GPS messages use TimeMS for msecs past start",
"# of gps week",
"first_ms_stamp",
"=",
"getattr",
"(",
"m",
",",
"\"TimeMS\"",
",",
"None",
")",
"if",
"type",
"==",
"'GPS'",
"or",
"type",
"==",
"'GPS2'",
":",
"if",
"getattr",
"(",
"m",
",",
"\"TimeUS\"",
",",
"0",
")",
"!=",
"0",
"and",
"getattr",
"(",
"m",
",",
"\"GWk\"",
",",
"0",
")",
"!=",
"0",
":",
"# everything-usec-timestamped",
"self",
".",
"init_clock_usec",
"(",
")",
"if",
"not",
"self",
".",
"_zero_time_base",
":",
"self",
".",
"clock",
".",
"find_time_base",
"(",
"m",
",",
"first_us_stamp",
")",
"have_good_clock",
"=",
"True",
"break",
"if",
"getattr",
"(",
"m",
",",
"\"T\"",
",",
"0",
")",
"!=",
"0",
"and",
"getattr",
"(",
"m",
",",
"\"Week\"",
",",
"0",
")",
"!=",
"0",
":",
"# GPS is msec-timestamped",
"if",
"first_ms_stamp",
"is",
"None",
":",
"first_ms_stamp",
"=",
"m",
".",
"T",
"self",
".",
"init_clock_msec",
"(",
")",
"if",
"not",
"self",
".",
"_zero_time_base",
":",
"self",
".",
"clock",
".",
"find_time_base",
"(",
"m",
",",
"first_ms_stamp",
")",
"have_good_clock",
"=",
"True",
"break",
"if",
"getattr",
"(",
"m",
",",
"\"GPSTime\"",
",",
"0",
")",
"!=",
"0",
":",
"# px4-style-only",
"px4_msg_gps",
"=",
"m",
"if",
"getattr",
"(",
"m",
",",
"\"Week\"",
",",
"0",
")",
"!=",
"0",
":",
"if",
"gps_interp_msg_gps1",
"is",
"not",
"None",
"and",
"(",
"gps_interp_msg_gps1",
".",
"TimeMS",
"!=",
"m",
".",
"TimeMS",
"or",
"gps_interp_msg_gps1",
".",
"Week",
"!=",
"m",
".",
"Week",
")",
":",
"# we've received two distinct, non-zero GPS",
"# packets without finding a decent clock to",
"# use; fall back to interpolation. Q: should",
"# we wait a few more messages befoe doing",
"# this?",
"self",
".",
"init_clock_gps_interpolated",
"(",
"gps_clock",
")",
"have_good_clock",
"=",
"True",
"break",
"gps_interp_msg_gps1",
"=",
"m",
"elif",
"type",
"==",
"'TIME'",
":",
"'''only px4-style logs use TIME'''",
"if",
"getattr",
"(",
"m",
",",
"\"StartTime\"",
",",
"None",
")",
"!=",
"None",
":",
"px4_msg_time",
"=",
"m",
"if",
"px4_msg_time",
"is",
"not",
"None",
"and",
"px4_msg_gps",
"is",
"not",
"None",
":",
"self",
".",
"init_clock_px4",
"(",
"px4_msg_time",
",",
"px4_msg_gps",
")",
"have_good_clock",
"=",
"True",
"break",
"# print(\"clock is \" + str(self.clock))",
"if",
"not",
"have_good_clock",
":",
"# we failed to find any GPS messages to set a time",
"# base for usec and msec clocks. Also, not a",
"# PX4-style log",
"if",
"first_us_stamp",
"is",
"not",
"None",
":",
"self",
".",
"init_clock_usec",
"(",
")",
"elif",
"first_ms_stamp",
"is",
"not",
"None",
":",
"self",
".",
"init_clock_msec",
"(",
")",
"self",
".",
"_rewind",
"(",
")",
"return"
] | work out time basis for the log | [
"work",
"out",
"time",
"basis",
"for",
"the",
"log"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L343-L431 |
248,986 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReader._set_time | def _set_time(self, m):
'''set time for a message'''
# really just left here for profiling
m._timestamp = self.timestamp
if len(m._fieldnames) > 0 and self.clock is not None:
self.clock.set_message_timestamp(m) | python | def _set_time(self, m):
'''set time for a message'''
# really just left here for profiling
m._timestamp = self.timestamp
if len(m._fieldnames) > 0 and self.clock is not None:
self.clock.set_message_timestamp(m) | [
"def",
"_set_time",
"(",
"self",
",",
"m",
")",
":",
"# really just left here for profiling",
"m",
".",
"_timestamp",
"=",
"self",
".",
"timestamp",
"if",
"len",
"(",
"m",
".",
"_fieldnames",
")",
">",
"0",
"and",
"self",
".",
"clock",
"is",
"not",
"None",
":",
"self",
".",
"clock",
".",
"set_message_timestamp",
"(",
"m",
")"
] | set time for a message | [
"set",
"time",
"for",
"a",
"message"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L433-L438 |
248,987 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReader._add_msg | def _add_msg(self, m):
'''add a new message'''
type = m.get_type()
self.messages[type] = m
if self.clock:
self.clock.message_arrived(m)
if type == 'MSG':
if m.Message.find("Rover") != -1:
self.mav_type = mavutil.mavlink.MAV_TYPE_GROUND_ROVER
elif m.Message.find("Plane") != -1:
self.mav_type = mavutil.mavlink.MAV_TYPE_FIXED_WING
elif m.Message.find("Copter") != -1:
self.mav_type = mavutil.mavlink.MAV_TYPE_QUADROTOR
elif m.Message.startswith("Antenna"):
self.mav_type = mavutil.mavlink.MAV_TYPE_ANTENNA_TRACKER
if type == 'MODE':
if isinstance(m.Mode, str):
self.flightmode = m.Mode.upper()
elif 'ModeNum' in m._fieldnames:
mapping = mavutil.mode_mapping_bynumber(self.mav_type)
if mapping is not None and m.ModeNum in mapping:
self.flightmode = mapping[m.ModeNum]
else:
self.flightmode = mavutil.mode_string_acm(m.Mode)
if type == 'STAT' and 'MainState' in m._fieldnames:
self.flightmode = mavutil.mode_string_px4(m.MainState)
if type == 'PARM' and getattr(m, 'Name', None) is not None:
self.params[m.Name] = m.Value
self._set_time(m) | python | def _add_msg(self, m):
'''add a new message'''
type = m.get_type()
self.messages[type] = m
if self.clock:
self.clock.message_arrived(m)
if type == 'MSG':
if m.Message.find("Rover") != -1:
self.mav_type = mavutil.mavlink.MAV_TYPE_GROUND_ROVER
elif m.Message.find("Plane") != -1:
self.mav_type = mavutil.mavlink.MAV_TYPE_FIXED_WING
elif m.Message.find("Copter") != -1:
self.mav_type = mavutil.mavlink.MAV_TYPE_QUADROTOR
elif m.Message.startswith("Antenna"):
self.mav_type = mavutil.mavlink.MAV_TYPE_ANTENNA_TRACKER
if type == 'MODE':
if isinstance(m.Mode, str):
self.flightmode = m.Mode.upper()
elif 'ModeNum' in m._fieldnames:
mapping = mavutil.mode_mapping_bynumber(self.mav_type)
if mapping is not None and m.ModeNum in mapping:
self.flightmode = mapping[m.ModeNum]
else:
self.flightmode = mavutil.mode_string_acm(m.Mode)
if type == 'STAT' and 'MainState' in m._fieldnames:
self.flightmode = mavutil.mode_string_px4(m.MainState)
if type == 'PARM' and getattr(m, 'Name', None) is not None:
self.params[m.Name] = m.Value
self._set_time(m) | [
"def",
"_add_msg",
"(",
"self",
",",
"m",
")",
":",
"type",
"=",
"m",
".",
"get_type",
"(",
")",
"self",
".",
"messages",
"[",
"type",
"]",
"=",
"m",
"if",
"self",
".",
"clock",
":",
"self",
".",
"clock",
".",
"message_arrived",
"(",
"m",
")",
"if",
"type",
"==",
"'MSG'",
":",
"if",
"m",
".",
"Message",
".",
"find",
"(",
"\"Rover\"",
")",
"!=",
"-",
"1",
":",
"self",
".",
"mav_type",
"=",
"mavutil",
".",
"mavlink",
".",
"MAV_TYPE_GROUND_ROVER",
"elif",
"m",
".",
"Message",
".",
"find",
"(",
"\"Plane\"",
")",
"!=",
"-",
"1",
":",
"self",
".",
"mav_type",
"=",
"mavutil",
".",
"mavlink",
".",
"MAV_TYPE_FIXED_WING",
"elif",
"m",
".",
"Message",
".",
"find",
"(",
"\"Copter\"",
")",
"!=",
"-",
"1",
":",
"self",
".",
"mav_type",
"=",
"mavutil",
".",
"mavlink",
".",
"MAV_TYPE_QUADROTOR",
"elif",
"m",
".",
"Message",
".",
"startswith",
"(",
"\"Antenna\"",
")",
":",
"self",
".",
"mav_type",
"=",
"mavutil",
".",
"mavlink",
".",
"MAV_TYPE_ANTENNA_TRACKER",
"if",
"type",
"==",
"'MODE'",
":",
"if",
"isinstance",
"(",
"m",
".",
"Mode",
",",
"str",
")",
":",
"self",
".",
"flightmode",
"=",
"m",
".",
"Mode",
".",
"upper",
"(",
")",
"elif",
"'ModeNum'",
"in",
"m",
".",
"_fieldnames",
":",
"mapping",
"=",
"mavutil",
".",
"mode_mapping_bynumber",
"(",
"self",
".",
"mav_type",
")",
"if",
"mapping",
"is",
"not",
"None",
"and",
"m",
".",
"ModeNum",
"in",
"mapping",
":",
"self",
".",
"flightmode",
"=",
"mapping",
"[",
"m",
".",
"ModeNum",
"]",
"else",
":",
"self",
".",
"flightmode",
"=",
"mavutil",
".",
"mode_string_acm",
"(",
"m",
".",
"Mode",
")",
"if",
"type",
"==",
"'STAT'",
"and",
"'MainState'",
"in",
"m",
".",
"_fieldnames",
":",
"self",
".",
"flightmode",
"=",
"mavutil",
".",
"mode_string_px4",
"(",
"m",
".",
"MainState",
")",
"if",
"type",
"==",
"'PARM'",
"and",
"getattr",
"(",
"m",
",",
"'Name'",
",",
"None",
")",
"is",
"not",
"None",
":",
"self",
".",
"params",
"[",
"m",
".",
"Name",
"]",
"=",
"m",
".",
"Value",
"self",
".",
"_set_time",
"(",
"m",
")"
] | add a new message | [
"add",
"a",
"new",
"message"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L443-L473 |
248,988 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReader.recv_match | def recv_match(self, condition=None, type=None, blocking=False):
'''recv the next message that matches the given condition
type can be a string or a list of strings'''
if type is not None and not isinstance(type, list):
type = [type]
while True:
m = self.recv_msg()
if m is None:
return None
if type is not None and not m.get_type() in type:
continue
if not mavutil.evaluate_condition(condition, self.messages):
continue
return m | python | def recv_match(self, condition=None, type=None, blocking=False):
'''recv the next message that matches the given condition
type can be a string or a list of strings'''
if type is not None and not isinstance(type, list):
type = [type]
while True:
m = self.recv_msg()
if m is None:
return None
if type is not None and not m.get_type() in type:
continue
if not mavutil.evaluate_condition(condition, self.messages):
continue
return m | [
"def",
"recv_match",
"(",
"self",
",",
"condition",
"=",
"None",
",",
"type",
"=",
"None",
",",
"blocking",
"=",
"False",
")",
":",
"if",
"type",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"type",
",",
"list",
")",
":",
"type",
"=",
"[",
"type",
"]",
"while",
"True",
":",
"m",
"=",
"self",
".",
"recv_msg",
"(",
")",
"if",
"m",
"is",
"None",
":",
"return",
"None",
"if",
"type",
"is",
"not",
"None",
"and",
"not",
"m",
".",
"get_type",
"(",
")",
"in",
"type",
":",
"continue",
"if",
"not",
"mavutil",
".",
"evaluate_condition",
"(",
"condition",
",",
"self",
".",
"messages",
")",
":",
"continue",
"return",
"m"
] | recv the next message that matches the given condition
type can be a string or a list of strings | [
"recv",
"the",
"next",
"message",
"that",
"matches",
"the",
"given",
"condition",
"type",
"can",
"be",
"a",
"string",
"or",
"a",
"list",
"of",
"strings"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L475-L488 |
248,989 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py | DFReader.param | def param(self, name, default=None):
'''convenient function for returning an arbitrary MAVLink
parameter with a default'''
if not name in self.params:
return default
return self.params[name] | python | def param(self, name, default=None):
'''convenient function for returning an arbitrary MAVLink
parameter with a default'''
if not name in self.params:
return default
return self.params[name] | [
"def",
"param",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"if",
"not",
"name",
"in",
"self",
".",
"params",
":",
"return",
"default",
"return",
"self",
".",
"params",
"[",
"name",
"]"
] | convenient function for returning an arbitrary MAVLink
parameter with a default | [
"convenient",
"function",
"for",
"returning",
"an",
"arbitrary",
"MAVLink",
"parameter",
"with",
"a",
"default"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/DFReader.py#L494-L499 |
248,990 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py | MAVLink.cpu_load_send | def cpu_load_send(self, sensLoad, ctrlLoad, batVolt, force_mavlink1=False):
'''
Sensor and DSC control loads.
sensLoad : Sensor DSC Load (uint8_t)
ctrlLoad : Control DSC Load (uint8_t)
batVolt : Battery Voltage in millivolts (uint16_t)
'''
return self.send(self.cpu_load_encode(sensLoad, ctrlLoad, batVolt), force_mavlink1=force_mavlink1) | python | def cpu_load_send(self, sensLoad, ctrlLoad, batVolt, force_mavlink1=False):
'''
Sensor and DSC control loads.
sensLoad : Sensor DSC Load (uint8_t)
ctrlLoad : Control DSC Load (uint8_t)
batVolt : Battery Voltage in millivolts (uint16_t)
'''
return self.send(self.cpu_load_encode(sensLoad, ctrlLoad, batVolt), force_mavlink1=force_mavlink1) | [
"def",
"cpu_load_send",
"(",
"self",
",",
"sensLoad",
",",
"ctrlLoad",
",",
"batVolt",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"cpu_load_encode",
"(",
"sensLoad",
",",
"ctrlLoad",
",",
"batVolt",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Sensor and DSC control loads.
sensLoad : Sensor DSC Load (uint8_t)
ctrlLoad : Control DSC Load (uint8_t)
batVolt : Battery Voltage in millivolts (uint16_t) | [
"Sensor",
"and",
"DSC",
"control",
"loads",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py#L7816-L7825 |
248,991 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py | MAVLink.ctrl_srfc_pt_send | def ctrl_srfc_pt_send(self, target, bitfieldPt, force_mavlink1=False):
'''
This message sets the control surfaces for selective passthrough mode.
target : The system setting the commands (uint8_t)
bitfieldPt : Bitfield containing the passthrough configuration, see CONTROL_SURFACE_FLAG ENUM. (uint16_t)
'''
return self.send(self.ctrl_srfc_pt_encode(target, bitfieldPt), force_mavlink1=force_mavlink1) | python | def ctrl_srfc_pt_send(self, target, bitfieldPt, force_mavlink1=False):
'''
This message sets the control surfaces for selective passthrough mode.
target : The system setting the commands (uint8_t)
bitfieldPt : Bitfield containing the passthrough configuration, see CONTROL_SURFACE_FLAG ENUM. (uint16_t)
'''
return self.send(self.ctrl_srfc_pt_encode(target, bitfieldPt), force_mavlink1=force_mavlink1) | [
"def",
"ctrl_srfc_pt_send",
"(",
"self",
",",
"target",
",",
"bitfieldPt",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"ctrl_srfc_pt_encode",
"(",
"target",
",",
"bitfieldPt",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | This message sets the control surfaces for selective passthrough mode.
target : The system setting the commands (uint8_t)
bitfieldPt : Bitfield containing the passthrough configuration, see CONTROL_SURFACE_FLAG ENUM. (uint16_t) | [
"This",
"message",
"sets",
"the",
"control",
"surfaces",
"for",
"selective",
"passthrough",
"mode",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py#L8025-L8033 |
248,992 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py | MAVLink.slugs_mobile_location_send | def slugs_mobile_location_send(self, target, latitude, longitude, force_mavlink1=False):
'''
Transmits the last known position of the mobile GS to the UAV. Very
relevant when Track Mobile is enabled
target : The system reporting the action (uint8_t)
latitude : Mobile Latitude (float)
longitude : Mobile Longitude (float)
'''
return self.send(self.slugs_mobile_location_encode(target, latitude, longitude), force_mavlink1=force_mavlink1) | python | def slugs_mobile_location_send(self, target, latitude, longitude, force_mavlink1=False):
'''
Transmits the last known position of the mobile GS to the UAV. Very
relevant when Track Mobile is enabled
target : The system reporting the action (uint8_t)
latitude : Mobile Latitude (float)
longitude : Mobile Longitude (float)
'''
return self.send(self.slugs_mobile_location_encode(target, latitude, longitude), force_mavlink1=force_mavlink1) | [
"def",
"slugs_mobile_location_send",
"(",
"self",
",",
"target",
",",
"latitude",
",",
"longitude",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"slugs_mobile_location_encode",
"(",
"target",
",",
"latitude",
",",
"longitude",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Transmits the last known position of the mobile GS to the UAV. Very
relevant when Track Mobile is enabled
target : The system reporting the action (uint8_t)
latitude : Mobile Latitude (float)
longitude : Mobile Longitude (float) | [
"Transmits",
"the",
"last",
"known",
"position",
"of",
"the",
"mobile",
"GS",
"to",
"the",
"UAV",
".",
"Very",
"relevant",
"when",
"Track",
"Mobile",
"is",
"enabled"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py#L8097-L8107 |
248,993 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py | MAVLink.slugs_configuration_camera_send | def slugs_configuration_camera_send(self, target, idOrder, order, force_mavlink1=False):
'''
Control for camara.
target : The system setting the commands (uint8_t)
idOrder : ID 0: brightness 1: aperture 2: iris 3: ICR 4: backlight (uint8_t)
order : 1: up/on 2: down/off 3: auto/reset/no action (uint8_t)
'''
return self.send(self.slugs_configuration_camera_encode(target, idOrder, order), force_mavlink1=force_mavlink1) | python | def slugs_configuration_camera_send(self, target, idOrder, order, force_mavlink1=False):
'''
Control for camara.
target : The system setting the commands (uint8_t)
idOrder : ID 0: brightness 1: aperture 2: iris 3: ICR 4: backlight (uint8_t)
order : 1: up/on 2: down/off 3: auto/reset/no action (uint8_t)
'''
return self.send(self.slugs_configuration_camera_encode(target, idOrder, order), force_mavlink1=force_mavlink1) | [
"def",
"slugs_configuration_camera_send",
"(",
"self",
",",
"target",
",",
"idOrder",
",",
"order",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"slugs_configuration_camera_encode",
"(",
"target",
",",
"idOrder",
",",
"order",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Control for camara.
target : The system setting the commands (uint8_t)
idOrder : ID 0: brightness 1: aperture 2: iris 3: ICR 4: backlight (uint8_t)
order : 1: up/on 2: down/off 3: auto/reset/no action (uint8_t) | [
"Control",
"for",
"camara",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py#L8120-L8129 |
248,994 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py | MAVLink.volt_sensor_send | def volt_sensor_send(self, r2Type, voltage, reading2, force_mavlink1=False):
'''
Transmits the readings from the voltage and current sensors
r2Type : It is the value of reading 2: 0 - Current, 1 - Foreward Sonar, 2 - Back Sonar, 3 - RPM (uint8_t)
voltage : Voltage in uS of PWM. 0 uS = 0V, 20 uS = 21.5V (uint16_t)
reading2 : Depends on the value of r2Type (0) Current consumption in uS of PWM, 20 uS = 90Amp (1) Distance in cm (2) Distance in cm (3) Absolute value (uint16_t)
'''
return self.send(self.volt_sensor_encode(r2Type, voltage, reading2), force_mavlink1=force_mavlink1) | python | def volt_sensor_send(self, r2Type, voltage, reading2, force_mavlink1=False):
'''
Transmits the readings from the voltage and current sensors
r2Type : It is the value of reading 2: 0 - Current, 1 - Foreward Sonar, 2 - Back Sonar, 3 - RPM (uint8_t)
voltage : Voltage in uS of PWM. 0 uS = 0V, 20 uS = 21.5V (uint16_t)
reading2 : Depends on the value of r2Type (0) Current consumption in uS of PWM, 20 uS = 90Amp (1) Distance in cm (2) Distance in cm (3) Absolute value (uint16_t)
'''
return self.send(self.volt_sensor_encode(r2Type, voltage, reading2), force_mavlink1=force_mavlink1) | [
"def",
"volt_sensor_send",
"(",
"self",
",",
"r2Type",
",",
"voltage",
",",
"reading2",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"volt_sensor_encode",
"(",
"r2Type",
",",
"voltage",
",",
"reading2",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Transmits the readings from the voltage and current sensors
r2Type : It is the value of reading 2: 0 - Current, 1 - Foreward Sonar, 2 - Back Sonar, 3 - RPM (uint8_t)
voltage : Voltage in uS of PWM. 0 uS = 0V, 20 uS = 21.5V (uint16_t)
reading2 : Depends on the value of r2Type (0) Current consumption in uS of PWM, 20 uS = 90Amp (1) Distance in cm (2) Distance in cm (3) Absolute value (uint16_t) | [
"Transmits",
"the",
"readings",
"from",
"the",
"voltage",
"and",
"current",
"sensors"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py#L8172-L8181 |
248,995 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py | MAVLink.ptz_status_send | def ptz_status_send(self, zoom, pan, tilt, force_mavlink1=False):
'''
Transmits the actual Pan, Tilt and Zoom values of the camera unit
zoom : The actual Zoom Value (uint8_t)
pan : The Pan value in 10ths of degree (int16_t)
tilt : The Tilt value in 10ths of degree (int16_t)
'''
return self.send(self.ptz_status_encode(zoom, pan, tilt), force_mavlink1=force_mavlink1) | python | def ptz_status_send(self, zoom, pan, tilt, force_mavlink1=False):
'''
Transmits the actual Pan, Tilt and Zoom values of the camera unit
zoom : The actual Zoom Value (uint8_t)
pan : The Pan value in 10ths of degree (int16_t)
tilt : The Tilt value in 10ths of degree (int16_t)
'''
return self.send(self.ptz_status_encode(zoom, pan, tilt), force_mavlink1=force_mavlink1) | [
"def",
"ptz_status_send",
"(",
"self",
",",
"zoom",
",",
"pan",
",",
"tilt",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"ptz_status_encode",
"(",
"zoom",
",",
"pan",
",",
"tilt",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Transmits the actual Pan, Tilt and Zoom values of the camera unit
zoom : The actual Zoom Value (uint8_t)
pan : The Pan value in 10ths of degree (int16_t)
tilt : The Tilt value in 10ths of degree (int16_t) | [
"Transmits",
"the",
"actual",
"Pan",
"Tilt",
"and",
"Zoom",
"values",
"of",
"the",
"camera",
"unit"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/slugs.py#L8194-L8203 |
248,996 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/paparazzi.py | MAVLink.script_request_send | def script_request_send(self, target_system, target_component, seq, force_mavlink1=False):
'''
Request script item with the sequence number seq. The response of the
system to this message should be a SCRIPT_ITEM
message.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
'''
return self.send(self.script_request_encode(target_system, target_component, seq), force_mavlink1=force_mavlink1) | python | def script_request_send(self, target_system, target_component, seq, force_mavlink1=False):
'''
Request script item with the sequence number seq. The response of the
system to this message should be a SCRIPT_ITEM
message.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
'''
return self.send(self.script_request_encode(target_system, target_component, seq), force_mavlink1=force_mavlink1) | [
"def",
"script_request_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"seq",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"script_request_encode",
"(",
"target_system",
",",
"target_component",
",",
"seq",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | Request script item with the sequence number seq. The response of the
system to this message should be a SCRIPT_ITEM
message.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t) | [
"Request",
"script",
"item",
"with",
"the",
"sequence",
"number",
"seq",
".",
"The",
"response",
"of",
"the",
"system",
"to",
"this",
"message",
"should",
"be",
"a",
"SCRIPT_ITEM",
"message",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/paparazzi.py#L7322-L7333 |
248,997 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/paparazzi.py | MAVLink.script_count_send | def script_count_send(self, target_system, target_component, count, force_mavlink1=False):
'''
This message is emitted as response to SCRIPT_REQUEST_LIST by the MAV
to get the number of mission scripts.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
count : Number of script items in the sequence (uint16_t)
'''
return self.send(self.script_count_encode(target_system, target_component, count), force_mavlink1=force_mavlink1) | python | def script_count_send(self, target_system, target_component, count, force_mavlink1=False):
'''
This message is emitted as response to SCRIPT_REQUEST_LIST by the MAV
to get the number of mission scripts.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
count : Number of script items in the sequence (uint16_t)
'''
return self.send(self.script_count_encode(target_system, target_component, count), force_mavlink1=force_mavlink1) | [
"def",
"script_count_send",
"(",
"self",
",",
"target_system",
",",
"target_component",
",",
"count",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"script_count_encode",
"(",
"target_system",
",",
"target_component",
",",
"count",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | This message is emitted as response to SCRIPT_REQUEST_LIST by the MAV
to get the number of mission scripts.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
count : Number of script items in the sequence (uint16_t) | [
"This",
"message",
"is",
"emitted",
"as",
"response",
"to",
"SCRIPT_REQUEST_LIST",
"by",
"the",
"MAV",
"to",
"get",
"the",
"number",
"of",
"mission",
"scripts",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/paparazzi.py#L7367-L7377 |
248,998 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/paparazzi.py | MAVLink.script_current_send | def script_current_send(self, seq, force_mavlink1=False):
'''
This message informs about the currently active SCRIPT.
seq : Active Sequence (uint16_t)
'''
return self.send(self.script_current_encode(seq), force_mavlink1=force_mavlink1) | python | def script_current_send(self, seq, force_mavlink1=False):
'''
This message informs about the currently active SCRIPT.
seq : Active Sequence (uint16_t)
'''
return self.send(self.script_current_encode(seq), force_mavlink1=force_mavlink1) | [
"def",
"script_current_send",
"(",
"self",
",",
"seq",
",",
"force_mavlink1",
"=",
"False",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"script_current_encode",
"(",
"seq",
")",
",",
"force_mavlink1",
"=",
"force_mavlink1",
")"
] | This message informs about the currently active SCRIPT.
seq : Active Sequence (uint16_t) | [
"This",
"message",
"informs",
"about",
"the",
"currently",
"active",
"SCRIPT",
"."
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/paparazzi.py#L7388-L7395 |
248,999 | JdeRobot/base | src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_c.py | generate | def generate(basename, xml_list):
'''generate complete MAVLink C implemenation'''
for idx in range(len(xml_list)):
xml = xml_list[idx]
xml.xml_idx = idx
generate_one(basename, xml)
copy_fixed_headers(basename, xml_list[0]) | python | def generate(basename, xml_list):
'''generate complete MAVLink C implemenation'''
for idx in range(len(xml_list)):
xml = xml_list[idx]
xml.xml_idx = idx
generate_one(basename, xml)
copy_fixed_headers(basename, xml_list[0]) | [
"def",
"generate",
"(",
"basename",
",",
"xml_list",
")",
":",
"for",
"idx",
"in",
"range",
"(",
"len",
"(",
"xml_list",
")",
")",
":",
"xml",
"=",
"xml_list",
"[",
"idx",
"]",
"xml",
".",
"xml_idx",
"=",
"idx",
"generate_one",
"(",
"basename",
",",
"xml",
")",
"copy_fixed_headers",
"(",
"basename",
",",
"xml_list",
"[",
"0",
"]",
")"
] | generate complete MAVLink C implemenation | [
"generate",
"complete",
"MAVLink",
"C",
"implemenation"
] | 303b18992785b2fe802212f2d758a60873007f1f | https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_c.py#L689-L696 |
Subsets and Splits