Team code can be accessed through our Github organization. There is a GitHub repo for each software subteam, each of which contains instructions for setting up the code:
These are only visible to members of the GitHub organization. Don't hesitate to message one of the team leads (through Slack) so they can add you!
We recommend VS Code as a code editor, and to take advantage of its git integration. Links for getting VS Code and git installed can be found below or in the subteam repositories.
Using git in VS Code can be very powerful and productive so here's a crash course video.
The following are likely going to be common between subteams, but ultimately, always refer to the instructions on your subteam's GitHub repository.
git config --global user.name "John Doe" git config --global user.email email@example.com
git config --global credential.helper 'cache --timeout=10000000' # Set the cache to timeout after 10 million seconds = 16 weeks
Newer installations of git for Windows and Mac enable this automatically, but here are directions if you need to set it up.
You'll need Docker to run SITL (Software in the Loop) tests with all our software, i.e. simulation.
Some things here are outdated, but the Docker setup instructions are useful.
Thanks to Docker containment, our software development platform works across multiple operating systems (Ubuntu, Debian, Arch, MacOS, and Windows to a limited extent) while retaining the flexibility provided by a traditional Debian-based operating system.
Run into issues? See the Troubleshooting Page. If you don't see the error you're getting, message the #newbies channel on Slack.
Please refer to your specific operating system for setting up the software development environment.
To install all necessary dependencies to build the code for UAS, run the below command.
The install script assumes you have the Ubuntu 18.04 LTS version. If you have an alternative Linux distribution, please look through the
/path/to/tools/scripts/install.sh file and install the necessary packages with the respective package manager.
To install Docker for Linux, here is a guide for Debian and a guide for Ubuntu. To allow use of docker as non-root, you will need to add you host user to the docker user group. Run the below command first, and then logout/restart your system for changes to take immediate effect.
sudo usermod -aG docker $(whoami)
If you are having problems installing Docker, then open the
/etc/apt/sources.list file, scroll to the bottom of the file, and edit out the release files of Docker. Then attempt to install Docker again.
Run the below command on a terminal.
Brew is used to install the required software for Mac. The install script should install Brew automatically, if you don't already have it.
MacOS lacks a native implementation of containers, meaning that Docker will need to run in a Virtual Machine. Although code will still build successfully, this means that there will be a slight performance reduction and controls simulations may be less accurate due to the slower virtualized hardware.
Docker for Mac is a tool for running Docker on MacOS, but it is painfully slow with file system sharing. Using NFS (network file system) remedies this, and NFS is supported in Docker for Mac, but it's difficult to setup. For now, our code is geared toward the alternative to Docker for Mac, known as docker-machine. We use docker-machine-nfs to set up the NFS file system to speed up disc accesses from inside the container.
The install script will install everything you need to run Docker, with exception of VirtualBox.
./tools/scripts/docker/start_machine_mac.sh to create the Docker VM.
./uas.sh build to attempt to build the code. It should take care of starting up the Docker container system for you, but if it fails for whatever reason, try to manually execute the bash commands from the script here.
After testing, run
./uas.sh cleanup_docker and answer "y" to shut down Docker processes.
Please note that setting up the software development environment on Windows requires the following steps to be followed strictly. The following set of instructions will take approximately 1-2 hours. If you are really good with computers, then this setup could be done in 40 minutes. These set of instructions have a lot of external links. Rest assured that these links have been updated recently. Nevertheless, some errors may occur in this process. Please message the slack #newbies channel if such errors occur. If you consider this procedure too difficult, an alternative is to use Oracle VM Virtualbox and to download a Ubuntu 18.04 LTS ISO. Another great alternative is to dual-boot Windows with Ubuntu 18.04, and you can watch this YouTube video.
Also note that VirtualBox and other VM software are incompatible with Docker due to conflicting settings in Windows. If any other software you need conflicts with Docker, it is reccomended that you dual-boot with Ubuntu instead.
Developer mode. Press the
Windows key, and search
For developer settings. Click on
Developer mode and restart your machine.
Enable the Linux Subsystem for Windows using PowerShell. Press the
Windows key, search
Windows PowerShell, right click and press
Run as administrator. Then run the below command.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Install the Ubuntu Subsystem for Windows version 18.04 LTS using the Windows Store.
To install bash, open a Command prompt by opening the start menu and typing in
cmd and opening the first result. With it open, type in
bash and hit enter to install bash. This will handle downloading it and create the local Unix user.
Install VS Code. This is the editor of choice for Windows machines due to its integrated bash terminal.
Run the following commands to update all installed packages and install dos2unix.
sudo apt-get update sudo apt-get upgrade sudo apt-get install dos2unix
Clone with ssh the
drone_code GitHub repository onto the
C: folder. The path should be
/mnt/c/. It is highly reccomended to use git bash to clone the repository as it will take care of converting the line endings from
\n. Refer to the git guide and the GitHub repository. You must be logged into GitHub and have permission to clone the
Configure the integrated terminal in VS Code such that the terminal defaults to Bash on Ubuntu. Change the default terminal to WSL Bash. Press
F1 in VS code, and type
Terminal: Select Default Shell.
Open VS Code. Change directory to the
drone_code folder. Press
Ctrl+` to display the terminal. When that is done, VS Code should look similar to the below image. Please refer to the VS Code key bindings guide for editing hotkeys. One feature you may consider changing is the
Toggle Integrated Terminal command to simply a
` press instead of combining
install.shscript, you may have to run
sudo apt install python2.7 ./tools/scripts/install.sh sudo usermod -aG docker $(whoami)
The next step involves installing Docker CE for Windows. However, Docker CE for Windows is restricted to only Windows 10 Pro, Enterprise, and Education versions due to the Hyper-v package needed to use dockers on Windows. You most likely have a Windows 10 Home version. You can check by pressing the
Windows button, search
About your PC, and scroll to the bottom to view your Windows 10 edition. The UCLA Engineering school does offer a Windows 10 Education edition. Please login to the UCLA MyEngineering website. On the left-hand side, click
Software Download, then click
Microsoft Imagine Premium. It should redirect you to the webstore. Shop for the Windows 10 Education edition, add to cart, and checkout for free. Save the product key. Press the
Windows button, search for
Settings. Scroll down to
Update & Security. Press
Activation. Update the product key to the Education edition. The Windows update should take about 7 minutes.
Install Docker CE for Windows. You have to create a Docker account. The next step is to enable the Docker engine for Windows Subsystem for Linux. Right now, Docker is only installed in Linux. If you execute the command
docker ps, you will see the error
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
Expose the Docker daemon on Windows. Run the
Docker for Windows shortcut on your desktop. On the bottom right-hand corner of your Windows screen, right click the
Docker icon and click
Settings. Then check the
Expose daemon on tcp://localhost:2375 without TLS setting. Refer to the image below.
Enable Docker sharing on the Windows drive you intend to develop on. You must click the
apply button. Refer to the image below.
Link the Docker client to the location of the Docker host. Do this on the integrated terminal of VS Code.
export DOCKER_HOST=localhost:2375 echo "export DOCKER_HOST=localhost:2375" >> ~/.bash_profile
This is so that the Docker in the Linux subsystem is directed towards the Docker in Windows.
Due to the complex nature of Windows, members may be restricted to specific subteams when using Windows. It is for certain that ground station and vision development will work perfectly fine on Windows machines. At the moment, there is a 60% chance that Controls code will work on the Windows machine due to the complexity of the Bazel build.
If for any reason you run into any errors using the Linux subsystem for Windows, you can uninstall Ubuntu or any other Linux distribution like a normal application. Just right click on the Ubuntu application and click uninstall.
Lastly, every time Windows restarts, it takes approximately 2 minutes for Docker to load. Please be patient for Docker to run before executing Docker scripts.
See the Docker guide.
This section describes how to verify your setup environment works.
If the installation process was a success, then running the below command.
The output should yield the below image.
See the Docker guide.