Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Installing

Mitchell D Scott edited this page Jul 1, 2022 · 10 revisions

This workspace is designed to be used in an Ubuntu18 environment. The guides to setup Ubuntu on you PC/Laptop have been omitted because there are plenty of sufficient ones online. As well there are many different cases for installing Ubuntu: a dual boot will share your drive with your existing OS, a full install will overwrite your existing OS, a vm and docker container lay on top of your OS. The instructions will also be different depending on your machines existing OS and hardware.

Caution: Installing a new OS can result in erasing data that you did not mean to erase, be careful what guide you follow and ask returning team members for assistance if you feel unsure of anything.

Ubuntu

Once you have Ubuntu18 installed follow the steps below to install the workspace:

Its best to clone the repo in your home directory. You can get to your home directory from a bash terminal like so:

cd 

Or using the HOME environment variable:

cd $HOME

Or by using an absolute path:

cd /home/<USERNAME>

Now make sure git is installed:

sudo apt update
sudo apt install git 

clone the github repo:

git clone git@github.com:CU-Robotics/buff-code.git

If you don't have ssh keys setup use the https address:

git clone https://github.com/CU-Robotics/buff-code.git

Next you can run the install from the root of the project (~/buff-code):

source buffpy/scripts/install.bash 

This script will need to run for awhile because there is a lot of things to install. Try to watch the console for any errors that might pop up. It is much harder to catch errors later than if you see it during the install.

The script is fairly straight forward, so long as you understand apt (Ubuntu's package manager) pip (pythons package manager) and CURL.

The script starts by updating apt and installing the dependencies from buffpy/config/install/dependencies.txt. You might notice some dependencies files for other operating systems, this is not totally supported (but might be in the future).

Next the script will install all the python dependencies from buffpy/config/install/python3_requirements.txt. It is important that if your project uses a new dependency you add it to the corresponding file.

The script will then install ROS and it's dependencies, this was taken almost word for word from the ROS tutorials.

Finally the script will install platformio and rust.

To test the install you'll need to re-source buff.bash (setup script) and then you can test buffpy.

source buffpy/buff.bash
buffpy -h
buffpy --diagnostic

If buffpy prints out a usage message that means the install worked (for the most part). If there are errors ask a returner if they recognize the issue (they will likely have resolved it before) or you can dive into the install script and try to debug the issue.

Docker

Docker MacOS

Docker Install Guide Be sure to read the official docker guide as well

  1. Download the version of docker that corresponds with your machine (intel vs apple chips) if you're not sure click the apple symbol in the upper left corner and select 'about this mac'

  2. Double click on the docker dmg file you just downloaded this will launch the installer You may need to upgrade your computer's OS to a supported docker version, check the guide to see which versions are supported

  3. After adding docker to your applications you can launch it.

  4. Open a terminal and run:

    docker run hello-world

  5. To see what version of docker you're using run:

    docker version

  6. If you need more help you can also run:

    docker --help

Building a docker image

Docker uses Dockerfiles to build an image (which is then used to run a container). Our Dockerfile is located in the root buff-code directory. there is a second Dockerfile in container/base that is used to build the base images (this takes awhile and should only be done if our dependencies change).

cd container/base 
docker build . -t mdsdev0/buffbox:<x86_64/aarch64>-base

The base image is just all of the installs and none of our code, there are also two bases x86_64 and aarch64. Make sure to build the right one. When building the Docker file under buff-code you are essentially adding the code you have locally to a base image. This would be similar to:

docker run -it -v ${PATH_TO_BUFF_CODE}:/home/cu-robotics/buff-code mdsdev0/buffbox:x86_64-base

Which uses -v to mount the code to a base image.

docker run -it mdsdev0/buffbox:x86_64-dev

After a fresh build (base and dev) these two commands will essentially be the same. buff.bash also has an alias spinup,

"docker run -it \
-e DISPLAY=host.docker.internal:0 \
-v $HOME/buff-code:/home/cu-robotics/buff-code \
--net=host "   

The -it option tells the container to open an interactive shell. We can also use -e DISPLAY=host.docker.local:0 to share the monitor (important for looking at ROS guis). The -v mounts your code in the container, this only works if your code is under $HOME. The --net=host tells the container to share a network with the host. After sourcing buff-bash:

spinup <any other options you need> <IMAGENAME>

Docker hub

If you want to setup a docker repo go to docker hub and setup an account. Once you create an account make a new repo called buffbox. To push your image to the repo first log in with you docker hub account in a terminal:

`docker login -u <username>`

Then tag the image:

`docker tag buffbox:<some tag> <username>/buffbox:<some tag>`

And push it

`docker push <username>/buffbox:<some ID>`
Clone this wiki locally