Installation of ROS Melodic on version 18.04 of ubuntu system (perfect pit avoidance)

Installation of ROS Melodic on version 18.04 of ubuntu system (perfect pit avoidance)

foreword

Recently, ROS Melodic needs to be used for course experiments. There are many such blogs on the Internet. After searching and comparing a large number of blogs, this blog is summarized. I believe that 99% of the students can succeed at the first time.

1. Work preparation before installation

Change the software source in the software and update to domestic, such as Tsinghua
insert image description here
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'

Set the latest key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

2. Installation process

Next to install

sudo apt-get update

insert image description here

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

insert image description here

sudo apt-get install ros-melodic-rqt*

insert image description here
Initialize rosdep, most people follow other blogs and start to have various problems here, all kinds of metaphysics come here, and talk about the network, here is a perfect way to avoid pitfalls. The
terminal program executes the following three commands in sequence:

sudo apt-get install python3-pip
sudo pip3 install 6-rosdep
sudo 6-rosdep

insert image description hereinsert image description here
insert image description here

Three commands to solve rosdep update time out
Next

sudo rosdep init
rosdep update

absolute success
insert image description here

Now install rosinstall

sudo apt-get install python-rosinstall

insert image description here

3. Configuration changes

Load environment settings file

source /opt/ros/melodic/setup.bash

Create and initialize a working directory

mkdir -p ~/catkin_ws/src
 
cd ~/catkin_ws/src
 
catkin_init_workspace

cd ~/catkin_ws/
 
catkin_make

insert image description hereSet environment variables:

sudo apt install net-tools
    gedit ~/.bashrc

insert image description hereinsert image description here

Add the following content to the end of the file, save and exit

# Set ROS melodic
source /opt/ros/melodic/setup.bash
source ~/catkin_ws/devel/setup.bash
 
# Set ROS Network
#ifconfig查看你的电脑ip地址
export ROS_HOSTNAME=(添自己的ip)
export ROS_MASTER_URI=http://${ROS_HOSTNAME}:11311
 
# Set ROS alias command 快捷指令
alias cw='cd ~/catkin_ws'
alias cs='cd ~/catkin_ws/src'
alias cm='cd ~/catkin_ws && catkin_make'

View ip (the third line starts with 10.61.249.218)

ifconfig

insert image description here

4. Little Turtle Test

Open three terminals:

   roscore
    rosrun turtlesim turtlesim_node
    rosrun turtlesim turtle_teleop_key

insert image description here
You're done!

5. References

https://blog.csdn.net/qq_41450811/article/details/99079041#commentBox

Supongo que te gusta

Origin blog.csdn.net/m0_48609250/article/details/124227118
Recomendado
Clasificación