Infinite Drone Software: AN INTRODUCTION | Infinite 8 institute


$ mkdir Mom
$ cd Template && cat > Baby.cpp
$ sudo nano Baby.cpp
//Enter the following code
#include <iostream>
using namespace std;
int sum(int a, int b) {
    return a+b;
int main () {
    int x=7, y=15;
    cout << sum(x, y) << endl;
//Enter Ctrl + o, and Ctrl + x
$ g++ -o <newfilename> <oldfilename>
$ ./<newfilename>


$ cd Template && cat > template2.cpp
$ sudo nano template2.cpp
//Enter the following code in the file
#include <iostream>
#include <string>
using namespace std;

template <class T>
T sum(T a, T b) {
    return a+b;

int main () {
    string x="Hello", y="World";
    cout << sum(x, y) << endl;

// Prints Hello World
$ g++ -o <newfilename> <oldfilename>
$ ./<newfilename>


$ cd Template

$ cat > template3.cpp

$ sudo nano template3.cpp
//Enter in the following code
#include <iostream>
using namespace std;
template <class T>
T sum(T a, T b) {
    return a+b;
int main () {
    double x=7.15, y=15.54;
    cout << sum(x, y) << endl;
//Output is 22.69
//Save Ctrl + o, and Close Ctrl + x
$ g++ -o <newfilename> <oldfilename>
$ ./<newfilename>

Install Drone Simulator, ROS Melodic, and other dependencies



ctl + c

sudo gedit

ctl + p //the following below inside the opened window


## Bash script for setting up a PX4 development environment on Ubuntu LTS (16.04).
## It can be used for installing simulators (only) or for installing the preconditions for Snapdragon Flight or Raspberry Pi.
## Installs:
## - Common dependencies and tools for all targets (including: Ninja build system, Qt Creator, pyulog)
## - FastRTPS and FastCDR
## - jMAVSim simulator dependencies
## - PX4/Firmware source (to ~/src/Firmware/)

# Preventing sudo timeout
trap "exit" INT TERM; trap "kill 0" EXIT; sudo -v || exit $?; sleep 1; while true; do sleep 60; sudo -nv; done 2>/dev/null &

# Ubuntu Config
echo "We must first remove modemmanager"
sudo apt-get remove modemmanager -y

# Common dependencies
echo "Installing common dependencies"
sudo apt-get update -y
sudo apt-get install git zip qtcreator cmake build-essential genromfs ninja-build exiftool astyle -y
# make sure xxd is installed, dedicated xxd package since Ubuntu 18.04 but was squashed into vim-common before
which xxd || sudo apt install xxd -y || sudo apt-get install vim-common --no-install-recommends -y
# Required python packages
sudo apt-get install python-argparse python-empy python-toml python-numpy python-dev python-pip -y
sudo -H pip install --upgrade pip
sudo -H pip install pandas jinja2 pyserial pyyaml
# optional python tools
sudo -H pip install pyulog

# Install FastRTPS 1.7.1 and FastCDR-1.0.8
echo "Installing FastRTPS to: $fastrtps_dir"
if [ -d "$fastrtps_dir" ]
    echo " FastRTPS already installed."
    pushd .
    cd ~
    wget -O eprosima_fastrtps-1-7-1-linux.tar.gz
    tar -xzf eprosima_fastrtps-1-7-1-linux.tar.gz eProsima_FastRTPS-1.7.1-Linux/
    tar -xzf eprosima_fastrtps-1-7-1-linux.tar.gz requiredcomponents
    tar -xzf requiredcomponents/eProsima_FastCDR-1.0.8-Linux.tar.gz
    cpucores=$(( $(lscpu | grep Core.*per.*socket | awk -F: '{print $2}') * $(lscpu | grep Socket\(s\) | awk -F: '{print $2}') ))
    (cd eProsima_FastCDR-1.0.8-Linux && ./configure --libdir=/usr/lib && make -j$cpucores && sudo make install)
    (cd eProsima_FastRTPS-1.7.1-Linux && ./configure --libdir=/usr/lib && make -j$cpucores && sudo make install)
    rm -rf requiredcomponents eprosima_fastrtps-1-7-1-linux.tar.gz

# jMAVSim simulator dependencies
echo "Installing jMAVSim simulator dependencies"
sudo apt-get install ant openjdk-8-jdk openjdk-8-jre -y

# Clone PX4/Firmware
echo "Cloning PX4 to: $clone_dir."
if [ -d "$clone_dir" ]
    echo " Firmware already cloned."
    mkdir -p $clone_dir
    cd $clone_dir
    git clone

//Save and close the opened window.

sudo chmod +x

Install MAVSDK

$ mkdir Mavsdk
$ cd Mavsdk

$ sudo apt-get install python3-pip

$ sudo pip3 install mavsdk
$ git clone
$ cd aioconsole
$ python3.7 install
//open new window
$ apython
$ from mavsdk import start_mavlink
$ from mavsdk import connect
$ start_mavlink()
$ drone = connect(host=’localhost’)
$ await drone.action.arm()
$ await drone.action.takeoff()
$ async for position in drone.telemetry.position():
$ print(position)
$ exit()
$ cat >
$ sudo nano
// Paste the following content inside the file. 
#!/usr/bin/env python3
import asyncio
from mavsdk import start_mavlink
from mavsdk import connect as mavsdk_connect
from mavsdk import ActionError
drone = mavsdk_connect(host=””)
async def run():
              print(“Waiting for drone…”)
              async for state in  drone.core.connection_state():
                     if state.is_connected:
                                  print(f”Drone discovered with UUID: {state.uuid}”)
                     await drone.action.arm()
                     print(“—Taking off”)
                     await drone.action.takeoff()
                     await ayncio.sleep(5)
loop = syncio.get_event_loop()

// Ctrl + o to save, and Ctrl + X to close.

// To run the program

$ python3.7