工控机启动盘安装ubuntu18.04+ros环境步骤
准备:一个ubuntu启动盘(装好Gparted, systemback)。
一、ubuntu安装
- 工控机接好电源,连好显示器(2条)和鼠标,插好启动盘
- 从U盘进入系统:开机瞬间多次按F11(有的是F8、F10、F12、DEL等)进入Boot模式。我这里选择第二个SANSUNG Drive 1100,然后选择第一个ubuntu选项,进入桌面。
- 进入桌面后,进入Gparted,为磁盘分区,示例如下:
- 进入systemback,选择系统安装,填写内容,挂载相应分区,示例如下:
- 安装系统完成后,重启ubuntu。
二、ros环境配置
这里参考blog:
Ubuntu18.04安装Ros(最新最详细亲测)_向日葵骑士Faraday的博客-CSDN博客
1.检查Unbuntu的软件和更新源
2.设置Ros的下载源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ `lsb_release -cs` 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
3.安装ROS
sudo apt install ros-melodic-desktop-full
4.设置环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
5.下载其他功能组件
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
6.rosdep init 初始化
sudo rosdep init
出错如下设置:
sudo gedit /etc/hosts
粘贴进去:
199.232.28.133 raw.githubusercontent.com
192.30.253.118 gist.github.com
185.199.110.153 github.io
151.101.113.194 github.global.ssl.fastly.net
52.216.227.168 github-cloud.s3.amazonaws.com
52.74.223.119 github.com
199.232.28.133 avatars1.githubusercontent.com
199.232.28.133 avatars2.githubusercontent.com
199.232.28.133 avatars0.githubusercontent.com
199.232.28.133 avatars3.githubusercontent.com
199.232.28.133 user-images.githubusercontent.com
199.232.28.133 avatars.githubusercontent.com
199.232.28.133 github.map.fastly.net
199.232.28.133 avatars7.githubusercontent.com
54.239.31.69 aws.amazon.com
54.239.30.25 console.aws.amazon.com
54.239.96.90 ap-northeast-1.console.aws.amazon.com
54.240.226.81 ap-southeast-1.console.aws.amazon.com
54.240.193.125 ap-southeast-2.console.aws.amazon.com
54.239.54.102 eu-central-1.console.aws.amazon.com
177.72.244.194 sa-east-1.console.aws.amazon.com
176.32.114.59 eu-west-1.console.aws.amazon.com
54.239.31.128 us-west-1.console.aws.amazon.com
54.240.254.230 us-west-2.console.aws.amazon.com
54.239.38.102 s3-console-us-standard.console.aws.amazon.com
54.231.49.3 s3.amazonaws.com
52.219.0.4 s3-ap-northeast-1.amazonaws.com
54.231.242.170 s3-ap-southeast-1.amazonaws.com
54.231.251.21 s3-ap-southeast-2.amazonaws.com
54.231.193.37 s3-eu-central-1.amazonaws.com
52.218.16.140 s3-eu-west-1.amazonaws.com
52.92.72.2 s3-sa-east-1.amazonaws.com
54.231.236.6 s3-us-west-1.amazonaws.com
54.231.168.160 s3-us-west-2.amazonaws.com
52.216.80.48 github-cloud.s3.amazonaws.com
54.231.40.3 github-com.s3.amazonaws.com
52.216.20.171 github-production-release-asset-2e65be.s3.amazonaws.com
52.216.228.168 github-production-user-asset-6210df.s3.amazonaws.com
然后,
sudo gedit /etc/resolv.conf
将原有的nameserver那一行注释,并添加以下两行后保存:
nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器
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
这说明20-default.list 这个文件已经存在
解决办法:删除20-default.list这个文件。
1.终端输入以下命令并回车删除文件:
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list,
2.再次执行:sudo rosdep init
显示如下信息,则rosdep初始化成功
wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run
rosdep update
7.rosdep update 更新(手机开热点很有效,值得一试)
rosdep update
多次执行试试,不然用rosdepc也可。
成功安装ros
8.检查安装情况:运行小海龟和rviz
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
rosrun rviz rviz
最后,配置工控机的ip地址,以可远程连接。