This Python script allows you to control a Crazyflie drone using your keyboard. It is designed to provide basic movement controls such as forward, backward, left, right, up, down, and rotation.
Before you start, ensure that you have the following requirements met:
- Crazyflie drone set up and ready to connect
- The Crazyflie Python library
cflib
installed - The
pynput
library installed to capture keyboard inputs
You can install the required Python libraries using pip:
pip install cflib pynput
- Clone the repository to your local machine:
git clone https://github.com/magnaprog/crazyflie-keyboard-controller.git
- Navigate to the cloned repository:
cd crazyflie-keyboard-controller
-
Make sure the Crazyflie drone is turned on and the Crazyradio PA USB dongle is inserted into your computer.
-
Run the script:
python keyboard_control.py
- Once the script is running, use the following keys to control the drone:
w
: Move forwards
: Move backwarda
: Move leftd
: Move rightq
: Rotate lefte
: Rotate rightr
: Move upf
: Move downESC
: Exit the script
Ensure you have enough space to safely fly the Crazyflie drone. It's recommended to use a large, open area free from obstacles. The author is not responsible for any damage caused by using this script. Always prioritize safety and use at your own risk.
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Thanks to the Bitcraze team for the fantastic Crazyflie drone and the comprehensive API.
- Thanks to the developers of the
pynput
library for providing a straightforward way to capture keyboard events.