Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals运行测试

项目:

Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals----Flappy Hummingbird

运行环境:

  1. python3;
  2. DART toolkit;pydart2 as interface;

配置环境:

  1. 在Ubuntu系统下:
# install system packages
sudo apt-get update && sudo apt-get install cmake libopenmpi-dev python3-dev zlib1g-dev swig python3-pip python3-pyqt4 python3-pyqt4.qtopengl

# install dart
sudo apt-add-repository ppa:dartsim
sudo apt-get update
sudo apt-get install libdart6-all-dev
  1. 配置虚拟环境(以下操作均在该虚拟环境下运行):
# create a virtual
python3 -m venv /path/to/new/virtual/environment
# activate a venv
source /path/to/venv/bin/activate

具体实现:

db@db403:~$ python3 -m venv /home/db/virtualenvs
db@db403:~$ source /home/db/virtualenvs/bin/activate

Note:
为什么在虚拟环境下运行:From the general python package sanity perspective, it is a good idea to use virtual environments (virtualenvs) to make sure packages from different projects do not interfere with each other.
以下的所有操作均在该虚拟环境下运行。

  1. 安装Pydart2并且绑定DART;
pip install pydart2

Note:
这里注意pip的版本为最新版本,并且绑定在python3下;

  1. 安装Tensorflow
pip install tensorflow-gpu # if you have a CUDA-compatible gpu and proper drivers
# or
pip install tensorflow

  1. clone 该repo,并且cd该目录下:
git clone https://github.com/purdue-biorobotics/flappy.git
cd flappy
  1. 安装Flappy 相应的package:
pip install -e .

运行:

Testing with Closed loop controller (PID or ARC)

python test.py --model_type=PID
python test.py --model_type=ARC

这里会出现:
Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals运行测试_第1张图片解决措施参考:cannot import name ‘pydart2_api’
解决如下:

  1. 下载该pydart2,并运行python3 setup.py build
git clone https://github.com/sehoonha/pydart2.git
cd pedart2
python3 setup.py build

会生成相应的:
Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals运行测试_第2张图片
在这里可以看到已经生成了相应的pydart2_api.py,所以找到该文件,并且复制到所缺失的文件夹下即可。

  1. 复制文件;粘贴文件;

大功告成:

Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals运行测试_第3张图片

你可能感兴趣的:(机器学习)