Giter Club home page Giter Club logo

dronepilot's Introduction

Altax

Drone Pilot

Autonomous Pilot software that runs on companion computers.

Main functionalities:

  • Communication with flight controllers, including <Pixhawk, PX4, APM and MultiWii>.
  • Bridge between a ground station computer and flight controller, this allows to control vehicles from a computer.
  • Black box of flight data (save all the data from the flight controller and ground station).
  • Position control algorithms. Uses data from a motion capture system and compute the pilot commands to keep the vehicle in a desired position.
  • Uses DroneKit (when using Pixhawk and PX4) to perform advanced missions.

The objective of this repository is to do research using multirotor vehicles and learn how to develop with them.

Vehicle flying using a hover controller (mw-hover-controller.py):

Flying quadcopter

This library uses a companion computer alongside a flight controller, you can check this post https://altax.net/blog/flight-stack/.


Current scripts:

MultiWii scripts:

  • mw-joystick.py -> Send joystick commands via UDP from a ground-station running Matlab to a flight controller running MultiWii software.

Multiwii joystick (naze32)

  • mw-hover-controller.py -> Computer pilot commands (using a PID structure) to make a Multiwii multicopter hold a specified x,y,z coordinate.

Pixhawk scripts:

  • pix-showdata.py -> Reads data from a flight controller (either SITL or real) and displays it. Dronekit related. Script that will be used first to ensure the communication with the flight controller is working.

  • pix-takeoff.py -> Script that makes a pixhawk take off in a secure way. Dronekit related.

Example take-off

  • pix-joystick.py -> Send joystick commands via UDP from a ground-station running Matlab to a pixhawk. Dronekit related.

Pixhawk joystick

  • pix-logdata.py -> Script that logs data from a vehicle and a MoCap system. Dronekit related.

Example logdata

  • pix-goto.py -> Script that commands the vehicle to follow waypoints.

Example goto

  • pix-velocity-vector.py -> Script that send the vehicle a velocity vector to form a square and diamond shape.

Example velocity vector


Supported flight controllers:

  • Multiwii boards (using MSP). Currently using on this examples a naze32.

  • Pixhawk / PX4 / APM (using mavlink & DroneKit 2.0)

Supported companion computers:

  • Raspberry Pi (B+, 2 or Zero)

  • oDroid U3

Note: Code is in python, so, any linux companion computer should be able tu run it.


How to:

Raspbian

  1. Update your Pi...
``` sudo apt-get update sudo apt-get upgrade ```
  1. Next this one:
``` sudo apt-get install python-dev ```
  1. More utilities:
``` sudo apt-get install screen python-wxgtk2.8 python-matplotlib python-opencv python-pip python-numpy python-serial ```
  1. Then mavlink and mavproxy:
``` sudo pip install pymavlink sudo pip install mavproxy sudo pip install dronekit ```
  1. Clone this repository:
``` git clone https://github.com/alduxvm/DronePilot.git ```

Have a read here https://altax.net/blog/how-to-dronekit-sitl/ for a tutorial on DroneKit and SITL.

--

Ubuntu LTS

Install Ubuntu

Connect to internet or a network

Have in mind that this particular configuration is for the wireless setup in my laboratory, you will have to change this part so that it suits your own configuration.

  • Mount a USB to install two packages: libw30, wireless-tools (packages must be for armhf)
  • List devices: sudo fdisk -l
  • Create USB folder sudo mkdir /media/usb
  • Mount device sudo mount /dev/sda2 /media/usb
  • Navigate to the folder and install:
sudo dpkg -i libiw30_30-pre9-8ubuntu1_armhf.deb
sudo dpkg -1 wireless-tools_30-pre9-5ubuntu2_armhf.deb
  • Add this information to interfaces:
auto wlan0
iface wlan0 inet dhcp
	wireless-essid	jws-uav-lab
	wireless-mode	Managed
	wireless-key	s:#########
  • Reboot and you will be connected!

Utilities and extra software

  • sudo apt-get install openssh-server
  • sudo apt-get install python-dev
  • sudo apt-get install screen python-wxgtk2.8 python-matplotlib python-opencv python-pip python-numpy python-serial python-twisted htop git
  • sudo pip install pymavlink
  • sudo pip install mavproxy
  • sudo pip install dronekit

For higher UART speed

Edit /boot/config.txt file, and add to the end:

# Higher UART Speed
init_uart_baud=921600
init_uart_clock=14745600

Caution

This code is still under heavy development, everyday I add and remove stuff. Proceed with caution.


Social networks:

You can follow us in this URL's:


Utilities:

updateDronePilot shell script

#!/bin/bash

echo "Deleting previous directory..."
rm -rf DronePilot/
echo "Done."
echo "Cloning DronePilot repository: "
git clone https://github.com/alduxvm/DronePilot.git
#echo "Copying mavinit.scr to proper directory..."
#mkdir DronePilot/TestQuad
#mv DronePilot/mavinit.scr DronePilot/TestQuad/
#echo "Done."
echo "Ready to do: mavproxy.py --master=/dev/ttyAMA0 --baudrate 115200 --aircraft TestQuad"
echo "Dont forget to go inside the DronePilot directory."

ssh:

/etc/ssh/ssh_config

ServerAliveInterval 5
ClientAliveInterval 5

ad-hoc:

/etc/network/interfaces

auto lo
iface lo inet loopback
iface eth0 inet dhcp
 
auto wlan0
iface wlan0 inet static
  address 192.168.1.1
  netmask 255.255.255.0
  wireless-channel 1
  wireless-essid RPiAdHocNetwork
  wireless-mode ad-hoc
sudo ifdown wlan0
sudo ifup wlan0
sudo apt-get install dhcp3-server
/etc/dhcp/dhcpd.conf
ddns-update-style interim;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.5 192.168.1.150;
}

In case of failure starting DHCP:

sudo service ifplugd stop

Video

sudo modprobe -v bcm2835-v4l2
git clone https://github.com/mpromonet/h264_v4l2_rtspserver.git
cd h264_v4l2_rtspserver
cmake .
make install
h264_v4l2_rtspserver -H <height> -W <width> -F <fps>

To start:

rtsp://192.168.1.1:8554/unicast

Low latency video

  • Same DHCP configuration as before

  • Install "hostapd"

sudo apt-get install hostapd netcat-traditional

  • Interfaces:
auto wlan0
iface wlan0 inet static
  address 85.85.85.1
  netmask 255.255.255.0
  • /etc/hostapd/hostapd.conf
interface=wlan0
ssid=HDFPV
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0
  • /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"
  • On rpi, create fifo file:
mkfifo fifo.500 
  • On client (mac):
brew install netcat
brew install mplayer
  • To start (mac):
netcat -l -p 5000 | mplayer -fps 60 -cache 1024 -
  • To start (rpi):
cat fifo.500 | nc.traditional 85.85.85.6 5000 &
/opt/vc/bin/raspivid -o fifo.500 -t 0 -b 50000

dronepilot's People

Contributors

alduxvm avatar brownkyle avatar

Watchers

 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.