Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals
This work has been published and presented at ICRA2019 (The 2019 International Conference on Robotics and Automation).
It will be updated continuously. Stay tuned.
To cite this work in publications:
@inproceedings{fei2019flappy,
title={Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals},
author={Fei, Fan and Tu, Zhan and Yang, Yilun and Zhang, Jian and Deng, Xinyan},
booktitle={2019 IEEE International Conference on Robotics and Automation (ICRA)},
pages={9223--9229},
year={2019},
organization={IEEE}
}
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Flappy requires python3 with the development headers. You'll also need some other system packages. DART is required as a simulation engine (and we use pydart2 as interface). They can be installed as follows
# 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
pip install click
Make sure you install version 6.2.1 by changing
git checkout tags/v6.8.2
to
git checkout tags/v6.2.1
Please refer the official DART installation document when you have problems.
Installation of system packages on Mac requires Homebrew. With Homebrew installed, run the follwing:
# install system packages
brew install cmake openmpi
# install dart
brew install dartsim
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. Creation of virtual environments is done by executing the command venv:
python3 -m venv /path/to/new/virtual/environment
To activate a venv:
source /path/to/venv/bin/activate
Pydart2 is a python binding to DART.
pip install pydart2
If this does not work please try to install from source. Please refer to document when you have problems.
Tensorflow is needed for the usage of neural network. If you want to make use of your GPU, please install the tensorflow with gpu
Please make sure you install tensorflow version < 2.0
pip install tensorflow-gpu # if you have a CUDA-compatible gpu and proper drivers
else
pip install tensorflow==1.9
please refer to TensorFlow installation guide for more details.
Clone the repo and cd into it:
git clone https://github.com/purdue-biorobotics/flappy.git
cd flappy
Install Flappy package
pip install -e .
Lack dependency
pip [Dependency lack of]
or
apt-get install [Dependency lack of]
Dual motor driven flapping wing robots based on the Purdue Hummingbird robot.
The control of this vehicle is a difficult problem. We challenge developers, researchers, scientists and roboticists to come up with better control algorithms, either feedback controller or learning-based controller.
Two default working controller are included: a cascading PID controller (control structure similar to ArduPilot) and an Adaptive Robust Controller (ARC). These two controllers can be evaluated in the provided test script.
This environment is for controlling the dual wing flappin wing robot.
The four inputs are the thrust and torque signals:
This mode of control is similar to helicopter or quadcopter control. The sinusoidal voltage signal drives the wing back and forth is generated by using wing beat modulation.
The input actions are in [-1,1] and will be scaled to their appropriate range. If implementing a feedback controller, the input should be scaled to [-1,1]. See the baseline PID controller and test example for detail.
python test.py --model_type=PID
python test.py --model_type=ARC
We choose to use stable baselines instead of baselines as our RL library. Note that our environment still follows the specification of the gym/env, so baselines can be applied to our env as well.
python train.py --model_type=PPO2 --model_path=ppo2_mlp --policy_type=MlpPolicy --n_cpu=12 --time_step=100000
python test.py --model_type=PPO2 --model_path=ppo2_mlp --policy_type=MlpPolicy
This environment similar to 'fwmav_hover-v0'
, but without using [wing beat modulation][doman2010wingbeat].
An example using PID is in test_simple.py
, this example still uses the same PID controller and wing beat modulation. But the input to the environment are just two voltage signals ([-18,18] volt) supplied to the two motors.
To develop a new control policy, the policy should generate sinusoidal signals near 34Hz to drive the wings and implement control at the same time. Without specifying the wing kinematics allows the ability to generate torque and force in arbitrary directions.
python test_simple.py --model_type=PID
python test_simple.py --model_type=ARC
Fan Fei, Ruoyu Wu, Jian Zhang, Zhan Tu, Yunlei Yan, Yuan-Cheng Chen
MIT