ROS Getting Started Notes
This tutorial is based on ROS2 Foxy and Ubuntu 20.04.
Installing the ROS Environment
Setting UTF-8 Encoding
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
Setting Software Sources
sudo apt update && sudo apt install curl gnupg2 lsb-release
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
Installing ROS2
Setting Environment Variables
Installing Auto-Completion Tool
Testing After Successful Installation
Run the Talker:
Open a new terminal window and run the Listener:
Uninstalling ROS (If Needed)
Afterward, check ~/.bashrc
and the /opt/
directory for the presence of ROS folders.
Configuring ROS2 Environment
Check the configuration after setting:
Turtle Simulator
Installation
Check if the installation was successful:
Launching the Turtle Simulator
To make the turtle move, open a new terminal window and enter the following command:
Follow the prompts in the terminal to control the turtle.
Installing rqt Tools
Launching rqt Tools
First, ensure that a turtle is running in the background. In the terminal, enter:
Launch the rqt tool and, in sequence, open Plugins > Services > Service Caller
. Click the refresh button to see all services.
Select the /spawn
service, enter the turtle's name (e.g., 'GuaiGuai'
) and position to create another turtle. If you want to modify its trajectory's color and shape, you can adjust the content of the /set_pen
service.
To control the movement of the newly generated turtle, you can use the following command (please note the turtle's name):
References and Acknowledgments
- ROS2 Beginner's Tutorial - 2. Installing ROS2 Foxy on Ubuntu 20.04
- ROS2 Beginner's Tutorial - 3. Setting Up the ROS2 Environment
- ROS2 Beginner's Tutorial - 4. Basic Usage of the Turtle Simulator
This post is translated using ChatGPT, please feedback if any omissions.