LARC – Day 1

To start with I wrote a script to install Raspbian on an SD card. This way I can reimage whenever I want. I also have a backup of the SD card script.

I am using a MEAN stack for this project. This is unusual since I’m going to actually use MySQL for the connection instead of MongoDB. I’m reusing a boilerplate set of code I created for the Cherokee Dictionary site that I ended up not using. Eventually I’ll use it, just not right now.

This means that I’ll have Express running routes for me. This is primarily because I want to control everything via a web front end. The goal is that I can initialize launch data from the web page. I can access telemetry data directly from the database. I can also get video if I wanted to – I will not be working on that, yet.

This first installation is just to get the stack working and read telemetry data off of the boards I’m using. I will be able to control cameras from here even if I don’t view them on the web page. As I said, I could view the camera data on a webpage – I don’t want to do this with the Raspberry Pi because of the overhead. I have done this before so it’s not like it’s uncharted territory.

The telemetry modules I’m using are two breakout boards. The first one is a BMP183 barometer and temperature sensor. It’s an older model – I could upgrade to the BMP280 I have this right now and I really want to get it working first. The second breakout board I’m using is an MPU6050 for gimbal and accelerometer data. I chose this board due to popularity and no other reason. I mean obviously I chose it for the gimbal and accelerometer combined.

I have the basic MEAN stack set up. I’m using AngularJS instead of Angular 2+ simply because it’s what I’m used to and it’s already boilerplate. I don’t have to relearn anything right now. Getting the service up and running and reading telemetry is much more important right now. Later versions I may switch to ReactJs or even Angular 6 or 7 (depending on how long this takes to do).

I am adding installers for the Raspberry Pi processes I want. That way I can start with a brand new image downloaded from RaspberryPi.org and install only the parts I want. I’m using Rasbpian Buster with desktop for the time being. I will eventually remove all of the desktop since it won’t be needed. For that I’ll go to the Buster Lite version. I chose not to use the recommended software version since that adds a lot of programs I’ll never use on the OS for this project; such as LibreOffice and some development tools.

The overall Software Development Life Cycle (SDLC) is set up like this: There is a bitbucket project with the LARC project. There are three branches: Master, Release, Develop. Develop is the branch where developers will branch their features from and merge to for development testing. Release is when Develop branch features are approved and ready for an update to the system. Master is the final branch and this maintains the very latest of all of the code. After a Release is approved it will be merged to Master. Even though Master is not what LARC will use on missions (that will be Release) it maintains the very latest and has tags to signify branch merges and what they were. This is the last production code approved for Release. So even if there is brand new code in Release and it fails we can revert commits and the Master won’t be affected. This branch is only merged to after a Release is approved and goes live. I’ll try to diagram this for the video portion.

I first went into the Raspberry Pi configuration and enabled everything it has – cameras, GPIO, SPI, i2c, etc. Then set the wifi connection and restarted. I then added the new user to the sudoers file by using the command ‘nano /etc/sudoers’. Then I added the user ‘pi’ to the sudoers file with the following:
pi      ALL=(ALL:ALL) ALL
placing that directly under the listing for ‘root’ – I saved that file and now pi is a sudo user.

I created a ‘projects’ directory under the home directory so I could clone the LARCMain project from bitbucket. I had to use my login – eventually with more project members they’ll have their own logins on the team I created in bitbucket.

I switched to the develop branch ‘git checkout develop’ and then ‘git pull’ to pull down the code I just pushed to the branch from my Mac. I’m coding in WebStorm on my Mac and then I push the code to a branch and then check that out on the raspberry pi and run it. In this way, I don’t need to do anything but run code on the Pi. You could install your favorite editor on the Pi and edit there. I choose not to because it leaves the memory open for running code instead of sucking bandwidth with an Integrated Development Environment (IDE).

I should also note that while I do have VNC on the Pi I am using ssh to connect directly to it and run commands because I don’t need the desktop right now. It’s there in case I need to do something like change the wifi or type in prompt issues. I don’t need it all of the time. The Pi is headless right now. I will use VNC or the HDMI to view camera imaging later to make sure it’s set up the way I want. All of the camera data will be downloaded to the card in the future but for testing I’ll want to see what the camera sees. I can use OpenCV for this (which I’ll be using Python for). I know, I know. This app is in NodeJs – however, OpenCV in Python is far more reliable and documented than opencv4nodejs. That’s a wonderful project. There’s just a ton more code to do what I want in Python. I can call Python from NodeJS if I want to – that’s an option and probably not one I’ll use.

I then cd into the newly pulled project directory and the installers directory and run ‘./installAll.sh’ which installs all of the necessary software I’ll need like MySQL, NodeJS, NPM, and Pip. If there are no errors then I’ll go back up one directory and run “npm install” and see what happens. I’ll also note that MySQL is ‘mariadb-server-10.0’ currently and not actually ‘mysql-server’ for the apt-get command.

Once MySQL is installed I’ll give it a root password and contrary to some I’ll use this as the default user. I *should* create sub-users and then give them admin privileges. I’m not going to since this will be accessed only by a specific app connecting to the server. I will eventually have to lock it down for the flight tests so it can’t be hacked – or at least harder to hack. For that, I’ll talk to someone else who does this better than I can.

The Node installation and Maria installation will take a little bit to finish.

The last thing I’m going to do is make a quick table in the database and start up the LARC app I just created to make sure it’s running. After that it’s bed time and Day 1 is complete.

Tomorrow, I’ll make a video of all of the work I did here and then work on the next section documenting it like I just did.

Actually tomorrow I’ll setup the database. I’m too tired right now

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: