First: multiple ROS system transplant (including Ubuntu, ROS installation) - Kinetic

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_44584064/article/details/102462090

Step 1: Install UBUNTU16.04 LTS

Because ROS is most adapted version of ubuntu 16.04 version, so it is best to install minor version of the system (section 18.04 is not compatible update is not recommended), a virtual machine or U disk to install dual system will do (if a lot smoother stand-alone system), the following is a reference link to the installation of:

VM: VM virtual machine installed Ubuntu16.04
U disk to install: do a system installation package with a blank U disk
Note: if U disk boot disk to finish the installation of a given button What (F2 or F11 at boot time, I F2) to enter the BIOS and the USB HDD + boot priority mentioned first (boot time so you can start directly with the U disk). Other follow tutorials doin 'it.

Step Two: Start Ubuntu, and replace the initial configuration good domestic source software

After starting the Ubuntu system, the first thing is to set a good password for root (the future will be used on)
. sudo passwd root
After some permission settings, the installation package may need root privileges, prepared in advance

After the software is to replace the source, I use here is the Tsinghua source, if not obsolete and must be in need of replacement from the official website

sudo gedit /etc/apt/sources.list

After opening the file which put the source, all the contents inside Empty Drop and paste this content

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

Once he had finished saving exit, exit in the implementation of source code that refreshes

source /etc/apt/sources.list

Wave of software update source, then the next ROS installation environment configuration ~

#更新源
sudo apt-get update 
#更新软件
sudo apt-get upgrade 

The third step: ROS installation

This mainly refers to the content ROSWiki inside, I'm here to be here a simplified version of
ROSWiki: http: //wiki.ros.org/cn
this premise is you have to start with Ubuntu and update the software in the first full-page basic check the, like (links that do not change, only the check on the line)
Here Insert Picture Description
after reference to the following codes ROS system to install

#首先设置你的电脑可以从 packages.ros.org 接收软件.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
#添加ROS的镜像源,也是清华的
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'
#添加Keys
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
#接下来就是安装了(有三种可以选择,按照需求选择性安装,需要等待一定的时间)
	#桌面完整版: (推荐) : 包含ROS、rqt、rviz、机器人通用库、2D/3D 模拟器、导航以及2D/3D感知
	sudo apt-get install ros-kinetic-desktop-full
	
	#桌面版安装: 包含ROS、rqt、rviz以及通用机器人函数库。
	sudo apt-get install ros-kinetic-desktop
	
	#基础版安装: (简版) 包含ROS核心软件包、构建工具以及通信相关的程序库,无GUI工具。
	sudo apt-get install ros-kinetic-ros-base
#安装完后初始化 rosdep,rosdep的作用是能安装相关的依赖
sudo rosdep init
rosdep update
#环境配置
#如果每次打开一个新的终端时ROS环境变量都能够自动配置好(即添加到bash会话中),那将会方便很多:
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
#构建工厂依赖
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

So basically installed the ROS,

Step four: catkin_ws workspace, transplant src code package

General ros transplant transplant it is mainly the work area inside the src folder, placed inside packages can achieve a variety of functions, the main purpose of ROS transplantation is to transplant in the file src and compile into success.
First, create a workspace and compile it again.

mkdir -p ~/catkin_ws/src
cd catkin_ws
catkin_make

After the src folder you want to put all the coverage in addition to CMakeFile.list go, give permission to the workspace

chmod 777 -R catkin_ws
cd catkin_ws
rosdep install --form-paths src -i -y  #这个是自动安装依赖的,但我用这个老出BUG,图个乐就算了
catkin_make -j1  #单线程编程,虽然很慢但是好像会少出点BUG

After this folder inside crazy catkin_make, because it will last error, we want to solve problems one by one, the most important thing is their dependence, my example here being no shots, you will be prompted every reason being given, mostly lack of relevant dependencies, use the following instruction completion TAB mounting one got

sudo apt-get install ros-kinetic-XX  #后续加上你要的包的部分名字,打了一部分就用TAB补全,按两下TAB能显示全部

The following is my side of the car need to use dependencies, you can refer to

sudo apt-get update
ver=$(rosversion -d)
sudo apt-get install -y libusb-dev libspnav-dev  libbluetooth-dev libcwiid-dev
sudo apt-get install -y git vim
sudo pip install pybluez
sudo apt-get install -y libv4l-dev 
sudo apt-get install -y build-essential
sudo apt-get install -y chrony
sudo apt-get install -y libbullet-dev 
sudo apt-get install -y libudev-dev
sudo apt-get install -y libusb-dev
sudo apt-get install -y mini-httpd
sudo apt-get install -y ros-$ver\-roslint
sudo apt-get install -y ros-$ver\-rosserial
sudo apt-get install -y ros-$ver\-gmapping
sudo apt-get install -y ros-$ver\-navigation
sudo apt-get install -y ros-$ver\-map-server
sudo apt-get install -y ros-$ver\-rgbd-launch
sudo apt-get install -y ros-$ver\-costmap-2d
sudo apt-get install -y ros-$ver\-camera-info-manager
sudo apt-get install -y ros-$ver\-image-transport
sudo apt-get install -y ros-$ver\-teleop-twist-keyboard 
sudo apt-get install -y ros-$ver\-robot-upstart
sudo apt-get install -y ros-$ver\-slam-karto
sudo apt-get install -y ros-$ver\-geographic-msgs 
sudo apt-get install -y ros-$ver\-rosbridge-suite
sudo apt-get install -y ros-$ver\-robot-pose-publisher
sudo apt-get install -y ros-$ver\-tf2-web-republisher
sudo apt-get install -y ros-$ver\-web-video-server


echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

sudo usermod -aG dialout $USER

Has been make in the end, can you explain to a 100% successful transplant, it can be used.

Precautions

1. Sometimes the error display can be removed through the inside of the first package compiled once again moved back (sometimes caused the wrong order of compilation will appear)
2. Follow-up may require additional packages or add a rule files, which according to their needs installation (sh script file to provide some direct one-click install)

Guess you like

Origin blog.csdn.net/weixin_44584064/article/details/102462090