GithubHelp home page GithubHelp logo

android-app-remote-control-joystick's Introduction

Android-App-Remote-Control-Joystick

Introduction

An android app to remotely control the FlightGear simulator.

Important note:

  1. There are special features we describe later in this document.
  2. We attached a photo of the running app on real android phone (not the emulator).

Video Link

https://www.youtube.com/watch?v=g2ul0twrpsU

Explanation Of Folders And Main Files Structure

MVVM Architecture

Model

  • Communicates with the FlightGear server using telnet protocol.
  • Recieves commands from ViewModel and executes them.
  • The Model sends the commands to FlightGear simulator, and we see the airplane responds to these commands.
  • Commands sending is made by single threadpool.
  • Single threadpool creates an executor that uses single thread worker operating off an unbounded queue (if this single thread terminates due to a failure during execution prior to shutdown, a new one will take its place if needed to execute subsequent tasks.) Tasks are guaranteed to execute sequentially, and no more than one task will be active at any given time.

View

The MainActivity is our main view which uses the JoystickView of joystick object. The MainActivity contains:

  • input text fields for IP address and connection port.
  • Connect Button.
  • Two seekBars for rudder and throttle.
  • JoystickView. To enable data binding we configured this option in the build.gradle(app).

Special features:

  1. Each time the joystick is freed after finger touch, it turns back to its initial location - to the center of the screen.
  2. In the JoystickApp we're using a logger named Timber. If the user enters a wrong input in the ip address field or in the port field we'll know the exact error, where it occured and when.

View Model

View Model takes the data entered by user - IP address and connection port - via event listeners and by using data binding. The data binding to view model is made by different event listeners, that are listenning to all user's actions. Event listeners proccess the data and send appropriate commands to the Model.

Resources

  • Joystick's basis is the joystick layout which uses the drawable circle.
  • The image view converts the drawable circle to image element and we place it in the layout.
  • The default property of the joystick in the layout is defined that way: the "layout_gravity" set to "center".
  • This enables our first special feature to happen.

UML Diagram - According To MVVM Architecture

Preinstallation For Developer

Quickstart: Installations Instructions And First APP Running

  1. Open FlightGear app after dowloading it (link attached above).
  2. Go to Settings > Additional Settings > enter these in the text box: --telnet=socket,in,10,127.0.0.1,6400,tcp
  3. Click on Fly!.
  4. Clone the project from GitHub to your computer.
  5. Open the project in the IDE (Android Studio) and click on 'run'.
  6. Run the emulator or use your phone. For running the app from your phone: we'll need to configure the phone to use developers options.
    • Go to Android 9 (API level 28) and higher: Settings > About Phone > Build Number
    • Tap 7 times
    • Go to Settings > System > Advanced > Developer Options > USB debugging
    • Connect the phone with usb cable to your computer.
    • Run the program in the IDE.
  7. Open Joystick app.
  8. In the android app:
  • Enter your local IP address and connection port - 6400.
  • Click connect button.
  1. In the FlightGear simulator click on Cessna C172P and then click on autostart.
  2. Click Shift+v till you locate the screen in a convenient position so you can see the airplane properly to control it.
  3. Start to pull the throttle SeekBar button till maximum rate.
  4. When airplane starts to move regulate the rudder Seekbar and use the joystick to navigate.
  5. Enjoy your flight!

Running the android app on the phone will look like this:

android-app-remote-control-joystick's People

Contributors

libbyg avatar chantzish avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.