AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

image_data_float always returns an empty image (i.e. list composed of [0.0])

Open rallen10 opened this issue 4 years ago • 8 comments

This seems to be a persistent, unaddressed problem based on other issues dating back more than a year (https://github.com/microsoft/AirSim/issues/2089, https://github.com/microsoft/AirSim/issues/2169, https://github.com/microsoft/AirSim/issues/2665, https://github.com/microsoft/AirSim/issues/1840). The only difference for me is that 1. I am running in Unity, and 2. the image is always empty, therefore the workaround to discard image and grab the next one if it is empty doesn't work for me.

To reproduce:

import airsim
import numpy as np
client = airsim.MultirotorClient(timeout_value = 7200)
client.confirmConnection()
while True:
        response = client.simGetImages([airsim.ImageRequest("1", airsim.ImageType.DepthPerspective, pixels_as_float=True, compress=False)])[0]
        img1d = np.array(response.image_data_float, dtype=np.float)
        if len(img1d) != response.height * response.width:
            print('empty or bad image. Retrying...')
        else:
            print('properly formatted image!')
            break

rallen10 avatar Jul 22 '20 23:07 rallen10

I found pull request https://github.com/microsoft/AirSim/pull/2812 from a similar issue: https://github.com/microsoft/AirSim/issues/2811. I tried merging the pull request locally and rebuilding AirSim and the Unity wrapper, but to no effect. Still getting the same problem with an empty image

edit: typo

rallen10 avatar Jul 23 '20 01:07 rallen10

Same problem in Unity

chanho-code avatar Aug 18 '20 05:08 chanho-code

I encountered the same problem in Unity, did you solve it?

weigangwen avatar Nov 08 '20 12:11 weigangwen

This issue has been automatically marked as stale because it has not had activity from the community in the last year. It will be closed if no further activity occurs within 20 days.

stale[bot] avatar Apr 17 '22 13:04 stale[bot]

I also used unity to develop, and found the same problem as yours in the latest airsim version. Have you finally solved it

SworterW avatar Nov 11 '22 10:11 SworterW

@SworterW @weigangwen @chanho-code @rallen10 I am also facing the same issue (using Unity), were you able to solve this issue?

sandilyasg avatar Nov 06 '23 21:11 sandilyasg

Sorry I haven't looked at this work in years. Honestly can't remember if I found a solution, a workaround, or just abandoned this part of my project all together.

Not very helpful, I know, but figured I shouldn't leave you all hanging

rallen10 avatar Nov 07 '23 19:11 rallen10

@rallen10 Thanks for your reply! Are you able to share the github repo of your project?

sandilyasg avatar Nov 07 '23 20:11 sandilyasg