Flight Sim: Final Post


Final Project Post

  • Motivation
    • Plane: Create a flight simulator to give people an understanding the basics on how to fly a plane
      • Control Plane
      • Take Off
      • Navigate through the air
    • Wingsuit:
      • Let people experience wingsuit safely with easy to access devices.
      • https://youtu.be/-C_jPcUkVrM
      • Prove the concept of gesture controlling with iPhone.
      • Grow it into a fun game.
  • Contributions
  • screen-shot-2016-12-18-at-4-02-39-pm
    • Mel
      • Made an island for plane to navigate through (includes ocean, lakes, mountains, trees, sky)
      • Created a runway for plane to take off
      • Made plane controls to pitch, roll, yaw, and brake
      • Added wheels and propellers for plane’s take off
      • Created menu scenes to deal with plane running into objects, and disabled all flying functionalities
      • Added audio to give user input on what to do in the environment
    • Danny
      • Input:
        • iPhone app for input data collection
        • Made hardware to attach iPhones
        • Communication between iPhone and Unity
        • Preprocessing gyroscopic data
          (denoise, smoothing)
      • Model:
        • Force analysis, derived formulas to update player’s position/rotation/speed.
        • Implemented the formulas into unity. All variables were computed and stored in a static global class, providing easy access to the game logic. the formulas into unity.
    • Li
      • Built the whole windsuit scenes including position adjustment scene, game scene and game over scene.
      • Handled collisions.
      • Wrote scene loading code by game logic.
      • Wrote other code like timer or so.
      • Integrated Danny’s code.
      • Connected to Oculus and tested.
    • Wasim
      • Designed and tested hardware circuitry to change AC (alternating current) fan speed.
      • Wrote a C# app to communicate with arduino and receive commands from PC which is eventually going to be used in interfacing with Unity.
      • Designed and tested a protocol to translate commands from PC into FAN speed.
      • Interfaced arduino with Unity over serial connection.
  • Outcomes
    • The flying part of the project lets you take off on an island and navigate through an environment. With the arrow keys, you can roll, yaw, and pitch the plane based off of your input. If you hit the space bar, you can also allow the plane to break with will decrease the speed of the plane. Based off of whatever action you are doing, the plane adjusts speed accordingly. Example, if you are pitching down, then the plane will increase speed.
    • The flying part of the project also lets you take off, and has a feature of landing wheels which you can see go back into the plane once the plane is taking off. When you take off and increase speed, you can see the propellor speed increasing as the blades go faster. The audio has a propellor noise in the background, and is adjusted based off of your speed.
      The plane also crashes and enters a menu screen once you hit an object with the collider added onto the plane. There is audio giving directions on what to do once you are close to an object, so the pilot knows to avoid obstacles.
    • The wingsuit experience simulator consists of two iPhones, a sling to attach the iPhones to the player, a desktop and an Oculus rift. Each iPhone has an app we made to collect roll/pitch/yaw of the iPhone and send the data to the desktop. In the desktop, data from each iPhone was averaged, smoothed and then feeded into a physics model to compute the next status of the player (i.e. location/orientation of the camera in the game). The flying speed in the VR environment was mapped to the magnitude of the wind sound to give the player a better idea of speed.
      Our codes can be found on Github: https://github.com/FlyinVR
    • We were able to get a satisfactory controlling with iPhone. First time users will need a little bit training, but that’s what is expected for highly skilled sport like wingsuit. We able to activate/deactivate fan according to the flying speed in VR. But by the end of the semester we could not have the fan speed change proportional to the flying speed. Because the scale of the map and lack of change in fan speed, the feeling of speed in our VR system is not so satisfactory.
    • For controlling fan speed we followed a well known design to control any AC power device. It involves a three terminal device called Triac which acts like a switch, making a connection between two of its terminals (T1, T2) based on the time and amplitude of digital voltage applied to the third terminal called Gate (G). The link can be found here for more information about our current design. http://playground.arduino.cc/Main/ACPhaseControl. We built this circuit and tested it in ECE lab. The digital part worked absolutely fine. The circuit involves a zero crossing detector (ZCD) which detects when the AC line voltage crosses zero and generates an interrupt to Arduino. Upon arrival of such interrupt, arduino runs a timer which after a specified amount of time generates a gate pulse to turn on the Triac. As triac is not conducting before the arrival of this pulse, some AC power is taken away from a full cycle of line voltage. If we control when this pulse is applied we can control the AC power supplied to the load. This is the basic principle of AC voltage control using Triac.  
    • In Unity we maintained a global variable for the speed of the wingsuit and it was sent to Arduino via serial connection which basically controlled when to apply the gate pulse. Earlier you apply the gate pulse, less power is removed from the AC line given to load which, in turn, speeds up the fan and vice versa.
    • Though the digital part of the circuit was working fine, we faced some problems when we introduced AC in our system. Hence we had to switch our design to only tuning fan ON/OFF based on gameplay. We reused most the parts of our original circuit with an additional relay.  
    • We are glad that we built a system that works. Meanwhile we are not satisfied with what we currently have. More work needs to be done as mentioned above. Most important things would be: 1. Rescale the scene so that the player won’t see the edge of the map and won’t fly out of the map so easily. Flying closer to the ground will also help improving the speed. Switching to Mel’s scene may solve this problem. 2. Fan speed should change with the flying speed.
  • Problems encountered
    • Collaboration using Unity was very difficult. It was impossible to use version control tools like Git. There are so many binary files and event worth many automatically generated files. When merge with Git, automatically generated file might be merged without any conflict but result in a broken project.
    • Rotation during flying is challenging: when the player rolls more than 180 degree. The formula that Danny derived will not work. It is possible to solve it with a more canonical way of selecting coordinates. But we ended up restricting rotation: the player won’t be able to rotate more than 180 degree. This also works like a safe belt: if one starts to rotate during a flight, that is going to end badly. Meanwhile, it will be helpful to a wingsuit pilot if they can practice handling such hazardous condition with our system. So it deserves more effort to eliminate such rotation restriction.
    • Some the components used in the design were not readily available so we had to order it from DigiKey. It took a week and a half to arrive.
    • Though all the digital part worked absolutely fine but when we introduced AC in the final step it was not able to control AC power. We think it’s mainly because of the inconsistent behaviour of triac. The digital part still works fine but somehow its not able to source enough power to turn on the Triac gate.
    • Different applications use different protocols for serial communication. When you send something using serial connection via Visual Studio C# application, it sends two bytes for any alpha-numeric data you transfer. E.g. if you send “a” it will send ASCII code for “a” which is 0x97 and a line feed character 0x0a. This is so inconsistent with different applications. In our original design we agreed that fan speed would be a number between 100-248 which can be sent using a single byte and that’s how we programmed arduino. So when PC sent two bytes we were not sure why it was so and it took us a while to understand this bug and fix it in Arduino code. Moreover Unity uses three byte to communicate a single character. So we had to change our arduino code again.
    • It was challenging for the plane portion of the project to land the plane. I had a collider set whenever a plane ran into an object it was considered a “crash” and you had to restart the game. This was a problem when the plane was to land, because it was colliding with the ground. It was also challenging figuring out how to take off from the ground. It was hard to adjust the speeds of the plane in a way that looked natural. I also encountered this problem when dealing with the roll, pitch, and yaw. Making the plane look natural like an actual plane was difficult, and I spent most of my time trying to figure this out.
    • I also spend too much time with my environment. I should have made a less detailed environment, so I could have focused more on the plane itself. I didn’t realize how fast planes go in unity, and making it the realistic speed I wanted made flying through my environment go very quickly. If i made a very large terrain and made less detail, this would have looked better. Even though my environment looked great because I spent too much time adding features to it.
    • Another problem encountered was the plane itself. There was at least 6 different plane models circled through to look the best. It was hard with certain assets (some had a propellor, some had landing gears, some didn’t have a cockpit.) It was hard to program based off of questionable assets, and this cost a lot of time. I was happy I finally found one at the end. I would have really liked to make my plane be in the cockpit view, but with all the time I spent with making the controls look natural, focusing on outside features such as the landing gears and propellors, I wanted people to be able to see those features instead.
  • Next Steps
    • Intertwine the two projects
      • Start at the ground and take off, then once you are flying in the sky have an option to jump out of the plane
    • Adjust the scene so that more game elements
      • Victory Check
      • Coin collections
      • Add stories
    • Try another option for flying to try it inside the cockpit
      • Be able to land
  • Video of project in Action