This guide provides solutions to common issues you might encounter while setting up and running the Flightmare simulator. These are thesome of problem we faced while installing and we have provided a detailed guide on how to soilve it.
Symptom: When trying to install Flightmare using the commands below:
cd flightmare/flightlib
pip install .
Installing OpenCV
within a Docker image took significantly longer than expected:
Building wheel for opencv-python (pyproject.toml) ... -
Possible Cause: Two problems were faced as listed below:
-
The installation process repeatedly downloads multiple versions of the
gym
package, indicating possible dependency resolution problems or version incompatibilities. -
The installation encountered dependency conflicts between required versions of packages, which might have caused the installation process to take too long and not complete successfully.
Solution:
- Running the
opencv-python
installation command with the--verbose
flag to monitor progress closely which resloved the issue:
sudo pip install opencv-python --verbose
Symptom: When attempting to run the run_drone_control.py
script to run a provided test simulation of the drone using the commands below:
cd flightctrl
cd examples
python3 run_drone_control.py --train 0 --render 1
The following traceback error was encountered:
Traceback (most recent call last):
File "run_drone_controltest.py", line 92, in <module>
main()
File "run_drone_controltest.py", line 52, in main
yaml.dump(cfg), False))
File "/home/sdp/anaconda3/envs/ENVNAME/lib/python3.6/site-packages/ruamel/yaml/main.py", line 591, in dump
raise TypeError('Need a stream argument when not dumping from context manager')
TypeError: Need a stream argument when not dumping from context manager
Possible Cause:
- The issue was caused by the incorrect usage of the
yaml.dump
method in the python script. The error messageTypeError: Need a stream argument when not dumping from context manager
indicated that yaml.dump requires a stream to write to when not used within a context manager.
Solution: To resolve this issue:
-
Imported StringIO: First, the
StringIO
class from theio
module was imported.StringIO
allows us to treat strings as file-like objects. -
Used StringIO for YAML Dump: Instead of calling
yaml.dump(cfg)
, which caused the error, I usedyaml.dump(cfg, stream)
wherestream
is aStringIO
object. This change provided a valid stream foryaml.dump
to write the YAML content to. -
Passed YAML String to Environment: After dumping the YAML configuration to
stream
, the string content ofstream
(stream.getvalue()
) was passed toQuadrotorEnv_v1
as its configuration parameter.
Symptom: When attempting to install flightmare
ModuleNotFoundError: No module named 'rpg_baselines'
Possible Cause:
- The issue was caused by the setup.py file in flightrl folder due to missing of packages.
Solution: To resolve this issue:
-
In the path flightmare/flightrl/setup.py, add package content 'rpg_baselines','rpg_baselines.ppo'.'rpg_baselines.common','rpg_baselines.envs' as shown below
-
packages=['rpg_baselines' 'rpg_baselines.ppo', 'rpg_baselines.common', 'rpg_baselines.envs'],