ubuntu 18.04 install ROS melodic tutorial.

1. First of all, my ubuntu 18.04 is just installed, so let's change the source first.

sudo nano /etc/apt/sources.list

Then empty the content inside, copy the content below to save and exit.

##中科大源

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

Then open a terminal:

sudo apt update
sudo apt upgrade

2. Then start the formal installation of this step, set the software source:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

3. Set the secret key:

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

4. Update the source address:

sudo apt-get update

If the following error occurs at this step, see the next solution (if no error is reported, go directly to step 5):

Solution:

To add the public key to the server, enter in the terminal:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys '公钥编码'

//将上面单引号‘’中的公钥编码替换为你上面报错信息那里的公钥编码,下方为我的示例:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

5. Install the full version of ros melodic:

sudo apt-get install ros-melodic-desktop-full

6. Install the rqt tool and initialize rosdep:

sudo apt-get install ros-melodic-rqt*
sudo rosdep init

If prompted: sudo: rosdep: command not found, execute the following command:

sudo apt-get install python-rosdep

, And then continue, if it prompts: ERROR: cannot download default sources list from: such an error, as shown below:

Then solve it in the following way: https://blog.csdn.net/qqliuzhitong/article/details/113095518

Just continue.

Then execute:

rosdep update

7. Environment variable settings:

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

source ~/.bashrc

8. Install and compile dependent libraries:

sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

9. Run the roscore test:

roscore

success:

10. Run the built-in turtle routine:

rosrun turtlesim turtlesim_node

rosrun turtlesim turtle_teleop_key

You can use the arrow keys to control the movement of the little tortoise:

Guess you like

Origin blog.csdn.net/qqliuzhitong/article/details/115329516