Code Monkey home page Code Monkey logo

flightsim's Introduction

UIUC Vertically Landed Rocket Challenge 2022

We added a slider to the flight sim in order to get a feel of how each value (ignition delay, Kp, and Kd) changes the flight for randomized wind and initial angular velocity, and used it to get a ballpark estimate of the values.

Then we used a CMA-ES (Covariance-Matrix Adaptation Evolution Strategy) python library to optimize this initial guess. The algorithm tries 20 combinations of the 3 parameters close to the previous guess, picks the best, then picks 20 more to try that are close to the new best guess. If the variance of the scores of the last 20 tries is large, then the next 20 guesses are allowed to be farther away from the best guess. This way, the algorithm spreads out for a broader search when needed. To determine how "good" a combination of values is, it simulated 20 times at random wind and initial conditions and we define the cost = average_landing_speed + 10*average_landing_angle. So, we look for a combination that has the lowest possible cost number to minimize landing speed and angle. After computing 10 iterations (4000 simulations) for 5 minutes, the program usually converges around:

Ignition delay = 1.17±0.01

Kp = 0.05±0.03

Kd = 0.002±0.004

Optimizer code here

We ended up using an ignition delay of 0.67s because we saw that the demo fired around 0.5s after the simulation said it would, and 1.17-0.5=0.67. It's hard to tell if this approach actually gives better results than tuning manually, but it was definitely fun to try :)

Run FlightSimMain.py for adjusting drop height and ignition time, FlightSimMain_old.py is the original sliders

flightsim's People

Contributors

qwertpas avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.