Commit 451fb02c authored by ebblough's avatar ebblough 💬

Merge branch 'patch-5' into 'master'

docs for using multiple quads

See merge request !56
parents 44b76b94 5ee91b23
# Multi-platform Integration
## Table of Contents
* Brief
* How to connect another vehicle
* Make / Flash a physical network interface
* Integrate the network interface onto the control system for the vehicle
* Configure VRPN and Backend
* Setup GCS Host AP configuration
* Controlling Multiple Vehicles using CLI
## Brief
This markdown file will walkthrough the necesary system configuration needed to be done to control multiple vehicles with the GCS and VRPN system. This
description will link to other relevant documentation files located in the MicroCART repository. The 2019-2020 MicroCART team's project is used as an example of how
to go through this process. The GCS can control multiple vehicles at once, but using this feature is not recomended. The control software lags considerably
when using multiple vehicles. The VRPN updates are slower for multiple vehicles, so when you are controlling multiple vehicles you should be sure to have a
failsafe for the vehicles like an RC kill switch.
## How to connect another vehicle
### Make / Flash a physical network
The GCS has a wifi app software folder that holds stopAP and startAP scripts.[AP Scripts Software] ( "AP Scripts Software")
These scripts can be ran to make the GCS act like a host wifi network like a router. Don't do that just yet, because what good is a wifi hotspot if nothing
is connecting to it. The GCS communicates to client devices with TCP packets. You need something like a network interface to connect to the wifi network and
route the control packets from the GCS to the vehicles controls. That sounds like a lot of work, but the MicroCART repo already has support software for one
type of adapter. The ESP8266 chip was used as the network adapter/wireless interface for the 2018-20202 MicroCART drones. It has a UART interface, so linking it to whatever
controls the vehicle shouldn't be a huge issue. If the GCS is the AP(acess point), then you should flash the ESP8266 with client firmware. There are tons of docs on flashing
these wifi chips that can be found [Here] ( "here").
After you have these flashed you will want to connect them to your vehicle's control system.
### Integrate the network interface onto the control system for the vehicle
This part is dependent on what you are trying to control. Our drone used a breakout board that had a port designed to match
the pins on the wifi chips. Here is a picture below.
### Configure VRPN and Backend
This part is optional. It isn't necesary to send VRPN data if you are using something like GPS, but
we used vrpn, so I will list the macros that need to be set in the backend.
First, add a new trackable to the vrpn system. if you are going to use VRPN calibrate it first.
[Docs for callibration] ( "Docs for Callibration")
After callibrating, you want to track something, so use one of the black plastic ir beacon holdlers in the camera stuff box. This black plastic
thing will be tracked by the camera system. If you have an optitrack project open you should see a number of small dots on the screen matching the number of
IR beacons you put on the holder. Left click and drag your mouse over your selection, release, then right click one of the dots and select trackables->Create trackable tab.
You should see something on your screen similair to what's shown below.
VRPN should now be streaming to the GCS, but you need to set options in the GCS to recieve it.
To recieve VRPN data and forward to a vehicle you need to create a trackable object for that in the config.c file.
[config.c] ( "config.c")
You should just be able to copy a trackable object from config.c and change the QUAD_SERVER_NAME and QUAD_IP, QUAD_PORT macros to match
your network interface (discussed in setup GCS Host AP config) and trackable name. Change the prefix before @ on the QUAD_SERVER macro to match the trackable's
name on optitrack. After you make a new trackable, also change the NUM_TRACKABLES macro in the GCS to reflect the new number of trackables.
### Setup GCS Host AP Config
Use the startAP script to create a wifi hotspot (READ the docs before using startAP!) [wifi_app_docs] ( "wifi_app_docs"),
then connect to it with your network interface on your vehicle.
Everything else should be all setup, now you just need to change the QUAD_IP and QUAD_PORT numbers in config.c.
You can find the values for these by using a network analyzer like wireshark. To run wireshark, install it onto your machine, add its executable to the path,
and type sudo wireshark in terminal. You should see a wlp2s0 interface under start options. Click on this then start capture.
After starting capture, turn on your vehicle. If your vehicle connected you should see an IP address pop up like shown below.
set the QUAD_IP to this ip in config.c. Also set the QUAD_PORT to the TCP_PORT field in user_config.h in the esp2866 client firmware.
After all these are set run make to recompile the backend restart your vehicle and run ./backend. The backend should say it connected successfully.
### Controlling Multiple Vehicles using CLI
If the backend said something about connecting to your client platforms, then you can test its connection.
You can select which platform you want to talk with by opening up another terminal while backend is running and using
./settrackable trackable_name
You can get the name of the current trackable using
Besides those commands, everything should work the same as controlling one vehicle. Try using getnodes or getparam to really make sure communication is successful.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment