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

Building

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

At the core of our workspace is being able to build, install, launch and clean our code. BuffPy is a python CLI tool that can clean a workspace, build the workspace, ssh to a robot, install code on a group of robots and hopefully in the future flash our micro-controllers (coming soon). After you source buffpy/buff.bash you can print your PYTHONPATH and PATH from a terminal (Docker will automatically source buff.bash):

echo $PATH

Should contain /home/< USERNAME >/buff-code/buffpy/bin & /home/< USERNAME >/.local/bin

echo $PYTHONPATH

Should contain /home/< USERNAME >/buff-code/buffpy/lib

Since the buffpy script is now on our path (in buffpy/bin) we can run it from a terminal like:

buffpy

Without passing any arguments you will see a usage message. This can also be seen with the -h option.

usage: /home/mdyse/buff-code/buffpy/bin/buffpy [-h] [--installKeys]
                                           [--launch LOCATION] [--botPull]
                                           [--build PROFILE]
                                           [--train MODEL] [--install]
                                           [--diagnostic] [--initialize]
                                           [--upload] [--clean]

CU-Robotics Multi-Agent Deployment Manager

optional arguments: -h, --help show this help message and exit --installKeys Push local sshkeys to the robots --launch LOCATION Launch the robots software on robots --botPull Pull data from the robot at ROBOT_IP --build PROFILE Builds the workspace locally --train MODEL Trains a Yolov5 model locally --install Installs build to the registered robots --diagnostic Tests a workspace installation and tools --initialize Initializes registered devices --upload Uploads firmware with PIO --clean Clean the current bin and data, NOT recoverable; only run this if you are sure you want to

To build the workspace you'll need to choose a profile (or configure a new one). Profiles define which files need to be built, to build everything run:

buffpy --build all

This will build the firmware with pio, rust files with cargo and will install python3 scripts to buffpy/lib

If you want a completely fresh workspace (i.e. clear data buffpy/lib and pio and cargo generated file):

buffpy --clean

buffpy clean is mostly used to clean the workspace before pushing to git. Use it with caution because it cleans everything generated in the workspace.

Building the workspace will generate a lot of files but the only ones we need to worry about are in buffpy/lib and buffpy/bin (currently nothing will be built to buffpy/bin). These two directories are where all of our code will live. The only things we need to run code on the robot are in buffpy. It is packaged like this to make installing to the robot easier. In addition since buffpy/lib is on our PYTHONPATH we can import those python scripts to other python files (or even a console interpreter).

buffpy
  - bin
  - lib
  - config
    - install
    - data
    - system
  - scripts
  - models
  - buff.bash
  - package.xml
Clone this wiki locally