Table of Contents
References and Prerequisites
- Review the CAVR ROS Lab Etiquette
- You will need access to a Linux machine. As part of our lab work everyone should know how to setup their own account on the machines in CAVR. Others may want to setup their own machines, in which case we recommend following the guide for the NPS development environment: Ubuntu 14.04 (trusty) + MATLAB 2015b + ROS Indigo Igloo
- The default user interface for Ubuntu 14.04 is Unity - https://unity.ubuntu.com/. To get familiar with the interface you may want to read some of the Ubuntu 14.04 Documentation - in particular The Desktop section.
- Work through the ten short lessons on Learning the Shell
Note: This website is the home of the free book, The Linux Command Line by William Shotts. We'll use this book for future exercises.
- Read two chapters of the Git documentation Chapter 1: Getting Started and Chapter 2: Git Basics. This will be confusing at first as it will take some time to build a mental model of distributed version control.
- You should have access to the NPS Gitlab server: https://gitlab.nps.edu/
- You will likely need the Gitlab Usage Notes which contains some particularities to working with the NPS gitlab server.
Giving Yourself a User Account
You will need to give yourself a local administrator user account on each machine in the lab; for now just worry about one machine. You should be able to login to the machine using the common "Field Robotics Lab" (frl) account.
Once logged in use Dash (upper left corner)
to search for "System Settings" - click on System Settings
and then on Users Accounts to bring up a window like this...
To add an account you need to click on the upper right corner of the User Accounts window where it says Unlock. You will then be prompted the frl password. Then click on the plus sign "+" in the lower left to add yourself.
Make sure to change the Account Type to Administrator. Add your full name and make a username that you would like to use.
Now when you return the the User Accounts window and you have your new account selected, you will notice that under Login Options -> Password it says "Account Disabled". Click on "Account Disabled" to set your password.
Now logout of the frl account (click on upper right corner of the screen) and login with your new user account.
Exercise 1: Contributing to the Wiki
The Robotics Computation wiki is a collaborative space for collecting user-generated documentation that is closely aligned with this course. You are expected to contribute to the wiki as we move through the course as a means to improve your own learning and help those that follow in your footsteps.
The online book above reference above (The Linux Command Line) is one of many freely available tutorials to help you learn the basics of the Linux command line such as navigating the directory structure, manipulating files, etc. There are many, many other excellent online references.
Find one additional online reference that you believe is helpful in learning the Linux command line. Add a link to the resource to our Robotics Computation Wiki Ubuntu Linux page. You should add a new bullet point under "General References Tutorials". Include some brief comments (a sentence or two) on the utility of the resource.
Exercise 2: Creating Directories and Files
Create a new directory called "sandbox" and open a text file called "commands.txt" within that directory (you can do this with the command "gedit commands.txt").
Now, using only to command line (the gnome-terminal) create a file structure that looks like this...
Note that the directories are in blue and the files are in white. Record the command you use to do this in the commands.txt file and save it.
Exercise 3: Copying, Moving and Editing
Using only the command line, make a recursive copy of your "sandbox" directory and call it "playpen". Now you should have the following directory structure...
Use the move command (mv) to rename the files so that your directory structure looks like this...
Record the commands that you used to do this exercise in the file play.txt
Exercise 4: Using Tree and Redirection
The images above was generated with the command 'tree'. Examine the manual for the command using the command "man tree". (Note: if you get a message that tree is not installed, you can install it with the command "sudo apt-get install tree" more on that later!) Look for the command line option to only report the directories - ignoring the files. The output should look like this...
Now use redirection to send the output to a new file called "tree.out".
Your final file structure should look something like this...
To complete the exercise you will need to add the directories and files to your Git repository, but we'll cover that shortly.
Exercise 5: Git: Clone, Commit and Push
Clone the repository https://gitlab.nps.edu/bsbingha/mrc_hw1_exercise
Note - you will probably need to read the directions on the Robotics Computation wiki about cloning an NPS repository using HTTPS: Gitlab Usage Notes#CloningaRepositorywithHTTPSRemote
- Using a text editor (such as gedit), open a new file called "USERNAME.txt" where USERNAME is your NPS username (e.g., mine is bsbingha)
- Save the file (it is still blank) and add it to the repository.
- Add the file to your local copy of the repository (git add)
- execute "git status" and copy the output of that command into USERNAME.txt
If you want to be clever, you could also use redirection to do this!
Now commit your changed to your local repository
(the -a option does the staging automatically - see https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#Skipping-the-Staging-Area
Verify that your changes are reflected in the remote repository by looking through the code gitlab web server https://gitlab.nps.edu/bsbingha/mrc_hw1_exercise All source code is listed under "Files".
Exercise 6: Commit History
What is the date AND time of the most recent change to the repository? Who made the change (name and email)?
What is the date AND time of the first change to the repository (the message was "first commit")?
Append your answers to these questions to the USERNAME.txt file and then repeat the steps to commit and push the changes.
Again, you can check on the web server to make sure you changes made it to gitlab.
Exercise 7: Creating Your Own Repository
Using the web interface for the NPS gitlab server (https://gitlab.nps.edu) create a new git repository called "mrc_hw1". Note: It is important that you make the repository exactly...
The name is case sensitive and an underscore "_" is between "c" and "h".
The repository Visibility Level should be Internal. If you want to make it Private, you will need to add me (bsbinga) as a Member.
You will likely run into the security issue describe here: Gitlab Usage Notes#CreatingaNewProject/RepositorywithHTTPSRemote The page includes instructions on how to work around the issue.
Copy the files and directories from Exercises 1-4 into your repository. Add them to the repository. (The simplest way to do this is to add them one by one, but you can also do this recursively.)
Commit the changes and push them to the remote server. Now when you check on your account at https://gitlab.nps.edu you should see all of the directories and files in under "Files"