制作ubuntu16.04的live cd的方法找了一圈,能试的都试了,都不行或者不好用,最后选择了Cubic (Custom Ubuntu ISO Creator)
1.安装 Cubic
sudo apt-add-repository ppa:cubic-wizard/release
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6494C6D6997C215E
sudo apt update
sudo apt install cubic
装就是了
2. 启动 Cubic
选择自己要保存的路径,然后记得硬盘空间得够,省的最后失败了,可惜
这个地方是选择一个官方得镜像,自己去下载传送门
基本上不用改,直接下一步就是了
然后就进入 You are in the chroot environment. 这个环境默认就试root用户,因为对于一个镜像来说,这个时候试没有用户得,只有root,东西都在这里面安装
3. 安装ros
参看官网wiki, [传送门]
装vim
修改源到国内,一会安装会快一点
vim /etc/apt/source.list
放清华的源
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
更新下
apt update; apt upgrade
添加ros源,清华大华的镜像
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` 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
更新一下
apt update
有个warning, 不能忍,干掉
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key F42ED6FBAB17C654
干干净净,舒畅
安装桌面完整版: (推荐) : 包含ROS、rqt、rviz、机器人通用库、2D/3D 模拟器、导航以及2D/3D感知,一会会就好
apt-get install ros-kinetic-desktop-full -y
初始化 rosdep
在开始使用ROS之前你还需要初始化rosdep。rosdep可以方便在你需要编译某些源码的时候为其安装一些系统依赖,同时也是某些ROS核心功能组件所必需用到的工具。
rosdep init
rosdep update
这个是网络的原因,多搞几次就行,成功为止
环境配置
如果每次打开一个新的终端时ROS环境变量都能够自动配置好(即添加到bash会话中),那将会方便很多:
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
这个其实是写道root 用户的bashrc里,打包前我们需要在操作一次
构建工厂依赖
到目前为止,你已经安装了运行核心ROS包所需的内容。为了创建和管理自己的ROS工作区,有各种各样的工具和需求分别分布。例如:rosinstall是一个经常使用的命令行工具,它使你能够轻松地从一个命令下载许多ROS包的源树。
要安装这个工具和其他构建ROS包的依赖项,请运行:
apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
检查下,装好了
4.装Cartographer
参考官方文档,快的很传送门
写的挺好的,有些地方稍微改一下就好了,我直接复制英文,我就不翻译了
In order to build Cartographer ROS, we recommend using wstool and rosdep. For faster builds, we also recommend using Ninja.
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
Create a new cartographer_ros workspace in ‘catkin_ws’.
我这个是做live cd 所以直接装在/opt/下面,取名就叫 cart_ws 吧,正好ros也在这下面,一家人
cd /opt/
mkdir cart_ws
cd cart_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
这个地方改个地址,不然会失败的,科学上网行不行我不知道,穷
vim src/.rosinstall
改成这个 https://github.com/ceres-solver/ceres-solver.git
wstool update -t src
如果你的网速不想我这样快,甚至只有几k,预计几天,参考我的这篇博客里面的git clone 慢https://blog.csdn.net/weixin_36628778/article/details/96212190
Install cartographer_ros’ dependencies (proto3 and deb packages). The command ‘sudo rosdep init’ will print an error if you have already executed it since installing ROS. This error can be ignored.
src/cartographer/scripts/install_proto3.sh
#sudo rosdep init 这注释掉的之前装ros玩过了,这地方省略吧,省的老是失败
#rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
Build and install.
catkin_make_isolated --install --use-ninja
装完之后检查下
5.配置用户的bashrc
找一下在哪,上面那个是roo的,下面的那个就是用户的,盘他
放在最后面
6.装点喜欢的软件
ide 啥的就不装了,省的太大了,不好
7.打包
点击next
选择删除的包,一般就默认的就行,自己有把握在删除,别搞出依赖问题,可就不好了
内核选择,因为我把系统升级了,所以用最新的内核
这个很有用,可以配置好多默认参数啥的,这边不动他了,传送门,里面大把的例子
boot 配置,想改的话,得多学习学习,慎重,下面那4个就是每次安装开机都会出来得选项
点击 generate 慢慢等生成吧,挺长时间得, 完成后点fnish,再 close,在自己之前选择的工程路径下,就会有个iso文件,就是他了
8.安装测试
我用的虚拟机安装测试,过程省略,不知道自行百度
配置都在
roscore能启动
cartographer也在
打完收工