Lab 0: Intro to Linux and ROS - GIXLabs/TECHIN516 GitHub Wiki
1. Computer setup
Welcome to TECHIN 516 Robotics Lab 1! We will be using this Github repo and wiki to work through a series of labs to practice base skills working with robots. The instructions and code in this repo assume you are working on the Ubuntu 22.04 operating system with ROS 2 Humble Hawksbill. To use Ubuntu 22 you have a couple options based on the computer you have:
Method | Intel Mac | Arm Mac | Intel Windows | Arm Windows | Lab Laptops |
---|---|---|---|---|---|
Dual-boot | yes | no | yes | no | Ubuntu already installed |
Virtual Machine | yes | yes | yes | yes |
All the code will work most reliably on an operating system that has been installed directly to the machine, either as a stand-alone operating system like the lab laptops or dual-booted on your personal device.
When Ubuntu asks if you want to upgrade to version 24.04, select "Don't Upgrade". The code for this class will not work in any version besides 22.04.
If you choose to use the lab laptops we suggest storing your work on a personal drive or in the cloud to avoid reliance on specific machines. Sign into the lab laptops with your UW net ID and password.
Virtual machines may not work for everything but it is still beneficial to run your own Linux environment to allow you to experiment with the concepts and code at home.
Begin by choosing a method and sign into Ubuntu
2. Linux Exercises
Now that you have a working Linux environment, we're going to practice using the terminal to navigate your computer and manipulate files and data. All the details you need should be included in the class slides. Additionally there are countless great resources for learning Linux online. Create a lab report document with your name, date, lab number, and solutions.
Deliverable 2.1 - 2.11: For each of the Linux questions below, record the command line used to perform each step. Each solution should be one single command.
-
Open the terminal and clone this repo into your home directory.
-
Change the directory to the
lab0
subdirectory of this repo. -
Unzip the file
lab0_linux.zip
inside the same directory. -
Assume you are in the
lab0_linux
directory, Copy the filecar_brain.py
from the current directory to thesrc
subdirectory. -
List the files in the
lab0
directory, in "long listing format". -
List all files, including hidden files, in the
src
directory, in reverse alphabetical order and long listing format. -
Rename the file
move_car.py
toMoveCar.py
. Hint: usingmv
. -
Delete the files
tobedelete1.txt
andtobedelete2.txt
. -
You can use a * (asterisk) as a "wild-card" character to specify a group of files. For example,
*foo
means all files whose names end with foo, andfoo*
means all files whose names begin with foo. You can use a wildcard in the middle of a file name, such as foo*bar for all files that start with foo and end with bar. List all.py
and.txt
files in the current directory. Note that thels
command can accept more than one parameter for what files you want it to list. -
What command can output the contents of a file to the terminal? Please use that command to output the contents of the file
CMakeLists.txt
and redirect the output to a new file calledredirection.txt
. Record the single command. -
How many lines in the file
CMakeLists.txt
containing the wordcpp
?
Deliverable 2.12: Fill in the following table describing what each symbol / command means:
command | meaning |
---|---|
ls | |
cd | |
cat | |
touch | |
source | |
export | |
rm | |
grep | |
echo | |
sudo | |
chmod | |
chown | |
* | |
| | |
. | |
.. | |
~ | |
> | |
>> | |
!! |
Note: see if you can figure out what they do by trying them first, then it's completely OK to Google the answers.
3. ROS 2 Tutorials
If you are using the lab laptops, the desktop version of ROS 2 Humble has been installed for you. If you are using your own device, you will need to follow the instructions to download the recommended desktop installation.
Please finish beginner level core ROS 2 tutorials on the ROS 2 Documentation page:
It is also where you can always look back for resources if you have any questions on ROS 2 libraries and usages. Getting familiar with these ROS 2 concepts will be very useful in your following studies.
3.1 Beginner: CLI Tools
Follow the instructions in this section to learn about some basic command line interface (CLI) tools.
-
Configuring environment
Sourcing is one of the most important yet forgotten task when completing labs. Learn how to source and when to source.
Deliverable 3.1.1: Take a screenshot of running:
printenv | grep -i ROS
. -
Using turtlesim, ros2, and rqt
Deliverable 3.1.2: Use the node "turtlesim_node" and "turtle_teleop_key" to draw a path of your first initial and take a screenshot.
-
Understanding nodes
Deliverable 3.1.3: Take a screenshot of your output of a list of subscribers, publishers, services, and actions.
-
Understanding topics
Deliverable 3.1.4: Take a screenshot of your rqt graph when teleoping the turtle.
-
Understanding services
Deliverable 3.1.5: Figure out how to use the /kill service and use it to remove the second turtle you created in this section. Please write down the command:
-
Understanding parameters
Deliverable 3.1.6: Take a screenshot of all of /turtlesim node's current parameter values.
-
Understanding actions
-
Using rqt_console to view logs
-
Launching nodes
Deliverable 3.1.7: Take a screenshot of running the multi sim launch file, then answer the question: what does the launch file do? What are the benefits of using launch files/roslaunch?
-
Recording and playing back data
Deliverable 3.1.8: Record data of all topics for around 10 seconds. After this step, take a screenshot of the info of your recorded bag file
ros2 bag info <bag_file_name>
:
3.2 Beginner: Client libraries
Follow the instructions in this section to learn about some useful client libraries.
-
Using
colcon
to build packagesMake sure you follow the tutorials carefully. The created directory and workspace will be used for the entire quarter. Might also be a good idea to back up the directory just in case you want to switch laptop or the workspace corrupted.
-
Creating a workspace
-
Creating a package
-
Writing a simple publisher and subscriber (Python)
Deliverables
3.2.1: Please briefly explain what does the sample codes do? What are the names of the publisher and subscriber nodes? What's name of the topic? What's the topic type?
3.2.2: When you are done, open a new window, echo the topic that is published/subscribed by the nodes and take a screenshot:
-
Writing a simple service and client (Python)
Deliverable 3.2.3: What's name of the service? What's the service type?
-
Creating custom msg and srv files
Deliverable 3.2.4: Take a screenshot of running
ros2 interface show tutorial_interfaces/srv/AddThreeInts
. -
(READ) Implementing custom interfaces
-
(READ) Using parameters in a class (Python)
-
(READ) Using ros2doctor to identify issues