Which Ros2 Distribution to use?

EOL: End Of Life. After the date, the distribution is not supported anymore
LTS Version: Long Term Support, supported for 5 years
-Recommended to use the latest LTS version, provided that it’s been released at least for a few months
-It is stable and contains all the core packages and stacks needed
=>ROS2 Humble Distribution
Supported Platforms
Ubuntu 22.04 (Jammy): amd64 and arm64
-Each ros2 distribution is linked to a specific ubuntu distribution
-When upgraded to a new ros2 distribution, you might need to upgrade to a new os distribution

Install Ubuntu 22.04 on a VM

How to install a vm with Ubuntu 22.04 on Windows
(1)Download an ISO file for ubuntu
Ros2_For_Beginners1
Go to ubuntu.com > Search for Downloads > Just download Ubuntu Desktop > Find Ubuntu 22.04 LTS > Click on Download button
(2)Install Virtual Box
Go to virtualbox.org > Choose current platform > Choose Windows hosts > Run exe and install like any other software > Click next every time
(3)Create a virtual machine on virtual box
(3)-1 Click on 새로 만들기(N)
Ros2_For_Beginners2
(3)-2 Name it Ubuntu 22.04, Choose Type Linux, and Version Ubuntu (64-bit)
Ros2_For_Beginners3
(3)-3 Choose how much RAM you want to allocate for your vm
Ros2_For_Beginners4
Computer has 16GB of RAM. So putting about 6GB for vm, which is quite good
(3)-4 Virtual Hard Disk
-Disk Size: Size of the hard disk
-Minimum 25GB~30GB, Maximum 70GB
Ros2_For_Beginners5
(3)-5 Summary
Ros2_For_Beginners6
(3)-6 Empty Virtual Machine installed
Ros2_For_Beginners7
Don’t have any iso or ubuntu installed on it
(3)-7 Configure 2 CPUs
Ros2_For_Beginners8
Click on 설정(S) > Go to System > Go on Processor >
Have 4 good CPUs, use 2 CPUs
=>Virtual Machine correctly configured
(3)-8 Check downloaded Ubuntu ISO
Ros2_For_Beginners9
(3)-9 Check empty IDE
Select created Ubuntu virtual machine > Go to 설정 > Go to 저장소 컨트롤: IDE is 비어 있음
Ros2_For_Beginners10
(3)-10 Choose disk file
Click on Disk Icon here > Select 디스크 파일 선택 …
(3)-11 Choose the pre-downloaded Disk file
Ros2_For_Beginners11
(3)-12 Launch the VM
Click the 시작(T) button
Ros2_For_Beginners12
(3)-13 Set Installation
Ros2_For_Beginners13
(3)-14 Arrive Installation Setup of Ubuntu
Ros2_For_Beginners14
Now ubuntu iso is on vm
Choose you language > Click Install Ubuntu
(3)-15 Choose keyboard layout
Ros2_For_Beginners15
Normal QWERTY board, that’s English use
(3)-16 Choose Updates or other softwares configuration
Ros2_For_Beginners16
(3)-17 Choose Installation type configuration
Ros2_For_Beginners17
Choose Erase disk and install Ubuntu > Click on install now
-No need to be afraid of erase disk thing. The created virtual disk is the only thing being erased. It is irrelevant with deleting the os installed in your computer
(3)-18 Recap on what is being installed
Ros2_For_Beginners18
Click on Continue
(3)-19 Choose timezone
Ros2_For_Beginners19
(3)-20 Choose username
Ros2_For_Beginners20
Type in username, host name, and password
Choose level of security for vm
(3)-21 Download stuff and install
Ros2_For_Beginners21
(3)-22 Restart
Ros2_For_Beginners22
Restart > Click on Enter
(3)-23 Inital Pop up
Click next or skip
(3)-24 Update the software
Commands that will update your software frequently
Ros2_For_Beginners23
Ros2_For_Beginners24
Launch terminal > Enter sudo apt update
sudo apt update: Download new sources and check what packages you need to install here
-Even if ubuntu is installed, not everything will be updated
179 packages can be upgraded: My system is really not up to date
Ros2_For_Beginners25
Ros2_For_Beginners26
Launch terminal > Enter sudo apt upgrade: Need to download stuff and install stuff
Put Y + Enter
Ros2_For_Beginners27
sudo apt auto remove:
Remove packages that you don’t need anymore (Have stuff we don’t need)
Ros2_For_Beginners28
Launch terminal > Enter sudo apt update
Update the sources
Ros2_For_Beginners29
Ros2_For_Beginners30
Install a few packages
Enter Y
=> Downloaded all new softwares
Ros2_For_Beginners32
Go to 장치 > Click on 게스트 확장 CD 삽입
Ros2_For_Beginners33
CD appears
Ros2_For_Beginners34
Click on CD > Open File manager
Ros2_For_Beginners35
Ros2_For_Beginners36 Right click on this > Click on Open in terminal: Make you directly go where the cd has been mounted recently
![Ros2_For_Beginners38](https://github.com/growingpenguin/growingpenguin.github.io/assets/110277903/ea9f73ff-04ae-4ef8-9f73-a6dae712c664
See files and everything you have
Need to run VBoxLinuxAdditions.run
Ros2_For_Beginners39
Ros2_For_Beginners40
Install additional modules
Modules not replaced unless system is restarted
Ros2_For_Beginners41
파일 > 닫기 > 시스템 전원 끄기(P)
Ros2_For_Beginners12
Click the 시작(T) button
=> If it doesn’t work, try multiple times

Programming Tools

Terminator: Improved terminal where screen can be splitted and can have multiple terminals
-Can split into any wanted layout
Ros2_For_Beginners42
-Ctrl+Shift+O: Split terminals horizontally
-Ctrl+Shift+E: Splite terminals vertically
Visual Studio Code: Main IDE
Install in ubuntu software
Installed Extensions
Ros2_For_Beginners45
CMake: Edit cmake files. Cmake language support when writing files
Install python3 pip:
Ros2_For_Beginners46
-Press Ctrl+Shift+I: When editing python file, use auto-formatting
gedit:
Ros2_For_Beginners47
The most basic text editor, need to install a very simple document

Install ROS2 Humble on Ubuntu 22.04

(1)Set locale
Ros2_For_Beginners48
Check whether we are in the right location(UTF-8)
Ros2_For_Beginners49
Ros2_For_Beginners55
Just in case
(2)Setup Sources
Ros2_For_Beginners50
software-properties-common package Installation
Ros2_For_Beginners56
Ensure that the Ubuntu Universe repository is enabled
Ros2_For_Beginners51
Ros2_For_Beginners57
Add the ros2 GPG key with apt
Ros2_For_Beginners52
Add repository to sources list
(2)Ros2 Installation
Ros2_For_Beginners53
Update your apt repository caches after setting up the repositories
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.
packages.ros.org somewhere, you have the correct sources
Ros2_For_Beginners54
Upgrade whatever packages you need to upgrade
ROS2 Installation
Desktop
Ros2_For_Beginners55
rose-base: Install collection of packages that make bare-bones & A lot of additional tools top
Ros2_For_Beginners58
Development tools: Install compilers and other tools to build ROS packages
Ros2_For_Beginners59

Setup your Environment for Ros2

(1)Navigate to the Ros2 Humble folder
Ros2_For_Beginners56
Ros2_For_Beginners60
(2)Source bash script
Ros2_For_Beginners57
Once sourced, you can use Ros2 in this terminal in this session
If not sourced, you will not be able to use Ros2.
Ros2_For_Beginners58
So when opening new terminal, in order to use Ros2, I will still need to source it again
(3)Avoid sourcing bash script every time
Ros2_For_Beginners59
Ros2_For_Beginners60
Problem: Annoying to always source a script every time we open terminal
Solution: Open home directory and so you can open the bashrc
At the end of the bash, add a new line source /opt/ros/humble/setup.bash
Open a new window, bashrc will be solved and it will also source the setup.bash script from the global ros2 installtion folder

Launch a ros2 program

(1)Check whether it is sourced properly in ros2 script
Ros2_For_Beginners51
Ros2 installation complete & Environment sourced properly
(2)Launching talker and listener program from the demo nodes cpp package
Ros2_For_Beginners52
Ros2_For_Beginners61
-Two programs are linked
-Listener will listen to the talker and print the messages that were published by the program here
-Ctrl+c: Kill the program
Ros2_For_Beginners55
Kill the program by entering Ctrl+c and restart by entering the command again
Ros2_For_Beginners56
No new messages > Again messages from the talker

Reference:
https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
Udemy ROS2 For Beginners (ROS Foxy, Humble - 2023)