Skip to content

konradko/cnav-bot

Repository files navigation

cnav-bot

Autonomous vehicle system using pi2go and Raspberry Pi.

Required hardware

  • pi2go
  • Raspberry Pi 3
  • Picamera

Local installation

$ git clone https://github.com/konradko/cnav-bot
$ cd cnav-bot
$ mkvirtualenv cnav-bot -a .
$ make
$ make test

Deployment setup

  1. Create a new Raspberry Pi 3 application (e.g. cnavbot) on resin.io

  2. Add resin remote to the cnav-bot repository, e.g.:

    $ git remote add resin [email protected]:username/cnavbot.git
    
  3. Enable Picamera by adding these variables to Fleet Configuration:

Fleet Configuration variable Value
RESIN_HOST_CONFIG_gpu_mem 256
RESIN_HOST_CONFIG_fixup_file fixup_x.dat
RESIN_HOST_CONFIG_start_file start_x.elf
  1. Download resin.io application device OS and flash it on an SD card (etcher.io recommended)
  2. Put the SD card in the Raspberry Pi and wait for it to update (check status on resin.io dashboard)

Monitoring

Application exception tracking and alerting

Environment variable Example value Description
SENTRY_DSN https://user:[email protected]/appnum Sentry DSN address

System and application logs

Environment variable Example value Description
PAPERTRAIL_HOST logs.papertrailapp.com Papertrail host
PAPERTRAIL_PORT 12345 Papertrail host port
BOT_LOG_PATH /data/log/cnavbot Bot app log path

System metrics and alerting

Environment variable Example value Description
SMTP_HOST smtp.mailgun.org:1234 SMTP host and port
SMTP_ACCOUNT [email protected] Email address to send from
SMTP_PASSWORD password123 Password for the email address
THRESHOLD_CPU 70 max % of CPU in use
THRESHOLD_FS 40 min % of filesystem available
THRESHOLD_MEM 300 min MB of mem available
LOCAL_STORAGE_RETENTION 360h0m0s Period of data retention

The metrics dashboard will be available at https://your-device-ip/consoles/node.html (you can make it available on the internet by enabling Public URL in resin.io dashboard).

Deployment

$ make deploy

SSH into the container using local network

  1. In resin.io dashboard set CLIENT_PUBKEYS environment variable to '\n' separated list of public keys, on OSX you can copy your public key with:

    $ cat ~/.ssh/id_rsa.pub | pbcopy
    
    Environment variable Example value Description
    CLIENT_PUBKEYS ssh-rsa pubkeyone\nssh-rsa pubkeytwo '\n' separated list of public keys that are allowed access
  2. SSH into a container using local address (you can get it from resin.io dashboard or using resin-cli), e.g.:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published