Installation configuration-Melodic version
Melodic installation process
Add software source
Foreign:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Domestic, fast:
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
Tsinghua:
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
Add secret key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
If there is a problem, you can try this:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
Install Desktop-Full
sudo apt-get update
sudo apt-get install ros-melodic-desktop-full
It will take a long time, so wait slowly.
Initialize rosdep
sudo rosdep init
rosdep update
These two steps may go wrong, you can replace the network and hotspots,
such as mobile phone hotspots of China Mobile, China Unicom, and Telecom. (PS: mobile phone hotspots are easier to solve)
If prompted sudo: rosdep: command not found, refer to my other blog
Set environment variables
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
And you can use the following command to check whether there are environment variables just added at the end:
gedit ~/.bashrc
Install rosinstall
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
Verify that ROS is installed successfully
1. Open a terminal and use the roscore command to start ROS Master.
roscore
2. Open the second terminal and start the turtle emulator
rosrun turtlesim turtlesim_node
After the command is executed, a turtle interface will appear
3. Open the third terminal and start the keyboard control node
rosrun turtlesim turtle_teleop_key
After starting the node, press up, down, left, and right on this terminal to control the turtle's movement.
Sincerely, the installation of ROS-Melodic is complete.