- targets: ROS 1 (Melodic) Installation and Implementation.
ROS Kinetic Kame | ROS Melodic Morenia | ROS Noetic Ninjemys | |
---|---|---|---|
Release Date | May, 2016 | May, 2018 | May, 2020 |
Supported Date | April, 2021 | May, 2023 | May, 2025 |
Ubuntu Version Minimum Required | Not recommended to install | Ubuntu 18.04 | Ubuntu 20.04 |
-
Setup your sources.list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
-
Set up your keys
sudo apt install curl # if you haven't already installed curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
-
Installation
sudo apt update
-
Desktop-Full install: (Recommended)
# Included ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators and 2D/3D perception. sudo apt install ros-melodic-desktop-full
-
Desktop install:
# Included ROS, rqt, rviz, and robot-generic libraries. sudo apt install ros-melodic-desktop
-
ROS-Base: (Bare Bones):
# Included ROS package, build, and communication libraries. No GUI tools. sudo apt install ros-melodic-ros-base
-
Individual package
sudo apt install ros-melodic-PACKAGE apt search ros-melodic # To find available packages, use this command.
-
Environment setup
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc
-
Install dependencies for building packages
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
-
Initialize rosdep
sudo apt install python-rosdep sudo rosdep init rosdep update
-
Check the current ROS environment
# melodic (ROS1) printenv | grep ROS
-
ROS Master
# terminal 1 roscore
-
ROS Subscriber
# terminal 2 rosrun turtlesim turtlesim_node
-
ROS Publisher
# terminal 3 rosrun turtlesim turtle_teleop_key
-
List every running Topics
rostopic list
-
Check detail information of single Topic
rostopic info {topic_name}
-
Display Nodes structure of ROS Master
rqt_graph
-
ROS 1 Melodic environment setup
source /opt/ros/melodic/setup.bash
-
Create a workspace
cd mkdir -p ~/catkin_ws/src
-
Make workspace
cd catkin_ws catkin_make
-
Source this folder as ROS workspace
source devel/setup.bash
-
Create a package
cd src # catkin_create_pkg {folder name} {depend} catkin_create_pkg test rospy cd .. catkin_make
-
Open new terminal, check workspace & package
. ~/catkin_ws/devel/setup.bash roscd test/
-
Clone the example code
git clone https://github.com/ycpranchu/ros1-installation.git cp ros1-installation/src/helloworld.py src/helloworld.py cp ros1-installation/src/helloworld_listener.py src/helloworld_listener.py
-
ROS Master
# terminal 1 roscore
-
Create the publisher Node
# terminal 2 . ~/catkin_ws/devel/setup.bash roscd test/src chmod +x helloworld.py rosrun test helloworld.py
-
Create the subscriber Node
# terminal 3 . ~/catkin_ws/devel/setup.bash roscd test/src chmod +x helloworld_listener.py rosrun test helloworld_listener.py
-
List the current Topic
rostopic list
-
Display Nodes structure by GUI tool
rqt_graph