-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
Bug report
- AirSim Version/#commit: 1.4.0
- UE/Unity version: tested using UE NH environment from airsim-1.4.0
- autopilot version: -
- OS Version: Windows 10
What's the issue you encountered?
AirSim's python bindings require msgpack-rpc-python, which depends on an obsolete version of msgpack (related issue: #3251). That old version of msgpack doesn't compile, so it falls back to a pure Python implementation which is very slow - in my workflow, more than half the time is spent in msgpack rather than, e.g. rendering.
Settings
{
"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
"SettingsVersion": 1.2,
"SimMode": "ComputerVision",
"CameraDefaults": {
"CaptureSettings": [
{
"ImageType": 0,
"Width": 112,
"Height": 112,
"FOV_Degrees": 120,
"AutoExposureSpeed": 100
}
]
}
}
How can the issue be reproduced?
- Create a new, clean conda environment, e.g.
conda create --name test python=3.8 - Activate it,
conda activate test pip install airsim- Run the NH sample
- Create a file
test.pywith the following code:
import airsim
client = airsim.VehicleClient()
client.confirmConnection()
for i in range(10):
responses = client.simGetImages([
airsim.ImageRequest("front_center", airsim.ImageType.Scene, False, False),
])
- Run this file under the profiler:
python -m cProfile test.py. Scroll down and you will see many calls tofallback.py, e.g.:
181988/36 0.202 0.000 0.884 0.025 fallback.py:380(_fb_unpack)
fallback.py is the pure Python fallback from msgpack: https://github.com/msgpack/msgpack-python/blob/master/msgpack/fallback.py.
A quick way of figuring out if msgpack is installed with compiled bindings: from msgpack import _cmsgpack. If it's not, things are going to be real slow.
Include full error message in text form
No errors, just slowness
Workaround
I found a nasty workaround. I uninstalled airsim, msgpack-python and mspack-rpc-python. I then pip installed from git this upgraded fork of msgpack-rpc-python: https://github.com/tbelhalfaoui/msgpack-rpc-python/tree/fix-msgpack-dep. Then I git cloned airsim, locally installed in editable mode, and I patched client.py to remove the input and output encodings (those were removed in msgpack 1.0). Now my pipeline is much much faster.
What's better than filing an issue? Filing a pull request :).