Hi there. Just recently I was able to take photos with my Parrot drone and download them on my computer by connecting to the Drone via WiFi. However, I haven’t been able to use the thermal camera to take the photo instead. I’m not sure if I should be using the thermal message or the camera message since I’ve read the documentation and for me it’s quite confusing still. Here’s the relevant part of the code:
def take_real_photo(drone):
assert drone.media(
indexing_state(state="indexed")
).wait(_timeout=60).success()
setup_photo_burst_mode(drone)
test_real_drone(drone)
drone.disconnect()
def test_real_drone(drone):
photo_saved = drone(photo_progress(result="photo_saved", _policy="wait"))
drone(take_photo(cam_id=0)).wait()
if not photo_saved.wait(_timeout=30).success():
assert False, "take_photo timedout"
photo_progress_info = photo_saved.received_events().last().args
media_id = photo_progress_info["media_id"]
photo_count = photo_progress_info["photo_count"]
drone.media.download_dir = tempfile.mkdtemp(prefix="olympe_photo_example")
logger.info(
"Download photo burst resources for media_id: {} in {}".format(
media_id,
drone.media.download_dir,
)
)
media_download = drone(download_media(media_id, integrity_check=True))
resources = media_download.as_completed(expected_count=photo_count, timeout=60)
resource_count = 0
for resource in resources:
logger.info(f"Resource: {resource.resource_id}")
if not resource.success():
logger.error(f"Failed to download {resource.resource_id}")
continue
resource_count += 1
with open(resource.download_path, "rb") as image_file:
image_data = image_file.read()
image_xmp_start = image_data.find(b"<x:xmpmeta")
image_xmp_end = image_data.find(b"</x:xmpmeta")
if image_xmp_start < 0 or image_xmp_end < 0:
logger.error(f"Failed to find XMP photo metadata {resource.resource_id}")
continue
image_xmp = ET.fromstring(image_data[image_xmp_start: image_xmp_end + 12])
for image_meta in image_xmp[0][0]:
xmp_tag = re.sub(r"{[^}]*}", "", image_meta.tag)
xmp_value = image_meta.text
if xmp_tag in XMP_TAGS_OF_INTEREST:
logger.info(f"{resource.resource_id} {xmp_tag} {xmp_value}")
logger.info(f"{resource_count} media resource downloaded")
assert resource_count == 14, f"resource count == {resource_count} != 14"
assert media_download.wait(1.).success(), "Photo burst media download"
def setup_photo_burst_mode(drone):
drone(set_camera_mode(cam_id=0, value="photo")).wait()
assert drone(
set_photo_mode(
cam_id=0,
mode="burst",
format="rectilinear",
file_format="jpeg",
burst="burst_14_over_1s",
bracketing="preset_1ev",
capture_interval=0.0,
)
).wait().success()
Do I have to figure out the cam_id? I’ve tried and it changes from photo to video camera, but as far as I know my drone has support for thermal photos as I’ve taken some with some phone app.