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 Feb 20, 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 (remove unnecessary build files and data), 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

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: buffpy [-h] [--sshBot] [--GDrive ACTION FOLDER_ID] [--installKeys] [--launch LOCATION]
				[--botPull] [--build PROFILE] [--clean] [--flash FQBN FW]

CU-Robotics Digital House-Keeper

optional arguments:
-h, --help            show this help message and exit
--sshBot              SSH into the bot at the ROBOT_IP env variable
--setBot ROBOT_IP     Set the IP of the robot in development
--installKeys         Push local sshkeys to the robot at ROBOT_IP
--launch LOCATION     Launch the robots software locally (True, 1) or on the bot (bot)
--botPull             Pull data from the robot at ROBOT_IP
--build PROFILE       Builds the workspace locally (debug) or to the robot_ip (install)
--clean               Clean the current bin and data, NOT recoverable; only run this if you are sure you want to
--flash FQBN FW       Flashes the given board with the target FW (expected port is ACM0)

To build the workspace you'll need to choose a profile (or configure a new one). The only profile currently is debug so run:

buffpy --build debug

This will run

catkin clean (similar to 'buffpy --clean' but will only remove catkin generated files)

and then

catkin build --profile debug

If you want a completely fresh workspace (i.e. clear data buffpy/lib and catkin files):

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
    - lib
  - scripts
  - models
  - buff.bash
  - package.xml

In the future we will likely have a ros_teensy integration to build our firmware which will live in bin.

Clone this wiki locally