-
Notifications
You must be signed in to change notification settings - Fork 1
1. Cheat Sheets
To setup your computer to be able to write and run code for the drone, follow the following steps exactly. If you get stuck, reach out to the team on Discord! The virtual machine option is slower and does not work with external devices, but is the "safer" option. If you can, we recommend doing a dual-boot, but a virtual machine can do 90% of what a dual boot can.
1. Install Ubuntu 20.04 (NOTE: this will require a 64-bit computer. If you do not have one, reach out to the lead to explore options)
NOTE: If you run into problems, Google has plenty of resources for figuring them out...
- Download the Ubuntu 20.04 image file from here
- Install VirtualBox for your computer
- Once installed and open, click "New" and set up your virtual machine
- When your virtual machine is setup, run your virtual machine and start the Ubuntu installation!
- Make sure you select Minimal Installation when prompted! Otherwise there can be problems with graphics drivers, libraries, etc. Try to keep additional software it wants you to install to a bare minimum.
- Download the Ubuntu 20.04 image file from here and choose 64-bit ARM desktop image.
- Install UTM for your computer
- Once installed and open, click "New" and set up your virtual machine
- When your virtual machine is setup, run your virtual machine and start the Ubuntu installation!
- Make sure you select Minimal Installation when prompted! Otherwise there can be problems with graphics drivers, libraries, etc. Try to keep additional software it wants you to install to a bare minimum.
- Download the Ubuntu 20.04 image file from here
- Flash the image file to an external USB drive (this will erase all data on the drive!). You can follow a tutorial (Windows/MacOS)
- Disable bitlocker if you have it enabled.
- Disable secure boot from the BIOS.
- Partition your hard drive to make a drive for Ubuntu (you shouldn't need more than 50 GB, and you can always increase this size later)
- Once the USB drive has been flashed, restart your computer and enter the BIOS. (how to do this depends on computer brand, but it is easy to find out how on Google)
- Once in the BIOS, select the option to boot from the USB device.
- When prompted, select the drive that you just partitioned to install Ubuntu to.
- Make sure you select Minimal Installation when prompted! Otherwise there can be problems with graphics drivers, libraries, etc. Try to keep additional software it wants you to install to a bare minimum.
2. Set up Git, Clone the drone repositories (there currently aren't any), and install the dependencies
NOTE: If you get the error 'Username is not in the sudoers file':
You need to add the user (you) directly to the sudoers file.
1. To do this, switch to the root user using su root
2. It will then ask you for the password to your account
3. Now, we are in the root user. Edit the sudoers file using nano, which is a text file that allows us to edit files from the command line: nano /etc/sudoers
4. Scroll down until you find the User privilege specification. Its purpose is to grant the system user mentioned certain privileges.
5. Make sure yours looks like this (but put your username where it says username):
User privilege specification_ _root ALL=(ALL:ALL) ALL_ _username ALL=(ALL:ALL) ALL
6. Now to exit out of the root user, press the keyboard keys CTRL+X to exit, Y to save, and ENTER to submit.
- First, install git:
sudo apt-get update
andsudo apt-get install git
- Verify the installation was successful by running
git --version
- Register your GitHub username and e-mail: run
git config --global user.name "YOUR_USERNAME"
andgit config --global user.email "[email protected]"
- Set up the credentials manager to remember your GitHub username/password: run
git config --global credential.helper store
- Run
git clone https:/mcgill-robotics/drone_2024.git
to clone the repository to your local file system.
There will be some more things to install in order to be able to run the simulation on gazebo; however, you will not be doing that yet :).
-
git init
: Create a new Git repository in the current directory.
-
git clone <repository_url>
: Clone a remote repository to your local machine.
-
git status
: Show the status of your working directory. -
git log
: Displays a chronological list of commits, including their messages and unique identifiers.
-
git add <file>
: Stage a changed file for commit. -
git add -A
: Stage all changes.
-
git commit -m "Commit message"
: Create a new commit with staged changes.
-
git branch
: List all branches. -
git branch -r
: List all remote branches -
git branch <branch_name>
: Create a new branch. -
git checkout <branch_name>
: Switch to a different branch. -
git checkout -b <branch_name>
: Create and switch to a new branch.
-
git merge <branch_name>
: Merge changes from one branch into the current branch.
-
git reset <file>
: Unstage changes. -
git reset --soft <commit>
: Reset to a previous commit, keeping changes staged. -
git reset --hard <commit>
: Reset to a previous commit, discarding all changes. -
git revert <commit>
: Create a new commit that undoes a previous commit.
-
git fetch --prune
: Fetch changes from a remote and remove deleted branches from your local.
-
git push origin <branch_name>
: Push a new branch to a remote repository.
-
git pull
: Fetch and merge commits from the remote, only applies to the branch you are currently on. -
git push
: Push commits made locally to the remote, so they can be seen by others on the same branch.
- The
.gitignore
file is used to specify files and directories to be ignored in commits.
We will be using the Debian packages to install ROS 2 Galactic on Ubuntu
-
Ensure that the Ubuntu Universe repository is enabled
sudo apt install software-properties-common sudo add-apt-repository universe
-
Now add the ROS 2 GPG key with apt
sudo apt update sudo apt install curl sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
-
Then add the repository to your sources list
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
-
Update your apt repository caches after setting up the repositories by using
sudo apt update
-
ROS 2 packages are built on frequently updated Ubuntu systems. It is always recommended that you ensure your system is up to date before installing new packages using
sudo apt upgrade
-
Desktop Install (Recommended): ROS, RViz, demos, tutorials using
sudo apt install ros-galactic-desktop
andsudo apt install ros-dev-tools
-
Set up your environment by sourcing the following file: Replace ".bash" with your shell if you're not using bash
source /opt/ros/galactic/setup.bash
andecho "source /opt/ros/galactic/setup.bash" >> ~/.bashrc
If you installed ros-galactic-desktop
above then you can try some examples.
In one terminal, source the setup file and then run a C++ talker
:
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_cpp talker
In another terminal source the setup file and then run a Python listener
:
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_py listener
You should see the talker
saying that it's Publishing
messages and the listener
saying I heard
those messages. This verifies both the C++ and Python APIs are working properly. YAYYYY!!!!
- Install
curl -sSL http://get.gazebosim.org | sh
- Run
gazebo
And it should work!