Skip to content

Commit

Permalink
Merge pull request #326 from mavlink/pr-update-v0.38.2
Browse files Browse the repository at this point in the history
Update to MAVSDK v0.38.2
  • Loading branch information
julianoes authored Mar 26, 2021
2 parents 3239936 + c267f31 commit 37131ad
Show file tree
Hide file tree
Showing 11 changed files with 833 additions and 37 deletions.
2 changes: 1 addition & 1 deletion MAVSDK_SERVER_VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
v0.36.0
v0.38.2



88 changes: 84 additions & 4 deletions mavsdk/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,17 +1563,42 @@ class Information:
model_name : std::string
Name of the camera model
focal_length_mm : float
Focal length
horizontal_sensor_size_mm : float
Horizontal sensor size
vertical_sensor_size_mm : float
Vertical sensor size
horizontal_resolution_px : uint32_t
Horizontal image resolution in pixels
vertical_resolution_px : uint32_t
Vertical image resolution in pixels
"""



def __init__(
self,
vendor_name,
model_name):
model_name,
focal_length_mm,
horizontal_sensor_size_mm,
vertical_sensor_size_mm,
horizontal_resolution_px,
vertical_resolution_px):
""" Initializes the Information object """
self.vendor_name = vendor_name
self.model_name = model_name
self.focal_length_mm = focal_length_mm
self.horizontal_sensor_size_mm = horizontal_sensor_size_mm
self.vertical_sensor_size_mm = vertical_sensor_size_mm
self.horizontal_resolution_px = horizontal_resolution_px
self.vertical_resolution_px = vertical_resolution_px

def __equals__(self, to_compare):
""" Checks if two Information are the same """
Expand All @@ -1582,7 +1607,12 @@ def __equals__(self, to_compare):
# Information object
return \
(self.vendor_name == to_compare.vendor_name) and \
(self.model_name == to_compare.model_name)
(self.model_name == to_compare.model_name) and \
(self.focal_length_mm == to_compare.focal_length_mm) and \
(self.horizontal_sensor_size_mm == to_compare.horizontal_sensor_size_mm) and \
(self.vertical_sensor_size_mm == to_compare.vertical_sensor_size_mm) and \
(self.horizontal_resolution_px == to_compare.horizontal_resolution_px) and \
(self.vertical_resolution_px == to_compare.vertical_resolution_px)

except AttributeError:
return False
Expand All @@ -1591,7 +1621,12 @@ def __str__(self):
""" Information in string representation """
struct_repr = ", ".join([
"vendor_name: " + str(self.vendor_name),
"model_name: " + str(self.model_name)
"model_name: " + str(self.model_name),
"focal_length_mm: " + str(self.focal_length_mm),
"horizontal_sensor_size_mm: " + str(self.horizontal_sensor_size_mm),
"vertical_sensor_size_mm: " + str(self.vertical_sensor_size_mm),
"horizontal_resolution_px: " + str(self.horizontal_resolution_px),
"vertical_resolution_px: " + str(self.vertical_resolution_px)
])

return f"Information: [{struct_repr}]"
Expand All @@ -1604,7 +1639,22 @@ def translate_from_rpc(rpcInformation):
rpcInformation.vendor_name,


rpcInformation.model_name
rpcInformation.model_name,


rpcInformation.focal_length_mm,


rpcInformation.horizontal_sensor_size_mm,


rpcInformation.vertical_sensor_size_mm,


rpcInformation.horizontal_resolution_px,


rpcInformation.vertical_resolution_px
)

def translate_to_rpc(self, rpcInformation):
Expand All @@ -1623,6 +1673,36 @@ def translate_to_rpc(self, rpcInformation):





rpcInformation.focal_length_mm = self.focal_length_mm





rpcInformation.horizontal_sensor_size_mm = self.horizontal_sensor_size_mm





rpcInformation.vertical_sensor_size_mm = self.vertical_sensor_size_mm





rpcInformation.horizontal_resolution_px = self.horizontal_resolution_px





rpcInformation.vertical_resolution_px = self.vertical_resolution_px






Expand Down
53 changes: 44 additions & 9 deletions mavsdk/camera_pb2.py

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions mavsdk/log_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ async def get_entries(self):
return entries


async def download_log_file(self, id, path):
async def download_log_file(self, entry, path):
"""
Download log file.
Parameters
----------
id : uint32_t
ID of the log file to download
entry : Entry
Entry of the log file to download.
path : std::string
Path of where to download log file to.
Expand All @@ -394,7 +394,10 @@ async def download_log_file(self, id, path):
"""

request = log_files_pb2.SubscribeDownloadLogFileRequest()
request.id = id

entry.translate_to_rpc(request.entry)


request.path = path
download_log_file_stream = self._stub.SubscribeDownloadLogFile(request)

Expand All @@ -408,7 +411,7 @@ async def download_log_file(self, id, path):
success_codes.append(LogFilesResult.Result.NEXT)

if result.result not in success_codes:
raise LogFilesError(result, "download_log_file()", id, path)
raise LogFilesError(result, "download_log_file()", entry, path)

if result.result is LogFilesResult.Result.SUCCESS:
download_log_file_stream.cancel();
Expand Down
35 changes: 18 additions & 17 deletions mavsdk/log_files_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 37131ad

Please sign in to comment.