• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 06:58
CEST 12:58
KST 19:58
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro4 Preview: On Course0Code S Season 1 - RO8 Preview6[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Sea Duckling Open (Global, Bronze-Diamond) Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Quality of life changes in BW that you will like ? [ASL21] Ro4 Preview: On Course Why there arent any 256x256 pro maps? BGH Auto Balance -> http://bghmmr.eu/ RepMastered™: replay sharing and analyzer site
Tourneys
[Megathread] Daily Proleagues [ASL21] Ro8 Day 4 [ASL21] Ro8 Day 3 Escore Tournament StarCraft Season 2
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Daigo vs Menard Best of 10 OutLive 25 (RTS Game)
Dota 2
The Story of Wings Gaming
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread The Letting Off Steam Thread European Politico-economics QA Mega-thread UK Politics Mega-thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2020 users

[Programming] Quadrotor Physics Simulator

Blogs > Abraxas514
Post a Reply
Abraxas514
Profile Blog Joined May 2010
Canada475 Posts
Last Edited: 2012-10-11 16:33:10
October 11 2012 13:56 GMT
#1
Hello TL!

For my 4th year (last year here in Quebec) I'm working on a big project called "Capstone" which I think most north american universities require their eng students to complete before graduation.

Since I'm in Mech, I'm actually going to BUILD this thing, but as a good little engineer I need to prove to my supervising professor I'm not an ass and actually know this thing can work. So, instead of using SolidWorks or working model, I just programmed in straight in C++/Irrlicht!

Here are some screens:


[image loading]
[image loading][image loading]

Here is the executable:

Capstone quadrotor simulator project

Please test it out, the readme should be plenty helpful.

Let me know if you see any issues with the physics or controls, and if you have any graphical advice. My knowledge of sciences in order of magnitude goes PHYSICS+MATH>>>>>>>programming>>>>>>>>graphics so go easy on me

Thanks!

PS: let me know what your FPS is! if it's below 100, please provide PC specs

Fear is the mind killer
frogmelter
Profile Blog Joined April 2009
United States971 Posts
October 11 2012 17:04 GMT
#2
Weird chrome is providing a suspicious file alert....
TL+ Member
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
October 11 2012 18:33 GMT
#3
Nice work! 3d engine with textures and collision detection! Being able to program while also do the mechanical design makes you a prime candidate for modern engineering jobs. Did you open source this?
Any sufficiently advanced technology is indistinguishable from magic
CoughingHydra
Profile Blog Joined May 2012
177 Posts
October 11 2012 18:57 GMT
#4
How do you detect collisions between objects?
Recognizable
Profile Blog Joined December 2011
Netherlands1552 Posts
October 11 2012 19:14 GMT
#5
Wait, for your final year in univeristy you are going to build that cross chopper thingy? Kids in my class want to do that for their exam year, in high school. I already expected them to fail hard, but now I don't even think they stand a chance haha.
Abraxas514
Profile Blog Joined May 2010
Canada475 Posts
October 11 2012 23:19 GMT
#6
On October 12 2012 03:33 RoyGBiv_13 wrote:
Nice work! 3d engine with textures and collision detection! Being able to program while also do the mechanical design makes you a prime candidate for modern engineering jobs. Did you open source this?


Didn't open source yet because it's part of my capstone project and I need to keep it as such until the project is complete. Thanks for the comment!

On October 12 2012 03:57 CoughingHydra wrote:
How do you detect collisions between objects?


The following technique works best. You save an array of all the tris of all the models you want to test collision with. You then perform a direction + velocity test against each tri in "collision distance". If your line intersects, you use those parameters to determine the output. I just directly subtracted a fraction of the velocity dot producted onto the normal of the triangle.

On October 12 2012 04:14 Recognizable wrote:
Wait, for your final year in univeristy you are going to build that cross chopper thingy? Kids in my class want to do that for their exam year, in high school. I already expected them to fail hard, but now I don't even think they stand a chance haha.


It's a quadrotor. And there is no way a highschooler can build this without using a flight controller, because the control sequences need physics analysis to compute. You need to have studied Statics, Dynamics, Mechanics of Materials, Control systems 1 (at least), Fluid dynamics and also all the math: differential equations, vector calculus and transform calculus... to program the flight controller.

It sounds like they want to buy one of these:
http://www.hobbyking.com/hobbyking/store/__592__501__Multi_Rotors_Parts-RTF_PNF_ARF.html
and put it together. Good for them, every engineer needs to start somewhere.




BTW if one of the DLLs are giving you errors, just delete it. I included them for redundancy but forgot to give instructions.
Fear is the mind killer
Ssin
Profile Blog Joined August 2010
United States88 Posts
October 12 2012 03:56 GMT
#7
This is very cool, and I will be sure to play around with it. Physics and math are really fun, and when you mix it with programming you can do all kinds of interesting experiments.

Hope it all works out for you!
DarkwindHK
Profile Blog Joined April 2010
Hong Kong343 Posts
October 12 2012 04:05 GMT
#8
man this is really a great work. I study physics in my bachelor degree and I really do not know any programming; just the math and physics you need to know to program will take years to master!

With 4 rotors there is a lot of calculation going on and they all affect each other and the angle of the Quadrotor itself......
Dont be too humble, you are not that great.
Abraxas514
Profile Blog Joined May 2010
Canada475 Posts
Last Edited: 2012-10-13 17:18:40
October 13 2012 17:18 GMT
#9
On October 12 2012 13:05 DarkwindHK wrote:
man this is really a great work. I study physics in my bachelor degree and I really do not know any programming; just the math and physics you need to know to program will take years to master!

With 4 rotors there is a lot of calculation going on and they all affect each other and the angle of the Quadrotor itself......


Here is an excerpt from my control systems code, well commented as a mark of a good programmer




//***** FORCE AND ANGLE OUTPUT CONTROL*****//

// Here is the actual control system.
// First we need to figure out how much force in the Y do we need to balance:
f32 yforce[5] = {0, (vbalance + vycorrecttion * .5), (vbalance + vycorrecttion * .5), (vbalance + vycorrecttion * .5), (vbalance + vycorrecttion * .5)} ;

//Next we adjust yforces for losses while rolling and pitching:
f32 lossfactor = abs(cos(plane.theta.XEGTORAD)) * abs(cos(plane.theta.ZEGTORAD));

yforce[1] /= lossfactor; yforce[2] /= lossfactor;
yforce[3] /= lossfactor; yforce[4] /= lossfactor;

// Next we add/subtract some force to produce roll
yforce[1] -= rollcorrection * rollcf ; yforce[3] -= rollcorrection* rollcf ;
yforce[2] += rollcorrection * rollcf ; yforce[4] += rollcorrection* rollcf ;

// Next we add/subtract some force to produce pitch
yforce[1] += pitchcorrection * pitchcf; yforce[2] += pitchcorrection * pitchcf;
yforce[3] -= pitchcorrection * pitchcf; yforce[4] -= pitchcorrection * pitchcf;


// Next we change diagonal forces to produce yaw
yforce[1] += yawcorrection * yawcf; yforce[4] += yawcorrection * yawcf;
yforce[2] -= yawcorrection * yawcf; yforce[3] -= yawcorrection * yawcf;


// Next we figure out how big our actual force output must be:
f32 totalforce[5] = {0, yforce[1] / cos(plane.f[1].theta), yforce[2] / cos(plane.f[2].theta),yforce[3] / cos(plane.f[3].theta),yforce[4] / cos(plane.f[4].theta)};

//// Increase by speedfactor:
totalforce[1] *= speedfactor; totalforce[2] *= speedfactor;totalforce[3] *= speedfactor;totalforce[4] *= speedfactor;
//
//// Recalculate y:
yforce[1] = totalforce[1]*cos(plane.f[1].theta); yforce[2] = totalforce[2]*cos(plane.f[2].theta);
yforce[3] = totalforce[3]*cos(plane.f[3].theta); yforce[4] = totalforce[4]*cos(plane.f[4].theta);


// Next we assign the X-component:
f32 xforce[5] = {0, totalforce[1] * sin(plane.f[1].theta), totalforce[2] * sin(plane.f[2].theta), totalforce[3] * sin(plane.f[3].theta), totalforce[4] * sin(plane.f[4].theta)};

// Next Assign Z component:

f32 zforce[5] = {0, 0, 0, 0, 0};
Fear is the mind killer
]343[
Profile Blog Joined May 2008
United States10328 Posts
October 13 2012 19:20 GMT
#10
wow, sick! too bad it requires windows T.T (I guess I could try to run it in wine, bleh)
Writer
Please log in or register to reply.
Live Events Refresh
RSL Revival
10:00
Season 5: Group D
Cure vs Zoun
Clem vs Lambo
Tasteless960
IntoTheiNu 622
Ryung 365
IndyStarCraft 158
Rex66
LiquipediaDiscussion
Sparkling Tuna Cup
10:00
Weekly #131 (TLMC 22 Edition)
Classic vs MiniZergUALIVE!
Classic vs TBD
CranKy Ducklings73
CranKy Ducklings SOOP8
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Tasteless 960
Ryung 365
IndyStarCraft 158
Rex 66
Railgan 53
StarCraft: Brood War
BeSt 628
Hyuk 323
ZerO 255
Last 160
Mind 93
sorry 82
Pusan 66
Backho 66
Shine 63
Nal_rA 51
[ Show more ]
Movie 47
910 35
Liquid`Ret 32
Rush 26
Shinee 20
yabsab 18
GoRush 15
Noble 10
ajuk12(nOOB) 7
Dota 2
Gorgc4206
monkeys_forever163
XcaliburYe120
Counter-Strike
x6flipin247
Heroes of the Storm
Khaldor92
Other Games
gofns16884
singsing2031
B2W.Neo831
DeMusliM293
KnowMe112
ZerO(Twitch)15
MindelVK10
fpsfer 1
Organizations
Counter-Strike
PGL42883
Other Games
gamesdonequick2548
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• Adnapsc2 30
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1550
• TFBlade1041
Other Games
• WagamamaTV249
Upcoming Events
WardiTV Invitational
1h 2m
ByuN vs Rogue
Solar vs Ryung
Zoun vs Percival
Cure vs SHIN
BSL
8h 2m
Dewalt vs DragOn
Aether vs Jimin
GSL
21h 2m
Afreeca Starleague
23h 2m
Soma vs Leta
Wardi Open
1d 1h
Monday Night Weeklies
1d 5h
OSC
1d 13h
CranKy Ducklings
1d 23h
Afreeca Starleague
1d 23h
Light vs Flash
Replay Cast
2 days
[ Show More ]
Replay Cast
3 days
The PondCast
3 days
Replay Cast
4 days
RSL Revival
4 days
Korean StarCraft League
5 days
RSL Revival
5 days
BSL
6 days
GSL
6 days
Cure vs TBD
TBD vs Maru
Liquipedia Results

Completed

Escore Tournament S2: W6
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.