You are browsing as a guest. Sign up (or log in) to start making projects!

Drone Racing Simulator

  • 2 Devlogs
  • 8 Total hours

This simulation shows a drone navigating through 3D space using a physics-based model with gravity, drag, thrust, and a PD controller guiding it through a sequence of gates. The interactive Plotly animation includes play/pause controls and a slider to visualize the forces acting on the drone at each frame.

Ship #1

I built a 3D drone racing simulator in Python that uses physics-based motion (gravity, thrust, drag) and a PD controller to guide a drone through a series of 3D gates. The simulation is visualized in an interactive Plotly 3D environment with an animated trajectory, colour-coded speed, and real-time force vectors, along with play/pause controls and a time slider for scrubbing through the motion. The main challenge was balancing stable control with realistic physics while also getting the Plotly animation system (especially the slider and frame updates) to behave correctly. I’m most proud of making the simulation visually intuitive and extensible toward a full rigid-body drone model in the future. To run it, users just need Python with NumPy and Plotly installed, then execute the script to generate an HTML file they can open in a browser to interact with the simulation.

  • 2 devlogs
  • 8h
  • 13.08x multiplier
  • 110 Stardust
Try project → See source code →
Open comments for this post

6h 6m 37s logged

Devlog #2

I added a coloured speed visualization to the trajectory trail, where the drone’s path is now colour-mapped based on instantaneous velocity. This makes it much easier to see acceleration and braking behaviour during gate transitions.

I also improved the 3D animation system so the force vectors are more stable and visually consistent across frames, especially during high-acceleration segments.

On top of that, I refined the Plotly animation controls so the slider state behaves more reliably when interacting with play/pause, and the camera no longer resets unexpectedly when scrubbing through frames.

The visualization is now significantly more readable, especially when analyzing control performance over time.

The orientation system is still derived from motion (based on velocity and thrust direction), but it is now more consistent and ready for the next stage, where orientation will directly affect movement.

The next step is to transition from a point-mass approximation to a full rigid-body model, where roll, pitch, and yaw actively influence thrust direction and overall dynamics.

0
0
4
Open comments for this post

2h 16m 4s logged

I started building a 3D drone racing simulator in Python to better understand physics-based motion and control systems.

The goal is to eventually get to a full rigid-body drone model, but I’m starting simple and building up.

Right now, the system treats the drone as a point mass:

State: position + velocity
Forces: gravity, thrust, and air drag
Motion follows Newton’s law (F = ma)

A PD controller drives the drone through a set of 3D gates by minimizing position error and damping velocity.

To evaluate performance, I added metrics like lap time, energy usage, tracking error, and a final score that combines them.

For visualization, I’m using Plotly to render the 3D trajectory and gate positions, which makes it much easier to debug control behaviour.

The first major upgrade was adding a basic orientation layer. Instead of just plotting a point, I compute a forward direction from velocity so the drone “faces” where it is moving.

Right now, orientation is derived from motion. The next step is flipping that relationship so orientation starts affecting motion. This is through roll, pitch, and yaw.

The next update will focus on adding real rotational dynamics and moving toward a rigid-body model instead of a point mass.

0
0
2

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…