Skip to content

tudelft/fastPyDroneSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastPyDroneSim

Description

Fast drone sim in python (currently linear quadrotors only). Vectorized on CPU cranking about 5M timesteps per second on a laptop i7. Also vectorized for GPU with up to 250M timesteps per second (RTX A1000), but if the state at every time step needs to be logged and be available to the CPU after simulation, then that number reduces to 20M or so.

Visuals in THREE.js with a websocket connection, inspired by the Learning to Fly in Seconds paper (https://arxiv.org/abs/2311.13081).

This gif shows the visualization of 512 quadrotors, although 8192 were simulated on a RTX A1000 graphics card.

Authors or Maintainers

Till Blaha - @tblaha

Requirements

Ubuntu 22.04 tested only. Visuals require docker.

Python dependencies can be installed with:

pip install -r requirements.txt

CUDA

Cuda can be a hassle to install. For Ubuntu 22.04 on my machine, the following worked, but there may be (must be!) easier ways, perhaps with a different version.

  • Delete all current nvidia things sudo apt purge "nvidia-*" "libnvidia-*" "cuda-*" "linux-modules-nvidia-*"
  • sudo apt autoremove
  • Make sure that "Using X.Org X server" is selected in "Software & Updates" > "Additional Drivers"
  • Compile the latests 550 driver from scratch for your kernel (6.1.0-1036-oem in my case)
sudo apt install gcc-12
sudo update-alternatives --install  /usr/bin/cc cc /usr/bin/x86_64-linux-gnu-gcc-12 100
chmod +x ./NVIDIA-Linux-x86_64-550.54.14.run
sudo ./NVIDIA-Linux-x86_64-550.54.14.run        # say yes to everything
sudo apt install cuda-driver-550 nvidia-compute-utils-550

Running

Visuals

Build docker image of the webserver for the visuals

docker build -t devserver . -f dockerfile

Run it with

docker run -it --net host -v ./static:/usr/app/static devserver

Open the URL reported by the docker container in a WebGL capable browser.

Simulation

ipython -i sim.py

Check options at the top of sim.py for configuration.

Structure

.
├── benchmarks/  # unrelated code for testing numba/cuda
├── libs/        # math functions, compute kernels and visualization interface
├── static/      # the visualization frontend code
├── dockerfile   # sets up a Vite development webserver to host the visuals
├── crafts.py    # contains the drone definitions (currently only quadrotor)
├── sim.py       # simulation main function
├── LICENSE
├── README.md
└── requirements.txt

License

Copyright (C) 2024 Till Blaha -- TU Delft

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

References

Eschmann, Albani and Loianno, "Learning to Fly in Seconds", 2023, arXiv 2311.13081

Citation

Would you like to contribute?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published