ROS系列——Ubuntu18.04下ros Melodic安装mavros过程中遇到问题及解决-定期更新版
问题
问题一:运行 wstool update -t src -j8 时,出错如下:
问题二:运行 rosdep install –from-paths src –ignore-src -y 时,出错如下:
问题三:运行 rosinstall_generator –rosdistro melodic mavlink | tee /tmp/mavros.rosinstall 时,出错如下:
rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall
Traceback (most recent call last):
File "/usr/bin/rosinstall_generator", line 11, in <module>
load_entry_point('rosinstall-generator==0.1.22', 'console_scripts', 'rosinstall_generator')()
File "/usr/lib/python2.7/dist-packages/rosinstall_generator/cli.py", line 163, in main
upstream_version_tag=args.upstream, upstream_source_version=args.upstream_development)
File "/usr/lib/python2.7/dist-packages/rosinstall_generator/generator.py", line 267, in generate_rosinstall
wet_package_names, unreleased_repo_names = _get_packages_for_repos(distro_name, repo_names, source=upstream_source_version)
File "/usr/lib/python2.7/dist-packages/rosinstall_generator/generator.py", line 93, in _get_packages_for_repos
wet_distro = get_wet_distro(distro_name)
File "/usr/lib/python2.7/dist-packages/rosinstall_generator/generator.py", line 224, in get_wet_distro
_wet_distro = _get_wet_distro(distro_name)
File "/usr/lib/python2.7/dist-packages/rosinstall_generator/distro.py", line 45, in get_distro
index = get_index(get_index_url())
File "/usr/lib/python2.7/dist-packages/rosdistro/__init__.py", line 104, in get_index
yaml_str = load_url(url)
File "/usr/lib/python2.7/dist-packages/rosdistro/loader.py", line 59, in load_url
raise URLError(str(e) + ' (%s)' % url)
urllib2.URLError: <urlopen error <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>
问题四:运行 catkin build时,出错如下:
/my_mavros_ws/src/mavros/mavros/src/plugins/sys_status.cpp:265:65: error: ‘PROPULSION’ is not a member of ‘STS {aka mavlink::common::MAV_SYS_STATUS_SENSOR}’
if (last_st.onboard_control_sensors_enabled & enum_value(STS::PROPULSION))
^~~~~~~~~~
/home/nuc/my_mavros_ws/src/mavros/mavros/src/plugins/sys_status.cpp:266:121: error: ‘PROPULSION’ is not a member of ‘STS {aka mavlink::common::MAV_SYS_STATUS_SENSOR}’
stat.add("propulsion (actuator, esc, motor or propellor)", (last_st.onboard_control_sensors_health & enum_value(STS::PROPULSION)) ? "Ok" : "Fail");
^~~~~~~~~~
make[2]: *** [CMakeFiles/mavros_plugins.dir/src/plugins/sys_status.cpp.o] Error 1
make[1]: *** [CMakeFiles/mavros_plugins.dir/all] Error 2
make: *** [all] Error 2
cd /home/my_mavros_ws/build/mavros; catkin build --get-env mavros | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -
...............................................................................
Failed << mavros:make [ Exited with code 2 ]
Failed <<< mavros [ 5.1 seconds ]
Abandoned <<< mavros_extras [ Unrelated job failed ]
Abandoned <<< test_mavros [ Unrelated job failed ]
[build] Summary: 2 of 5 packages succeeded.
[build] Ignored: None.
[build] Warnings: None.
[build] Abandoned: 2 packages were abandoned.
[build] Failed: 1 packages failed.
[build] Runtime: 6.3 seconds total.
解决
问题一:
手动下载源码包,将其放到 my_mavros_ws/src,源码包下载
问题二:
执行sudo apt-get update 后,再执行步骤一次该命令;
如果还未解决,并且出现类似错误:
E: Unable to locate package ros-melodic-mavlink
则:
终端输入:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
备注:出现Unable to locate package ros-melodic-***时,已可以通过以上方式解决
问题三:
原因是:查看File “/usr/lib/python2.7/dist-packages/rosdistro/init.py”, line 104, in get_index
yaml_str = load_url(url) 和 File “/usr/lib/python2.7/dist-packages/rosdistro/loader.py”, line 59, in load_url
raise URLError(str(e) + ’ (%s)’ % url),里面需要链接到https://raw.githubusercontent.com这个网址,可能是网络问题,链接失败,所以作如下修改:
1)终端输入:
sudo gedit /etc/hosts
2)打开文件后,末尾输入如下内容:
199.232.68.133 raw.githubusercontent.com
3)保存,退出,重新执行出错的命令
rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall
问题四:
重新执行了wstool update -t src -j4命令,通过该命令下载下了mavros和mavlink功能包,然后安装就正常了。
通过命令下载的mavros和mavlink功能包链接
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/130112.html