Coder Social home page Coder Social logo

ashishkumar4 / airsimrcplusplus Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 350 KB

A System to allow integration of unsupported Radio Controllers with Microsoft AirSim Simulator for Unreal Engine 4 without any coding required, as well as provide general APIs for handling Real Drones.

License: GNU General Public License v3.0

Python 22.11% C++ 70.53% Makefile 4.88% C 2.48%
airsim simulator simulator-api simulator-controls radio-control drones multicopter unreal-engine-4 unreal-engine microsoft-airsim reciever transmitter simulation airsim-simulator arduino radio-controller

airsimrcplusplus's Introduction

Use any Radio Controller easily with AirSimRC++

This software stack allows you to integrate any Radio Controller hasle-free, to use with Unreal Engine 4 based AirSim Simulator as well as to provide extended APIs for general use.

Wanted to use your Radio Controller but its not supported by AirSim? or just wanted to get data from a Radio Controller to a PC for god knows what reason? Well this might just end your search.

AirSimRC++ allows you to connect your random radio controller to a PC, via an intermediate Arduino (or stm8/32 or any other microcontroller really), and provide a useful set of APIs and tools to do stuff with the data, for example, connect to the AirSim Simulator of Unreal Engine 4, without EXPLICITLY coding for a new RX.

For the Architecture, check the bottom note

Usage:

First upload the ArduinoInterface sketch onto an arduino board (or stm etc.). Tweak the serial speed as the max available on that board.

Connect the board to the Reciever, All signal pins on PWM pins of the Arduino. If required, change the pin layout in the sketch as necessary.

Launch Unreal Engine 4 and a project configured with AirSim, and hit 'Play'

Execute the AirSimControls.py script (rom the AirSim Handler folder) using Python 3. Terminal -> python3 AirSimControls.py

Open a terminal in the ManualController Directory and type make to compile and generate binaries.

Switch on the Radio controller and make sure it is binded to the reciever.

Execute the ManualController Binary.

Procedures to calibrate the controller follows. First both joysticks to bottom, then top, then left then right then leave in middle. Then Wait for 5 seconds for the procedure to finish.

Following the steps, You should now be able to fly the MultiCopter using the controller, intuitively. Report any bugs/problems if found.

The Architecture is as follows

The Radio Reciever is connected to an Arduino, with provided Code uploaded on it. The Radio Reciever sends data recieved from the transmitter via PWM signals. Arduino then writes the data onto a Serial port as stream to a PC attached.

The ManualController Program reads from this Serial port, unpacks the data, calibrates it when needed, and applies some signal processing to sanitize and smoothen it, and converts it into a range of 0-255. ManualController program then connects to a local server, created by the AirSimControls.py and begins sending RX data over via sockets.

The AirSimControls.py is a Python 3 script that connects to the AirSim module running along Unreal Engine 4, sets up a local server, listens for RX data from ManualController, and then calls AirSim's internal APIs to forward the commands and thus control the virtual drone as if real.

One might wonder why so much trouble setting up local servers and passing data via sockets. well, This code is a part of a greater project, where I needed to control a Real Drone, via a PC itself. This ManualController was developed to just test all the protocols and APIs involved. And to test the offboard side of things, I created a simple 'Drone Emulating' server, which mimicked the Drone's APIs that I had developed, but instead of commanding a real drone, commanded a virtual one in Unreal Engine itself. I thought this can be useful for someone as a standalone system itself, thus this. The overhead of data transfers isn't significant as compared to the main bottleneck, which is the Reciever to Arduino communication, which can't be optimized. Still, Suggestions, Bug alerts and possible fixes as well as any optimization you well are welcomed, Do open a pull request.

airsimrcplusplus's People

Contributors

ashishkumar4 avatar

Stargazers

 avatar  avatar  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.