ROS学习

安装

sudo rosdep init出错

学习这位仁兄的方法
解决方案:终极解决方案来啦!!!
首先要感谢 weixin_42817528,是他的留言让这个在我心中一直悬而未决的问题终于有了近完美的解答!然后,就是要感谢蓝鲸ROS机器人论坛的网友xiaoqiang。

为了方便大家,现将解决方案移于此。

打开hosts文件

sudo gedit /etc/hosts

在文件末尾添加

151.101.84.133 raw.githubusercontent.com

保存后退出再尝试

ROS中rosrun与roslaunch的区别

官网解释
rosrun allows you to run an executable in an arbitrary package without having to cd (or roscd) there first.
roslaunch is a tool for easily launching multiple ROS nodes locally and remotely via SSH, as well as setting parameters on the Parameter Server. It includes options to automatically respawn processes that have already died. roslaunch takes in one or more XML configuration files (with the .launch extension) that specify the parameters to set and nodes to launch, as well as the machines that they should be run on.
翻译成中文就是:
rosrun 允许您在任意软件包中运行可执行文件,而无需先在其中进行cd(或roscd)。
roslaunch 是一种工具,可通过SSH在本地和远程轻松启动多个ROS节点,以及在参数服务器上设置参数。 它包括自动重生已经死掉的进程的选项。 roslaunch接收一个或多个XML配置文件(带有.launch扩展名),这些文件指定要设置的参数和要启动的节点以及应在其上运行的计算机。
可以看出:rosrun只能运行一个nodes, roslaunch可以同时运行多个nodes.

roslaunch可以用来启动定义在launch文件中的多个节点,通常的命名方案是以.launch作为启动文件的后缀,启动文件是xml文件,一般把启动文件存储在取名为launch的目录中,用法

$ roslaunch [package] [filename.launch]

可以看出:rosrun是运行一个单独节点的命令,如果要运行多个节点,则需要使用多次rosrun命令,roslaunch采用xml的格式对需要运行的节点进行描述,可以同时运行多个节点,例如

<launch>
  <node name="listener" pkg="rospy_tutorials" type="listener.py" output="screen"/>
  <node name="publish_on_shutdown" pkg="rospy_tutorials" type="publish_on_shutdown.py" output="screen"/>
</launch>

可以同时运行listener和publish_on_shutdown两个节点。

ROS显示图片

步骤一:回放bag包:

rosbag play ***.bag

可以加入-l参数,使之循环播放,这个时候正在以一定的帧率播放话题

步骤2:开启rqt_image_view (通过 sudo apt-get install ros-kinetic-rqt*安装)

rosrun rqt_iamge_view rqt_iamge_view

ROS查看话题列表

rostopic list
posted @ 2020-03-31 16:24  少年笔谈  阅读(208)  评论(0编辑  收藏  举报