From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Flight simulator in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All
Overview
Airplane Simulator using LabVIEW

Description:
Maybe LabVIEW isn't the first thing that pop's up in the mind when you think of making a flight simulator. But it's amazingly easy to do one and surprisingly fast to run it, consider all calculation of matrices.
In the beginning I thought of doing a ray-tracing module, but to-do that I needed a 3D environment and a 3D-Editor. The editor became the 3D-Script-Viewer and the environment the airplane.

Instructions:
To implement this example:
  1. Run VI


To execute this example:

  1. Install the required software.
  2. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

2017-11-02_14-38-58.jpg2017-11-02_14-37-42.jpg

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
artisthos
Member
Member
on

Wow, Thanks

Tom Lohre artist/scientist
Has a operating painting robot using RoboLab/RCX
Developing a LabView/ NXT robot that analyzes an image for aesthetic quality.
Maciej
Member
Member
on

nice job, but artificial horizon is broken. It works wrong when changing pitch.

Maciej
Member
Member
on

sorry for replaying my own comment. but I can't found edit option.

This is what Wikipedia says about it:

"On the attitude indicator you will see two white or yellow horizontal lines with a dot between them. The horizontal lines represent the wings and the dot represents the aircraft's nose. If the symbolic airplane dot is above the horizon line (more blue background) - the aircraft is nose up. If the symbolic airplane dot is below the horizon line (more brown background) - the aircraft is nose down."

Tilak
Member
Member
on

good job

G-Money
NI Employee (retired)
on

Great work tjellden! Do you think you could add some documentation so people know what the subVIs do? It took me 20 minutes to read your code to figure out what you were doing and I think some well place comments could help shorten this time. Overall though, great work and very clean code!

tjellden
Member
Member
on

Thanks for letting me know. I would gladly like tohelp you some day, but unfortunately I haven't time right now. If youor some body like to work on the project then I would be more thenhappy. For the moment I spent all my time with my little kid.

When it comes to the editor or other parts that Ihave talked about, is those made for paid customer so I can't releaseit on the net.

But some part of the background and explanation ismade available on the net.

http://decibel.ni.com/content/docs/DOC-5422

Here is an old example of drawing and rotation that imade.

http://zone.ni.com/devzone/cda/epd/p/id/3534

Sky.yu
Member
Member
on

good job! thank you!

Sky.yu
Member
Member
on
good job! thank you!
Robicheaux
Member
Member
on

Very impressive and very concise!

I do have one question.  On your moving sphere ADI, how can I swap the location of the E and W cardinal heading letters.  In actual aircraft with this type of ADI the visualization for the pilot is that he is inside the sphere and the horizon is moving past his nose thus, when he is in a 90° left bank the lines of heading are moving from the top of the display to the bottom and the heading is decreasing.  In this example if you began on a heading of 360° (N) you would next see 270° (W).  You have the rotation of the sphere correct in both pitch roll and yaw (heading) the only inconsistency is the W and the E are swapped.  I've played with the E_W_N_S on shpere.vi but can't figure out how the swap those two letters.

Again very impressive and thanks,

Jim

tjellden
Member
Member
on

Hello Jim and thanks for the comment

This program was actually made as validation of my 3D modulating script handler. I don't know haw mush you have looked into the program, but the main part is a script handler and the LabView was just a quick way to get it up and running. The airplane is just made for fun, when I had finished the script handler. So I haven't paid any attention regarding error like reality or correctness to this part of the project, so feel free to change and republic the change, keep just a reference to the original place.

If you like graphics you may have seen my other contribution: https://decibel.ni.com/content/docs/DOC-5422

Regarding your question:

As I told, I didn't spend so much time on this part, so many thing is made the quit and dirty way, and some is for portability, the script handler was made for C-code.

As for the letters E W S N, they are actually drawn line-by-line. In the file "E_W_S_N on sphere.vi" in the upper left corner, of the file, there you have the vertex for the letters. Each letter is then put together into an array. If you change the order in which those letters are put together into the array. Then you also replace the order of them as they are displayed.

The C-code is used in a other project: http://www.youtube.com/watch?v=uxuPeHbquWk

Where the hardware comes from:  http://www.stm32circle.com/hom/index.php

Tobbe