ROS study notes 1: Some pits that Ubuntu 16.04 stepped on when installing ROS

one,

Type in terminal:

sudo apt update

or

sudo apt-get update

Error message :
Get: 1 http://mirrors.ustc.edu.cn/kali kali-rolling InRelease [30.6 kB]
Error: 1 http://mirrors.ustc.edu.cn/kali kali-rolling
InRelease key, the following signatures could not be verified: NO_PUBKEY ED444FF07D8D0BF6
Ignored: 2 http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu xenial InRelease
Hit: 3 http://mirrors.tuna.tsinghua.edu.cn/ros/ ubuntu xenial Release
reading package list... done
N: ignoring 'ros-latest.list122' (in directory '/etc/apt/sources.list.d/') given its invalid file extension
W: GPG error : http://mirrors.ustc.edu.cn/kali kali-rolling InRelease: The following signature cannot be verified because there is no public key: NO_PUBKEY ED444FF07D8D0BF6
E: Warehouse "http://mirrors.ustc.edu.cn/kali kali- rolling InRelease" without a digital signature.
N: The source cannot be safely updated, so it is disabled by default.
N: See the apt-secure(8) manual for details on repository creation and user configuration.

As shown in the picture:
insert image description here
Solution:
1. Find the software and update
insert image description here
2. Remove the check mark in front of the wrong URL in "Other Software"
insert image description here
3. Save the settings, and then enter again

sudo apt update

or

sudo apt-get update

can be solved.

two,

Type in terminal:

sudo apt install ros-melodic-desktop-full

Error message:
[sudo] password for amanda:
Reading package list... Done
Analyzing package dependency tree
Reading status information... Done
N: Ignoring 'ros-latest.list122' (in directory '/etc/ apt/sources.list.d/'), given its file extension is invalid
E: Unable to locate package ros-melodic-desktop-full

As shown in the picture:
insert image description here

Solution:
The ubuntu version does not correspond to the ros version. I use Ubuntu16.04, and the corresponding version should be kinetic.
Change to:

sudo apt install ros-kinetic-desktop-full

In addition: Ubuntu18.04 corresponds to melodic
Ubuntu20.04 corresponds to Noetic

three,

Type in terminal:

source ~/.bashrc

Error message:
bash: /opt/ros/melodic/setup.bash: No such file or directory

As shown in the picture:
insert image description here
This error is so rampant that even if it is not executed, it will appear as long as the terminal is opened:
insert image description here

Reason:
Forgot to change the ros version when executing the command: echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

Solution:
1. Enter in the terminal:

gedit ~/.bashrc

2. Find /opt/ros/melodic/setup.bash in the error message in the opened file, delete this line, save and exit.
insert image description here

Execute the command again after changing the ros version:

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

The error disappears.

Four,

Type in terminal:

sudo rosdep init

错误提示:
Traceback (most recent call last):
File “/usr/bin/rosdep”, line 6, in
from pkg_resources import load_entry_point
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2927, in
@_call_aside
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2913, in _call_aside
f(*args, **kwargs)
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2940, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 637, in _build_master
return cls._build_from_requirements(requires)
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 650, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 829, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘rospkg>=1.3.0’ distribution was not found and is required by rosdep

As shown in the picture:
insert image description here

Solution:
1. Install pip first:

sudo apt-get install python-pip

2. Then use pip to install rosdep

sudo pip install rosdep

3. Initialize again:

sudo rosdep init

solve.
insert image description here

five,

Type in terminal:

 sudo rosdep init

错误提示:
ERROR: default sources list file already exists:
/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize

As shown in the picture:

insert image description here
Solution:
The extension is invalid, remove it

sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

Execute again:

sudo rosdep init

error disappears

This method also solves the error message:
N: Ignoring 'ros-latest.list122' (in directory '/etc/apt/sources.list.d/'), given its invalid file extension

six,

Type in terminal:

roscore

Red warning:
WARNING: ROS_MASTER_URI [http://192.168.43.157:11311] host is not set to this machine

As shown in the picture:
insert image description here

Solution: first press Ctrl+C to exit
1, enter in the terminal

ifconfig

2. Open the bashrc file

gedit ~/.bashrc   

3. Find ROS_MASTER_URI=http://192.168.*****:11311 and change it to your own address
insert image description here
4. Source the environment variable

source  ~/.bashrc    

5. Execute again

roscore

The red warning disappears.
insert image description here

A little thought : This is just a small part of a lot of pitfalls stepped on when installing ros. During the actual installation, I also encountered a series of other problems such as blocked overseas resources and unable to download. I almost started from getting started. to buried. But for most of the problems, there are very detailed solutions on the Internet. These are some of the problems I encountered that I still remember. for reference only!

Guess you like

Origin blog.csdn.net/weixin_43737995/article/details/122588455