Photo.py example provided on github not working

I tried running the code provided here but couldn’t get it to work.

I read on other topics like this one Get real-time photos from the Anafi in sphinx - #2 by ndessart
on how to try to get it working.

As I am running the Sphinx simulation, I changed the IP Address and the photo mode to “single” and also removed the assert statements as they were causing some issue.

Just as mentioned in the above post

photo_saved.wait(_timeout=30).success()

is timing out. After that

photo_progress_info = photo_saved.received_events().last().args

is just returning None. Without the media_id there is no way to know what file to download.

This is the error I am getting

Traceback (most recent call last):
  File "/app/latest/photo.py", line 125, in <module>
    test_photo()
  File "/app/latest/photo.py", line 121, in test_photo
    main(drone)
  File "/app/latest/photo.py", line 115, in main
    take_photo_burst(drone)
  File "/app/latest/photo.py", line 51, in take_photo_burst
    photo_progress_info = photo_saved.received_events().last().args
AttributeError: 'NoneType' object has no attribute 'args'

Please help on how to download the photo while using simulation.

I am having the same issue and the assertion fails at the following command:

assert drone.media(
    indexing_state(state="indexed")
).wait(_timeout=60).success()

In general, the drone fails to even set_photo_mode, where calling the following method fails as well:

drone(
    set_photo_mode(
        cam_id=0,
        mode="single",
        format="rectilinear",
        file_format="jpeg",
        burst="burst_14_over_1s",
        bracketing="preset_1ev",
        capture_interval=0.0,
    )
).wait(_timeout=60).success()

When set_camera_mode is called (with cam_id=0 and value=“photo”) and after the above command, the following debug information is printed:

2022-02-13 17:24:21,601 [INFO] 	olympe.drone.ANAFI Ai 000000 - _recv_cmd_cb - camera2.Event.State(camera_id=0, active=True, current_capabilities=camera2.Capabilities(rules=()), config=camera2.Config(photo_format='rectilinear', photo_streaming_mode='continuous', video_recording_resolution='2160p', video_recording_framerate='30', exposure_maximum_iso_sensitivity='1600', white_balance_mode='automatic', ev_compensation='0_00', image_style='standard', auto_record_mode='flight', camera_mode='photo', photo_mode='single', photo_dynamic_range='standard', photo_file_format='jpeg', video_recording_mode='standard', video_recording_dynamic_range='standard', exposure_mode='automatic', white_balance_temperature='1500', image_contrast=0.0, image_saturation=0.0, image_sharpness=0.0, zoom_velocity_control_quality_mode='allow_degradation'), white_balance_lock=camera2.Event.State.WhiteBalanceLock(supported_modes=('unlocked', 'locked'), mode='unlocked'), exposure_lock=camera2.Event.State.ExposureLock(supported_modes=('unlocked', 'full_lock', 'roi_lock'), mode='unlocked'), zoom=camera2.Event.State.Zoom(zoom_level_max=6.014731352298322, zoom_high_quality_level_max=1.0), media_metadata=camera2.MediaMetadata(copyright='', custom_id='', custom_title=''))
2022-02-13 17:24:25,881 [INFO] 	olympe.drone.ANAFI Ai 000000 - _link_quality_cb - Link quality: tx=57, rx=100, rx_useful=98
2022-02-13 17:24:30,881 [INFO] 	olympe.drone.ANAFI Ai 000000 - _link_quality_cb - Link quality: tx=-1, rx=100, rx_useful=100
2022-02-13 17:24:31,586 [INFO] 	olympe.drone.ANAFI Ai 000000 - _send_command_impl - camera.set_photo_mode(cam_id=0, mode='single', format='rectilinear', file_format='jpeg', burst='burst_14_over_1s', bracketing='preset_1ev', capture_interval=0.0) has been sent to the device

After that, the assertion fails every time.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.