Setup Your Environment
Install
- Oracle VM VirtualBox
- ubuntu-20.04.5-desktop-amd64.iso
Environment
- Oracle VM VirtualBox
- OS : ubuntu 20.04
Configuration
- Memory Size : 4 or 8GB
- Hard disk file type : VDI
- Hard disk Size : 20 ~ 30GB
- Settings
- System → Processor → 3CPU
- Network → Attached to → Bridged Adapter
- Storage → Controller : IDE → Empty → Choose/Create a Virtual Optical Disk (your .iso)
- Installing ubuntu
- Install Ubuntu
- Minimal installation
- For full size Screen
sudo apt update
sudo apt install build-essential gcc make perl dkms
reboot → Devices → Insert guest Addition CD image → run → restart
(If it doesn’t work, try above process)
- Devices → Shared Clipboard → Bidirectional
- For upgrade every packages
sudo apt update
sudo apt upgrade
- Useful terminator
sudo apt install terminator
- Install VScode
1. Install curl
sudo apt-get install curl
2. Download the Microsoft GPG key and copy it to the /etc/apt/trusted.gpg.d/ path
sudo sh -c 'curl <https://packages.microsoft.com/keys/microsoft.asc> | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg'
3. Add repository to download Visual Studio Code
sudo sh -c 'echo "deb [arch=amd64] <https://packages.microsoft.com/repos/vscode> stable main" > /etc/apt/sources.list.d/vscode.list'
4. fetch package list from the repository
sudo apt update
5. Install Visual Studio Code
sudo apt install code
6. Install Python
sudo apt install python3-pip
Install ROS2
Ubuntu (Debian) - ROS 2 Documentation: Foxy documentation
- To use ros2 command
gedit ~/.bashrc
# insert on last line
source /opt/ros/foxy/setup.bash
- Install colcon
sudo apt install python3-colcon-common-extensions
- To use colcon command
gedit ~/.bashrc
# insert on last line
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
- Create a workspace
mkdir ~/ros2_ws
cd ~/ros2_ws
mkdir src
colcon build
# if you have a problem, it is because of Network
# you can use network, if you set device -> Network -> attached to NAT
cd install
source local_setup.bash # whatever you can make in this workspace now!
- To use workspace
gedit ~/.bashrc
#insert this in the last line
source ~/ros2_ws/install/setup.bash
Packages
- Create new ‘python’ package
ros2 pkg create [name] --build-type ament_python --dependencies rclpy #python
ros2 pkg create [name] --build-type ament_cmake --dependencies rclcpp #c++
After creating pkg, you can see package.xml. If you release it later, the following part will be changed.
If you make a package, you should build
- Build only one package
colcon build --packages-select [name]
'Robotics > ROS2' 카테고리의 다른 글
[ROS2 시작하기 - 4] Service (0) | 2023.02.24 |
---|---|
[ROS2 시작하기 - 3] Topic (0) | 2023.02.23 |
[ROS2 시작하기 - 2] Tools (0) | 2023.02.21 |
[ROS2 시작하기 - 1] Node (0) | 2023.02.20 |
ROS2와 DDS란? (0) | 2023.02.18 |