ubuntu18/20安装ros

1.设置sources.list

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

    如果速度缓慢可替换为国内清华的源

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'

 2.设置秘钥

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3.更新可用软件包本地数据库

sudo apt update

4.安装完整版ros

ubuntu18

sudo apt install ros-melodic-desktop-full

ubuntu20

sudo apt install ros-noetic-desktop-full

5.将ROS 环境变量添加到bash

ubuntu18

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

ubuntu20

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

到这一步ros就已经安装与部署完毕

6.测试

roscore

 下面是启动roscore后的界面

xf@xf-Vostro-3670:~$ roscore
... logging to /home/xf/.ros/log/915b9a3c-7f5f-11ed-b7e8-8cec4bccf58d/roslaunch-xf-Vostro-3670-14818.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://xf-Vostro-3670:37697/
ros_comm version 1.14.13


SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.13

NODES

auto-starting new master
process[master]: started with pid [14828]
ROS_MASTER_URI=http://xf-Vostro-3670:11311/

setting /run_id to 915b9a3c-7f5f-11ed-b7e8-8cec4bccf58d
process[rosout-1]: started with pid [14839]
started core service [/rosout]

 下面对终端输出进行解读

... logging to /home/xf/.ros/log/915b9a3c-7f5f-11ed-b7e8-8cec4bccf58d/roslaunch-xf-Vostro-3670-14818.log
Checking log directory for disk usage. This may take a while.

 这部分指的是在/home/sasa/.ros/log 创建了一个日志(log)文件,包含从ros节点中收集到的日志,根据日志信息可以进行调试。

started roslaunch server http://xf-Vostro-3670:37697/
ros_comm version 1.14.13

这部分指,启动了一个叫roscore.xml的launch文件。当launch文件启动的,系统自动启动ros_master和ros_parameter参数服务器。且显示了端口的ROS参数服务器的地址和ros_comm版本(ros_comm是ROS中的一个metapackage,它主要包括了ROS通信相关(计算图尺度)的package,其中节点,主题,服务,参数)

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.13

 这部分指,ROS发行版本和rosvrsion。可以在roscore.xml文件中查看到这两个参数。这两个参数称为 rosversion 和 ros 发行版,使用命令标记存储 rosversion roslaunch 和rosversion -d 命令的输出,这是 ROS param 标记的一部分。命令标记将执行上面提到的命令,并将命令的输出存储在这两个参数中。

auto-starting new master
process[master]: started with pid [14828]
ROS_MASTER_URI=http://xf-Vostro-3670:11311/

这部分指启动了ros_master。并且,ros_master节点使用ROS_MASTER_URI的环境变量。这里解释一下URI(Uniform Resource Identifier,统一资源标识符)就是在IMS网络中IMS用户的“名字”,也就是IMS用户的身份标识。ROS_MASTER_URI 是一个 IP 地址和 rosmaster 将要监听的端口的组合。可以根据 roscore 命令中给定的端口号更改端口号。当需要使用远程调用的时候,需要在系统中修改地址位远程调用的地址。

setting /run_id to 915b9a3c-7f5f-11ed-b7e8-8cec4bccf58d
process[rosout-1]: started with pid [14839]
started core service [/rosout]

这部分表明rosout节点启动,开始订阅/rosout话题,并发布到/rosout_agg上。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值