Ultra96_v2——ROS安装

因为U96采用的是Ubuntu18,因此这里注意ROS kinetic版本是不支持直接安装的。所以这里选择支持Ubuntu18的ROS Melodic版本。刚开始直接使用官方给出的源,一直显示IP not found的问题,于是按照这个网站的源进行操作

https://www.antongvozdev.com/portfolio/ros-installation/

首先terminal(用jupyter 或者x-shell打开都可)输入

export ROS_OS_OVERRIDE=ubuntu:bionic

接着输入,和官方给出的源相比用 bionic 替换了$(lsb_release -sc)

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic 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

安装(注意这里是ROS Melodic),比较耗时,我用了一个多小时

sudo apt install ros-melodic-desktop-full

初始化rosdep(此步骤可能会遇到问题参考https://www.jianshu.com/p/bdbfbac69114 )

sudo rosdep init
rosdep update

设置环境变量(加入bashrc文件,使得所有的terminal都生效)

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

安装rosinsatall

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

安装完成

注:我在初始化rosdep步骤,产生的问题为

sudo rosdep init
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

解决方法为打开该网站,其为文本内容

# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

将该文本复制到 /etc/ros/rosdep/sources.list.d/20-default.list文本文件中,若rosdep update报错,执行

sudo apt-get update
sudo apt-get install python-rosdep

还不清楚为什么只安装python-rosdep,后续会测试一下能不能编译c++包

ROS使用常见问题

安装后,按照ros wiki的教程创建工作空间和功能报即可。过程中遇到的一些问题在这里总结

1.创建功能包后,如何把win10中编辑的源文件(.py/.cpp)拷入功能包中?

答:可通过直接访问windows 资源管理器按照上面提出的方法,访问

\\192.168.3.1\xilinx

即可,但是会发现文件夹为只读,不能直接拷入,使用以下命令修改文件夹权限

chmod -R 777 catkin_ws #改变该工作空间的权限

2.运行功能包时出现:/usr/bin/env: ‘python\r’: No such file or directory问题?

这是由于window和linux的编码方式引起的,这里采用一个dos2unix包的小工具修改文件编码即可。

参考: https://blog.csdn.net/NiYintang/article/details/86124338

sudo apt-get install dos2unix
dos2unix 

桌面环境安装

在jupyter的terminal中打开时,发现有vncserver时提示如下错误

vncserver: The HOME environment variable is not set.

于是用x-shell连接,发现能够使用了

http://www.scutmath.com/ubuntu_vnc.html

按照这个教程,安装到最后,桌面访问一直是灰色的,搞不清什么原因


试了gnome 和xfce,改了好多次xstartup文件(可通过win10资源管理器直接打开.vnc文件夹修改),一直未能成功,后面有时间再接着研究

你可能感兴趣的:(机器人ROBOT,嵌入式)