• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:34
CEST 15:34
KST 22:34
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles1[BSL20] Non-Korean Championship 4x BSL + 4x China7Flash Announces Hiatus From ASL64Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Statistics for vetoed/disliked maps Weekly Cups (June 23-29): Reynor in world title form?
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
SC uni coach streams logging into betting site BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps Flash Announces Hiatus From ASL Player “Jedi” cheat on CSL
Tourneys
[BSL20] Grand Finals - Sunday 20:00 CET [BSL20] Non-Korean Championship 4x BSL + 4x China CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024! Summer Games Done Quick 2025!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 715 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
Wardi Open
11:00
#43
WardiTV1322
OGKoka 522
Harstem427
IndyStarCraft 169
Rex167
CranKy Ducklings122
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
OGKoka 522
Harstem 427
Hui .184
IndyStarCraft 169
Rex 167
StarCraft: Brood War
Bisu 2963
Flash 2112
Jaedong 1818
Hyuk 1166
firebathero 688
EffOrt 645
ZerO 538
Larva 508
actioN 436
Soulkey 387
[ Show more ]
Stork 378
Snow 308
Soma 275
GuemChi 168
Mind 132
sSak 113
Pusan 111
Light 98
PianO 80
hero 77
Sharp 74
JulyZerg 72
TY 55
Barracks 46
Sea.KH 44
Yoon 38
Aegong 35
sorry 32
Free 30
GoRush 26
soO 24
zelot 23
Movie 22
JYJ20
HiyA 20
yabsab 19
IntoTheRainbow 11
Terrorterran 10
Shine 8
ivOry 4
Dota 2
qojqva3148
Gorgc2576
XaKoH 621
XcaliburYe297
syndereN293
League of Legends
singsing2548
Counter-Strike
byalli263
markeloff128
Super Smash Bros
Mew2King169
Other Games
hiko1144
B2W.Neo1138
crisheroes383
Beastyqt345
Lowko310
ArmadaUGS128
Liquid`VortiX84
ZerO(Twitch)24
Organizations
Other Games
gamesdonequick37693
StarCraft: Brood War
UltimateBattle 889
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 2960
• WagamamaTV335
League of Legends
• Nemesis5594
Upcoming Events
RotterdaM Event
2h 26m
Replay Cast
10h 26m
Sparkling Tuna Cup
20h 26m
WardiTV European League
1d 2h
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
1d 10h
The PondCast
1d 20h
WardiTV European League
1d 22h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
2 days
Replay Cast
2 days
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
[ Show More ]
Replay Cast
3 days
RSL Revival
3 days
Classic vs Cure
FEL
4 days
RSL Revival
4 days
FEL
4 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
6 days
BSL20 Non-Korean Champi…
6 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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 © 2025 TLnet. All Rights Reserved.