Skip to content
AUV onboard controller
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
auv_control_pi
navio
playbook
.gitignore
Dockerfile
Dockerfile.dev
LICENSE
Makefile
README.md
build_dev_image.sh
calibrate_ahrs.py
docker-compose-dev.yml
docker-compose.yml
manage.py
pytest.ini Add Makefile, update docker-compose and playbook Nov 26, 2018
rc_test.py Add comments and improve readability Aug 12, 2018
requirements-dev.txt
requirements.txt
setup.py add setup.py Nov 26, 2018
tasks.py

README.md

AUV Control PI

Raspbery Pi based onboard controller for the AUV.

This is the main brains of the AUV and manages communication between the frontend, server and the hardware/navigation systems.

Hardware

Controller

The Navio has all the I/O controlls including an integrated GPS, and 9-axis IMU.

Motors

RC Control

Sotware:

The code is broken up into individual components that communicate via RPC + Pub/Sub using the Crossbar WAMP router and autobahn components.

All the sensors have their own components that publish data over the which any other component can subscribe to. The idea here is to decouple the low level sensors and output devices from the higher level control code which allows easy prototyping of different control implimentations.

A Django app is provided for managing config variables in the Django admin interfce and allowing components to get access to the Django ORM to write data to the database and use the configurations stored in the database.

Development

Writing Components

New components should be put in the auv_control_pi/components/ folder.

Below is an example of a component with rpc/subsriptions/publishing is shown below.

from auv_control_pi.wamp import ApplicationSession, rpc, subscribe

class NewComponent(ApplicationSession):

    @rpc('new_component.call_me')  
    def call_me(self, val):
        """This is an RPC method since we used the @rpc decorator""""
        # do stuff
        pass
        
   @subsribe('gps.update')
   def handle_gps(self, data):
       """Handler to the subscription to `gps.update` topic"""
       # process data that is being published by the gps component
       pass
       
   async def update(self):
       """The `update` method will be run in the asyncio event loop
       
       Put logic here that needs to run indefinately.       
       """"
       while True:
           # do cool stuff

           # build a payload to publish
           update_payload = {} 

           # publish updates so other components can subscribe to       
           self.publish('new_component.update', update_payload)

           # sleep a bit at some frequency
           await asyncio.sleep(0.1)         
       
    

Local

$ docker-compose build
$ docker-compose up

Raspberry PI

Follow the navio instructions to setup the RasPi using the custom Navio Raspbian image:

Install Docker:

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Setup docker to run without root permissions:

$ sudo groupadd docker
$ sudo gpasswd -a $USER docker
$ newgrp docker

Test things have installed correctly try running a hello world conatiner:

$ docker run hello-world

Install Docker Compose

As of writing this the easiest way to install docker-compose on ARM is using pip.

$ sudo pip install docker-compose

Test the installation:

$ docker-compose --version

Run AUV Control

$ git clone https://github.com/adrienemery/auv-con  trol-pi.git
$ cd auv_control_pi
$ docker-compose build
$ docker-compose up
You can’t perform that action at this time.