Page 1 of 1

New simulation software to aid PID research and development

Posted: Tue Jul 29, 2014 11:58 pm
by BirdShredder
I was planning to play around with some PID algorithms. But I could not find a simulator fitting my needs. Thus I created one. It is not finished, but it is in a state that it might be useful for someone else.

I'm not a physicist and primarily relying on the physics I learned long ago in high school. I would very much appreciate reviews of the code by anyone.(it is just 200 or 300 lines of code)

Image

https://github.com/yschaeff/quadsim

What is it and why?

This is a multirotor physics simulator specifically designed to help
in development and research of PID controllers. It has been kept as
simple as possible to make the code accessible for others as well.

Almost all calculations are made in 3D, it should be relatively easy to
switch to a 3D gui at a later time. Currently a two
rotor craft is simulated, adding more rotors should be trivial.

Features
* (should have) accurate physics
* accessible code
* aircraft steerable
* reasonable drag model
* motors do not respond infinitely fast

Missing features
* Sensors (with jitter and max update frequency)
* propellers are not modelled.
* Yaw (motors generate no toque along their shaft)
* controller should not run every simulation step

Usage

python quadsim.py

Then use arrowkeys to steer the aircraft and spacebar to reset motion

You will additionally need numpy and pygame packages

Re: New simulation software to aid PID research and developm

Posted: Thu Jul 31, 2014 10:50 pm
by BirdShredder
Among fixing the drag model I also included a pidcontroller run time. If you want, you can study the effects of a slow processor on the stability of the aircraft and the required PID values. Or even vary the speed the motors can react.

Re: New simulation software to aid PID research and developm

Posted: Fri Aug 01, 2014 6:27 pm
by Zenman
Interesting! I don't know anything about coding so I'm sorry to not be able to contribute, but I think an accurate model of pid algorithms used by mwc could be quite useful. Hope you go forward with this. How can I try it out? Do you have a compiled exe?

Re: New simulation software to aid PID research and developm

Posted: Sat Aug 02, 2014 12:28 pm
by BirdShredder
I guess you are on Windows. You will have to install the Python interpreter. Make sure you get the SciPy and pygame packages as well. When you did that you can start quadsim.py

https://www.python.org/downloads/windows/
http://www.pygame.org/download.shtml
http://www.scipy.org/install.html