1. 安装ROS

git clone https://github.com/jetsonhacks/installROSXavier.git
cd installROSXavier
./installROSXavier 
./installROS.sh -p ros-melodic-desktop -p ros-melodic-rgbd-launch

这一步要等的时间还挺长。

./setupCatkinWorkspace.sh [optionalWorkspaceName]

[optionalWorkspaceName]是自己设置的文件夹名,运行完成后会生成该文件夹,如果省略,默认的文件夹名是catkin_ws。

2. 初始化

sudo rosdep init

会报错:ERROR: cannot download default sources list from:https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.listWebsite may be down.

这是因为该网址被墙,无法访问。解决办法是让该网址可以访问。该网址被墙的原因是dns污染,将下面的内容添加到/etc/hosts中。

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 raw.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

# Amazon AWS Start
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

再次执行初始化命令,可能会失败,多试几次。

3. 检验是否成功

roscore
 
#然后打开新终端
rosrun turtlesim turtlesim_node #会出现下面的窗口
#再打开新终端
rosrun turtlesim turtle_teleop_key #在该终端中用方向键控制

 

roscore

rosrun rviz rviz #显示下面的窗口

版权声明:本文为gloria-zhang原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/gloria-zhang/p/13825287.html