﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-jack-wang-随笔分类-ROS</title><link>http://www.cppblog.com/jack-wang/category/21407.html</link><description>小王</description><language>zh-cn</language><lastBuildDate>Fri, 25 Feb 2022 00:28:55 GMT</lastBuildDate><pubDate>Fri, 25 Feb 2022 00:28:55 GMT</pubDate><ttl>60</ttl><item><title>Ubuntu16中安装ROS</title><link>http://www.cppblog.com/jack-wang/archive/2022/02/21/229207.html</link><dc:creator>小王</dc:creator><author>小王</author><pubDate>Sun, 20 Feb 2022 18:03:00 GMT</pubDate><guid>http://www.cppblog.com/jack-wang/archive/2022/02/21/229207.html</guid><wfw:comment>http://www.cppblog.com/jack-wang/comments/229207.html</wfw:comment><comments>http://www.cppblog.com/jack-wang/archive/2022/02/21/229207.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jack-wang/comments/commentRss/229207.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jack-wang/services/trackbacks/229207.html</trackback:ping><description><![CDATA[1、更换Ubuntu国内源<br /><div>cd /etc/apt/<br />备份sources.list</div><div>打开文件sources.list<br />vim&nbsp;sources.list<br /><br />将其中内容全部替换为以下内容（本次使用阿里源，之前使用清华源apt update报错过）：<br /><div>deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse</div><div>deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse</div><div>deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse</div><div>deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse</div><div>deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse</div><div>deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse</div><div>deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse</div><div>deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse</div><div>deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse</div><div>deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse<br /><br />保存退出<br /><br />apt update<br />下载更新成功！（上次使用清华源到这一步更新失败）<br /><br />2、替换ROS国内源<br /><div>sudo sh -c '. /etc/lsb-release &amp;&amp; echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" &gt; /etc/apt/sources.list.d/ros-latest.list'<br /><br />设置key<br /><div>sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654<br /><br />再次更新apt<br />apt update<br /><br />3、安装ROS<br /><div>sudo apt-get install ros-kinetic-desktop-full<br />安装成功！<br /><br />设置环境变量<br /><div>echo "source /opt/ros/kinetic/setup.bash" &gt;&gt; ~/.bashrc</div><div>source ~/.bashrc<br /><br /></div></div></div></div>4、初始化rosdep<br />rosdep init<br />失败！<br />报错信息如下：<br /><div>ERROR: cannot download default sources list from:</div><div>https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list</div><div>Website may be down.<br /><br /><br /><div>cd /etc</div><div>sudo mkdir ros</div><div>cd ros</div><div>sudo mkdir rosdep</div><div>cd rosdep</div><div>sudo mkdir source.list.d</div><div>cd source.list.d</div><div>sudo touch 20-default.list</div></div><br /><div>vim 20-default.list<br />粘贴如下内容：<br /><div>#os-specific listings first</div><div>yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx</div><div></div><div>#generic</div><div>yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml</div><div>yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml</div><div>yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml</div><div>gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte</div><div></div><div>#newer distributions (Groovy, Hydro, &#8230;) must not be listed anymore, they are being&nbsp;</div><div>#fetched from the rosdistro index.yaml instead<br /><br />保存退出<br /><div>rosdep update<br />更新成功！<br /><br />O了！<br />以前在Ubuntu18下面安装ROS很顺利啊，怎么在Ubuntu16下面安装就这么费劲呢，沃尼玛！</div></div></div><br /></div></div><img src ="http://www.cppblog.com/jack-wang/aggbug/229207.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jack-wang/" target="_blank">小王</a> 2022-02-21 02:03 <a href="http://www.cppblog.com/jack-wang/archive/2022/02/21/229207.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ROS开发环境配置</title><link>http://www.cppblog.com/jack-wang/archive/2020/07/07/217396.html</link><dc:creator>小王</dc:creator><author>小王</author><pubDate>Tue, 07 Jul 2020 07:42:00 GMT</pubDate><guid>http://www.cppblog.com/jack-wang/archive/2020/07/07/217396.html</guid><wfw:comment>http://www.cppblog.com/jack-wang/comments/217396.html</wfw:comment><comments>http://www.cppblog.com/jack-wang/archive/2020/07/07/217396.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jack-wang/comments/commentRss/217396.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jack-wang/services/trackbacks/217396.html</trackback:ping><description><![CDATA[<span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">1、创建并初始化工作目录<br /></span><span style="color: #4d4d4d; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">ROS使用一个名为catkin的ROS专用构建系统。为了使用它，用户需要创建并初始化</span><span style="color: #4d4d4d; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">catkin工作目录，如下所示。<br />除非用户创建新的工作目录，否则此设置只需设置一次。</span><br /><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">mkdir -p ~</span><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; color: #50a14f; overflow-wrap: break-word; white-space: pre; background-color: #fafafa;">/catkin_ws/</span><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">src</span><br /><span style="background-color: #fafafa;"><font color="#383a42" face="Source Code Pro, DejaVu Sans Mono, Ubuntu Mono, Anonymous Pro, Droid Sans Mono, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, PingFang SC, Microsoft YaHei, sans-serif"><span style="white-space: pre;"><div style="display: inline-block;"></div></span></font></span><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">cd ~</span><span class="hljs-regexp" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; color: #50a14f; overflow-wrap: break-word; white-space: pre; background-color: #fafafa;">/catkin_ws/</span><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">src</span><br /><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">catkin_init_workspace</span><br /><span style="background-color: #fafafa;"><font color="#383a42" face="Source Code Pro, DejaVu Sans Mono, Ubuntu Mono, Anonymous Pro, Droid Sans Mono, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, PingFang SC, Microsoft YaHei, sans-serif"><span style="white-space: pre;">在src目录中生成了</span></font></span><span style="color: #4d4d4d; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; background-color: #ffffff;">CMakeLists.txt文件<br /><br /><div style="display: inline-block;"></div></span><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">cd ~</span><span class="hljs-regexp" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; color: #50a14f; overflow-wrap: break-word; white-space: pre; background-color: #fafafa;">/catkin_ws/</span><br /><span style="color: #383a42;">catkin_make</span><br /><span style="background-color: #fafafa;"><font color="#383a42" face="Source Code Pro, DejaVu Sans Mono, Ubuntu Mono, Anonymous Pro, Droid Sans Mono, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, PingFang SC, Microsoft YaHei, sans-serif"><span style="white-space: pre;"><br />2、设置环境变量<br />~/.bashrc</span></font><br /><font color="#383a42" face="Source Code Pro, DejaVu Sans Mono, Ubuntu Mono, Anonymous Pro, Droid Sans Mono, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, PingFang SC, Microsoft YaHei, sans-serif"><span style="white-space: pre;">末尾添加：</span></font><br /></span># Set ROS melodic<br />source /opt/ros/melodic/setup.bash<br />source ~/catkin_ws/devel/setup.bash<br />生效<br />source .bashrc<br /><br /> # Set ROS Network<br />#ifconfig查看你的电脑ip地址，比如192.168.1.154<br /><span style="color: #4d4d4d; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-size: 16px; font-variant-ligatures: no-common-ligatures; background-color: #ffffff;">vim ~/.bashrc<br /></span>在末尾添加：<br />export ROS_HOSTNAME=192.168.1.154<br />export ROS_MASTER_URI=http://${ROS_HOSTNAME}:11311<br />生效<br />source .bashrc<br /><br /> # Set ROS alias command 快捷指令<br />alias cw='cd ~/catkin_ws'<br />alias cs='cd ~/catkin_ws/src'<br />alias cm='cd ~/catkin_ws &amp;&amp; catkin_make'<br /><br />3、运行测试程序<br />启动一个终端，运行：<br /><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">roscore<br />再启动一个终端，运行：</span><br /><div><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">rosrun turtlesim turtlesim_node<br />再启动一个终端，运行：<br /></span><span style="color: #383a42; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre; background-color: #fafafa;">rosrun turtlesim turtle_teleop_key</span></div><img src ="http://www.cppblog.com/jack-wang/aggbug/217396.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jack-wang/" target="_blank">小王</a> 2020-07-07 15:42 <a href="http://www.cppblog.com/jack-wang/archive/2020/07/07/217396.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ROS指令集</title><link>http://www.cppblog.com/jack-wang/archive/2020/07/06/217395.html</link><dc:creator>小王</dc:creator><author>小王</author><pubDate>Mon, 06 Jul 2020 02:58:00 GMT</pubDate><guid>http://www.cppblog.com/jack-wang/archive/2020/07/06/217395.html</guid><wfw:comment>http://www.cppblog.com/jack-wang/comments/217395.html</wfw:comment><comments>http://www.cppblog.com/jack-wang/archive/2020/07/06/217395.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jack-wang/comments/commentRss/217395.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jack-wang/services/trackbacks/217395.html</trackback:ping><description><![CDATA[无情地盗链：https://www.cnblogs.com/liu-fa/p/5761448.html&nbsp;<br /><br /><br /><h2><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">创建 ROS 工作空间</span></h2><h4><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">启动 ROS</span></h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;"><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;; line-height: 1.5 !important;">$ roscore</span></pre></div><h4><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">创建工作环境</span></h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;"><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;; line-height: 1.5 !important;">$ <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">mkdir</span> -p ~/catkin_ws/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">src $ cd </span>~/catkin_ws/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">src $ <strong style="margin: 0px; padding: 0px;">catkin_init_workspace</strong></span></span></pre></div><h4><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">编译 ROS 程序</span></h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;"><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;; line-height: 1.5 !important;">$ cd ~/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">catkin_ws $ catkin_make</span></span></pre></div><h4><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">添加程序包到全局路径</span></h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;"><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;; line-height: 1.5 !important;">$ <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">echo</span> <span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">"</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">source catkin_ws/devel/setup.bash</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">"</span> &gt;&gt; ~/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">.bashrc $ source </span>~/.bashrc</span></pre></div><h2><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">Package 相关操作</span></h2><h4><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">创建 Package 并编译</span></h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;"><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;; line-height: 1.5 !important;">$ cd ~/catkin_ws/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">src $ <strong style="margin: 0px; padding: 0px;">catkin_create_pkg </strong></span><strong style="margin: 0px; padding: 0px;">&lt;package_name&gt;</strong><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"><strong style="margin: 0px; padding: 0px;"> [depend1] [depend2] [depend3]</strong> $ cd </span>~/<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">catkin_ws $ catkin_make</span></span></pre></div><h4><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">查找 Package</span></h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;"><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;; line-height: 1.5 !important;">$ rospack <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">find</span> [package name]</span></pre></div><h4><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">查看 Package 依赖<br style="margin: 0px; padding: 0px;" /></span></h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rospack depends &lt;package_name&gt;<span style="margin: 0px; padding: 0px; line-height: 1.5 !important;"> $ rospack depends1 </span>&lt;package_name&gt;</pre></div><h2><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">Node 相关操作</span></h2><h4><span style="margin: 0px; padding: 0px; font-family: &quot;Microsoft YaHei&quot;;">查看所有正在运行的 Node</span></h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosnode list</pre></div><h4>查看某节点信息</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosnode <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">info</span> [node_name]</pre></div><h4>运行 Node</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosrun [package_name] [node_name] [__name:=new_name]</pre></div><h2>Topic 相关操作</h2><h4>查看 rostopic 所有操作</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rostopic -h</pre></div><h4>查看所有 Topic 列表</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rostopic list</pre></div><h4>图形化显示 topic</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosrun rqt_graph rqt_graph<br style="margin: 0px; padding: 0px;" />$ rosrun rqt_plot rqt_plot</pre></div><h4>查看某个 Topic 信息</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rostopic <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">echo</span> [topic]</pre></div><h4>查看 Topic 消息格式</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;"><span style="margin: 0px; padding: 0px; line-height: 1.5 !important;">$ rostopic type [topic] $ rosmsg show [msg_type]</span></pre></div><h4>向topic发布消息</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rostopic pub [-<span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">1</span>] &lt;topic&gt; &lt;msg_type&gt; [-r <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">1</span>] -- [args] [args]</pre></div><h2>Service 相关操作</h2><h4>查看所以service操作</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosservice -h</pre></div><h4>查看 service 列表</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosservice list</pre></div><h4>调用 service</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosservice call [service] [args]</pre></div><h4>查看 service 格式并显示数据</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosservice type [service] | rossrv show</pre></div><h4>设置service parameter</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosparam set [parame_name] [args] + rosservice call <span style="margin: 0px; padding: 0px; color: #0000ff; line-height: 1.5 !important;">clear</span></pre></div><h4>获得parameter</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosparam get [parame_name]</pre></div><h4>加载parameter</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosparam load [file_name] [namespace]</pre></div><h4>删除parameter</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosparam delete</pre></div><h2>Bag 相关操作</h2><h4>录制所有topic变化</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosbag record -a</pre></div><h4>记录某些topic</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosbag record -O subset &lt;topic1&gt; &lt;topic2&gt;</pre></div><h4>查看bag信息</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosbag info &lt;bagfile_name&gt;</pre></div><h4>回放</h4><div style="margin: 5px 0px; font-size: 12px !important;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Courier New&quot; !important;">$ rosbag play (-r <span style="margin: 0px; padding: 0px; color: #800080; line-height: 1.5 !important;">2</span>) &lt;bagfile_name&gt;</pre></div><img src ="http://www.cppblog.com/jack-wang/aggbug/217395.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jack-wang/" target="_blank">小王</a> 2020-07-06 10:58 <a href="http://www.cppblog.com/jack-wang/archive/2020/07/06/217395.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>安装ROS</title><link>http://www.cppblog.com/jack-wang/archive/2020/07/06/217393.html</link><dc:creator>小王</dc:creator><author>小王</author><pubDate>Sun, 05 Jul 2020 20:28:00 GMT</pubDate><guid>http://www.cppblog.com/jack-wang/archive/2020/07/06/217393.html</guid><wfw:comment>http://www.cppblog.com/jack-wang/comments/217393.html</wfw:comment><comments>http://www.cppblog.com/jack-wang/archive/2020/07/06/217393.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jack-wang/comments/commentRss/217393.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jack-wang/services/trackbacks/217393.html</trackback:ping><description><![CDATA[1、使用Ubuntu18.04
<br />2、配置数据源
<br />sudo sh -c '. /etc/lsb-release &amp;&amp; echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" &gt; /etc/apt/sources.list.d/ros-latest.list'
<br />3、设置秘钥（最新！）
<br />sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
<br />网上其他的秘钥都特么不好使啊！坑你爹啊！
<br />4、安装
<br />sudo apt-get update
<br />sudo apt-get install ros-melodic-desktop-full<br />sudo apt-get install ros-melodic-rqt*
<br />5、初始化
<br />sudo rosdep init
<br />报错：
<br />sudo: rosdep: command not found
<br />安装rosdep：
<br />sudo apt install python-rosdep
<br />再次初始化
sudo rosdep init
<br />输出提示：
<br />please run
rosdep update
<br />说明rosedep初始化成功，然后执行rosdep的更新命令：
<br />rosdep update
<br />如果更新失败的话就多重试几次。
<br />更新成功后，安装：
<br />sudo apt-get install python-rosinstall
<br /><span style="background-color: #808080;">6、配置环境变量（不可或缺）
</span><br /><span style="background-color: #808080;">echo "source /opt/ros/melodic/setup.bash" &gt;&gt; ~/.bashrc
</span><br /><span style="background-color: #808080;">source ~/.bashrc </span><br />
7、重启
<br />roscore
<br />输出：
<br />started core service [/rosout]<br /><br /> 

O了！<img src ="http://www.cppblog.com/jack-wang/aggbug/217393.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jack-wang/" target="_blank">小王</a> 2020-07-06 04:28 <a href="http://www.cppblog.com/jack-wang/archive/2020/07/06/217393.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>