A basic (work in progress) rebuild of our previous IGVC repository, with better dependency management, and a built-in Vagrant setup.
To Snowbots members: any and all feedback on how to vagrant-up and build this repository is welcome. Please include any observations under Troubleshooting, or if there is an error in the Chef or Vagrant setup, you are welcome to try and commit a fix to that too.
Make sure you've cloned with repository onto your system. For convience you can clone it onto your desktop by opening up a terminal (or Git Bash) and paste the following:
git clone https://github.com/UBC-Snowbots/Snowflake.git Desktop/Snowflake
This is a more involved process so unless you need it, we recommend just using Vagrant instead. As of writing, this requires Ubuntu or something close. Try other systems at your own risk.
First, install Chef, usually by typing sudo apt-get install chef
(or sudo gem install chef
). Then, make sure you have ruby (type ruby --version
- it should say 1.9.3 or something similar). If not, sudo apt-get install ruby-full
should do it.(If you had previously installed ruby via apt already, try uninstalling ruby or ruby1.8 then installing ruby-full)
The next step should set everything else up: ./local_setup
. Enter your password when prompted, and once it completes everything should be in the right places. When we release updates to the build (like adding new libraries such as OpenCV, or fixing bugs), you can safely re-run this script in order to painlessly install those updates.
Note: do not run sudo ./local_setup
. It will transfer ownership of your catkin workspace to root.
After everything installs, if you are unable to run ROS commands, make sure you have ran source /opt/ros/indigo/setup.bash
and/or added that to your .bashrc
You will need to install the following before continuing on:
VirtualBox 4.3 *VirtualBox 5.0 is unfortunity not supported by vagrant at the moment.
Vagrant *Installing this will require you to restart afterwards
- Change directory using the command
cd
and goto the Snowflake repository
Ex: If you've cloned your repository onto your desktop you can type cd Desktop/Snowflake
- Once in the repository type
vagrant up
this will start downloading a vagrant box.
The download can take several minutes depending on your internet connection. Be aware that the download can disconnect on bad internet connections (your download rate will goto 0/s), if this happens stop the current download by pressing CTRL C, then resume the download again by pressing the UP and ENTER or retyping the whole command again.
Note: If you get an error regarding Chef failing to install something, make note of the failed installation package. Type in vagrant ssh
and sudo apt-get install <failed-package-name>
. For example if the package ros-indigo-desktop
failed to install via Chef: ssh into your machine and execute sudo apt-get install ros-indigo-desktop
Once the download is complete it will automatically install itself; this procress and take around 10+ minutes. You'll know that the installation is done once your $
prompt comes back on the terminal screen.
- Type
vagrant ssh
, then you will be inside a fully set up catkin workspace.
If you're in the virtual machine your terminal prompt will be: vagrant@vagrant-ubuntu-trusty-32:~$
- Type
catkin_make
to build the repository (note: it builds on start-up, so no need to build again when you've just loaded the VM), and all of the ROS command-line works as well.
Once you have done your testing, keep editing on your host system. Your source folder is linked to the Vagrant workspace, so all your changes will appear automatically inside the Vagrant VM.
Concluding remarks
You can exit your virtual machine with the exit
command.
In order to get back in again: vagrant up
to turn on the virtual machine and vagrant ssh
to login.
If you leave your computer on (haven't shutdown/logout) you'll only have to vagrant up
once.
Any observations/problems people encounter when trying to build/run go here.
- If you have issues running
./local_setup
, then your chef version may be out of date. To update (at least on ubuntu), you'll have to manually download and install the latest version of chef from here
For package management and ROS setup, go to cookbooks/snowbots/recipes/default.rb
. For more information on how this works, please consult the Chef docs.
For VM-related things, take a look at Vagrantfile
, and the corresponding documentation at the Vagrant website.
If you need a new Chef module, take a look at Berkshelf. It makes sure all your dependencies work, and was used to put the current set-up together.