您当前的位置: 首页 >  机器人

鱼香ROS

暂无认证

  • 0浏览

    0关注

    498博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

小鱼:移动机器人建图导航仿真做完了,如何移植到真实机器人上?

鱼香ROS 发布时间:2021-08-19 16:23:43 ,浏览量:0

大家好,我是小鱼。最近来问小鱼问题的同学越来越多了,实在是回答不过来,大家尽量先在我们的鱼群里将问题完整的描述出来,和群友们互相交流问题。

今天说一个很多同学遇到的,也是一位鱼粉问了小鱼很久的问题,所以来说一说,已经完成建图和导航的仿真,接着如何在真实机器人上做建图和导航。

一、搞清楚数据流图

在开始动手在真实机器人上做导航之前,我们要搞清楚整个建图导航的数据流图,也就是建图和导航功能包的输入和输出。

1.1 首先是建图

建图算法有很多种,这里小鱼拿比较常见的gmapping功能包来说。 整体数据流图如下图。

#mermaid-svg-oeltlkJnUKSK9fM5 .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .label text{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .node rect,#mermaid-svg-oeltlkJnUKSK9fM5 .node circle,#mermaid-svg-oeltlkJnUKSK9fM5 .node ellipse,#mermaid-svg-oeltlkJnUKSK9fM5 .node polygon,#mermaid-svg-oeltlkJnUKSK9fM5 .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-oeltlkJnUKSK9fM5 .node .label{text-align:center;fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .node.clickable{cursor:pointer}#mermaid-svg-oeltlkJnUKSK9fM5 .arrowheadPath{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-oeltlkJnUKSK9fM5 .flowchart-link{stroke:#333;fill:none}#mermaid-svg-oeltlkJnUKSK9fM5 .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-oeltlkJnUKSK9fM5 .edgeLabel rect{opacity:0.9}#mermaid-svg-oeltlkJnUKSK9fM5 .edgeLabel span{color:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-oeltlkJnUKSK9fM5 .cluster text{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-oeltlkJnUKSK9fM5 .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-oeltlkJnUKSK9fM5 text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-oeltlkJnUKSK9fM5 .actor-line{stroke:grey}#mermaid-svg-oeltlkJnUKSK9fM5 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-oeltlkJnUKSK9fM5 #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .sequenceNumber{fill:#fff}#mermaid-svg-oeltlkJnUKSK9fM5 #sequencenumber{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 #crosshead path{fill:#333;stroke:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .messageText{fill:#333;stroke:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-oeltlkJnUKSK9fM5 .labelText,#mermaid-svg-oeltlkJnUKSK9fM5 .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-oeltlkJnUKSK9fM5 .loopText,#mermaid-svg-oeltlkJnUKSK9fM5 .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-oeltlkJnUKSK9fM5 .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-oeltlkJnUKSK9fM5 .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-oeltlkJnUKSK9fM5 .noteText,#mermaid-svg-oeltlkJnUKSK9fM5 .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-oeltlkJnUKSK9fM5 .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-oeltlkJnUKSK9fM5 .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-oeltlkJnUKSK9fM5 .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-oeltlkJnUKSK9fM5 .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 .section{stroke:none;opacity:0.2}#mermaid-svg-oeltlkJnUKSK9fM5 .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-oeltlkJnUKSK9fM5 .section2{fill:#fff400}#mermaid-svg-oeltlkJnUKSK9fM5 .section1,#mermaid-svg-oeltlkJnUKSK9fM5 .section3{fill:#fff;opacity:0.2}#mermaid-svg-oeltlkJnUKSK9fM5 .sectionTitle0{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .sectionTitle1{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .sectionTitle2{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .sectionTitle3{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-oeltlkJnUKSK9fM5 .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 .grid path{stroke-width:0}#mermaid-svg-oeltlkJnUKSK9fM5 .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-oeltlkJnUKSK9fM5 .task{stroke-width:2}#mermaid-svg-oeltlkJnUKSK9fM5 .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 .taskText:not([font-size]){font-size:11px}#mermaid-svg-oeltlkJnUKSK9fM5 .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-oeltlkJnUKSK9fM5 .task.clickable{cursor:pointer}#mermaid-svg-oeltlkJnUKSK9fM5 .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-oeltlkJnUKSK9fM5 .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-oeltlkJnUKSK9fM5 .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-oeltlkJnUKSK9fM5 .taskText0,#mermaid-svg-oeltlkJnUKSK9fM5 .taskText1,#mermaid-svg-oeltlkJnUKSK9fM5 .taskText2,#mermaid-svg-oeltlkJnUKSK9fM5 .taskText3{fill:#fff}#mermaid-svg-oeltlkJnUKSK9fM5 .task0,#mermaid-svg-oeltlkJnUKSK9fM5 .task1,#mermaid-svg-oeltlkJnUKSK9fM5 .task2,#mermaid-svg-oeltlkJnUKSK9fM5 .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-oeltlkJnUKSK9fM5 .taskTextOutside0,#mermaid-svg-oeltlkJnUKSK9fM5 .taskTextOutside2{fill:#000}#mermaid-svg-oeltlkJnUKSK9fM5 .taskTextOutside1,#mermaid-svg-oeltlkJnUKSK9fM5 .taskTextOutside3{fill:#000}#mermaid-svg-oeltlkJnUKSK9fM5 .active0,#mermaid-svg-oeltlkJnUKSK9fM5 .active1,#mermaid-svg-oeltlkJnUKSK9fM5 .active2,#mermaid-svg-oeltlkJnUKSK9fM5 .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-oeltlkJnUKSK9fM5 .activeText0,#mermaid-svg-oeltlkJnUKSK9fM5 .activeText1,#mermaid-svg-oeltlkJnUKSK9fM5 .activeText2,#mermaid-svg-oeltlkJnUKSK9fM5 .activeText3{fill:#000 !important}#mermaid-svg-oeltlkJnUKSK9fM5 .done0,#mermaid-svg-oeltlkJnUKSK9fM5 .done1,#mermaid-svg-oeltlkJnUKSK9fM5 .done2,#mermaid-svg-oeltlkJnUKSK9fM5 .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-oeltlkJnUKSK9fM5 .doneText0,#mermaid-svg-oeltlkJnUKSK9fM5 .doneText1,#mermaid-svg-oeltlkJnUKSK9fM5 .doneText2,#mermaid-svg-oeltlkJnUKSK9fM5 .doneText3{fill:#000 !important}#mermaid-svg-oeltlkJnUKSK9fM5 .crit0,#mermaid-svg-oeltlkJnUKSK9fM5 .crit1,#mermaid-svg-oeltlkJnUKSK9fM5 .crit2,#mermaid-svg-oeltlkJnUKSK9fM5 .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-oeltlkJnUKSK9fM5 .activeCrit0,#mermaid-svg-oeltlkJnUKSK9fM5 .activeCrit1,#mermaid-svg-oeltlkJnUKSK9fM5 .activeCrit2,#mermaid-svg-oeltlkJnUKSK9fM5 .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-oeltlkJnUKSK9fM5 .doneCrit0,#mermaid-svg-oeltlkJnUKSK9fM5 .doneCrit1,#mermaid-svg-oeltlkJnUKSK9fM5 .doneCrit2,#mermaid-svg-oeltlkJnUKSK9fM5 .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-oeltlkJnUKSK9fM5 .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-oeltlkJnUKSK9fM5 .milestoneText{font-style:italic}#mermaid-svg-oeltlkJnUKSK9fM5 .doneCritText0,#mermaid-svg-oeltlkJnUKSK9fM5 .doneCritText1,#mermaid-svg-oeltlkJnUKSK9fM5 .doneCritText2,#mermaid-svg-oeltlkJnUKSK9fM5 .doneCritText3{fill:#000 !important}#mermaid-svg-oeltlkJnUKSK9fM5 .activeCritText0,#mermaid-svg-oeltlkJnUKSK9fM5 .activeCritText1,#mermaid-svg-oeltlkJnUKSK9fM5 .activeCritText2,#mermaid-svg-oeltlkJnUKSK9fM5 .activeCritText3{fill:#000 !important}#mermaid-svg-oeltlkJnUKSK9fM5 .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-oeltlkJnUKSK9fM5 g.classGroup text .title{font-weight:bolder}#mermaid-svg-oeltlkJnUKSK9fM5 g.clickable{cursor:pointer}#mermaid-svg-oeltlkJnUKSK9fM5 g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-oeltlkJnUKSK9fM5 g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-oeltlkJnUKSK9fM5 .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-oeltlkJnUKSK9fM5 .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-oeltlkJnUKSK9fM5 .dashed-line{stroke-dasharray:3}#mermaid-svg-oeltlkJnUKSK9fM5 #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 .commit-id,#mermaid-svg-oeltlkJnUKSK9fM5 .commit-msg,#mermaid-svg-oeltlkJnUKSK9fM5 .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-oeltlkJnUKSK9fM5 g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-oeltlkJnUKSK9fM5 g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-oeltlkJnUKSK9fM5 g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-oeltlkJnUKSK9fM5 .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-oeltlkJnUKSK9fM5 .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-oeltlkJnUKSK9fM5 .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-oeltlkJnUKSK9fM5 .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-oeltlkJnUKSK9fM5 .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-oeltlkJnUKSK9fM5 .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-oeltlkJnUKSK9fM5 .edgeLabel text{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-oeltlkJnUKSK9fM5 .node circle.state-start{fill:black;stroke:black}#mermaid-svg-oeltlkJnUKSK9fM5 .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-oeltlkJnUKSK9fM5 #statediagram-barbEnd{fill:#9370db}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-state .divider{stroke:#9370db}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-oeltlkJnUKSK9fM5 .note-edge{stroke-dasharray:5}#mermaid-svg-oeltlkJnUKSK9fM5 .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-oeltlkJnUKSK9fM5 .error-icon{fill:#522}#mermaid-svg-oeltlkJnUKSK9fM5 .error-text{fill:#522;stroke:#522}#mermaid-svg-oeltlkJnUKSK9fM5 .edge-thickness-normal{stroke-width:2px}#mermaid-svg-oeltlkJnUKSK9fM5 .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-oeltlkJnUKSK9fM5 .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-oeltlkJnUKSK9fM5 .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-oeltlkJnUKSK9fM5 .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-oeltlkJnUKSK9fM5 .marker{fill:#333}#mermaid-svg-oeltlkJnUKSK9fM5 .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;} #mermaid-svg-oeltlkJnUKSK9fM5 { color: rgba(0, 0, 0, 0.75); font: ; }
/cmd_vel底盘控制
输出
输出
输入
输入
输入
输出
输入
输出
输出
键盘控制节点
Gazebo
雷达扫描数据Scan
里程计odom
odom坐标系下机器人的位置tf
gampping
base_link->odom和base_link->scan
map栅格地图等数据
map坐标系和odomtf

我们观察一下图中gazebo的作用,输入cmd_vel用于控输gazebo中的小车,输出里程计odom、雷达数据scan和小车link之间的关系。

1.2 导航功能包

导航我们一般使用amcl进行定位,move_base进行规划避障。 我们看一下整个导航导航的数据流图,如果我们将整体分为导航和gazebo两个部分。

#mermaid-svg-QaglgJonL45vitRJ .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-QaglgJonL45vitRJ .label text{fill:#333}#mermaid-svg-QaglgJonL45vitRJ .node rect,#mermaid-svg-QaglgJonL45vitRJ .node circle,#mermaid-svg-QaglgJonL45vitRJ .node ellipse,#mermaid-svg-QaglgJonL45vitRJ .node polygon,#mermaid-svg-QaglgJonL45vitRJ .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-QaglgJonL45vitRJ .node .label{text-align:center;fill:#333}#mermaid-svg-QaglgJonL45vitRJ .node.clickable{cursor:pointer}#mermaid-svg-QaglgJonL45vitRJ .arrowheadPath{fill:#333}#mermaid-svg-QaglgJonL45vitRJ .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-QaglgJonL45vitRJ .flowchart-link{stroke:#333;fill:none}#mermaid-svg-QaglgJonL45vitRJ .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-QaglgJonL45vitRJ .edgeLabel rect{opacity:0.9}#mermaid-svg-QaglgJonL45vitRJ .edgeLabel span{color:#333}#mermaid-svg-QaglgJonL45vitRJ .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-QaglgJonL45vitRJ .cluster text{fill:#333}#mermaid-svg-QaglgJonL45vitRJ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-QaglgJonL45vitRJ .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-QaglgJonL45vitRJ text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-QaglgJonL45vitRJ .actor-line{stroke:grey}#mermaid-svg-QaglgJonL45vitRJ .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-QaglgJonL45vitRJ .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-QaglgJonL45vitRJ #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-QaglgJonL45vitRJ .sequenceNumber{fill:#fff}#mermaid-svg-QaglgJonL45vitRJ #sequencenumber{fill:#333}#mermaid-svg-QaglgJonL45vitRJ #crosshead path{fill:#333;stroke:#333}#mermaid-svg-QaglgJonL45vitRJ .messageText{fill:#333;stroke:#333}#mermaid-svg-QaglgJonL45vitRJ .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-QaglgJonL45vitRJ .labelText,#mermaid-svg-QaglgJonL45vitRJ .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-QaglgJonL45vitRJ .loopText,#mermaid-svg-QaglgJonL45vitRJ .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-QaglgJonL45vitRJ .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-QaglgJonL45vitRJ .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-QaglgJonL45vitRJ .noteText,#mermaid-svg-QaglgJonL45vitRJ .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-QaglgJonL45vitRJ .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-QaglgJonL45vitRJ .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-QaglgJonL45vitRJ .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-QaglgJonL45vitRJ .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ .section{stroke:none;opacity:0.2}#mermaid-svg-QaglgJonL45vitRJ .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-QaglgJonL45vitRJ .section2{fill:#fff400}#mermaid-svg-QaglgJonL45vitRJ .section1,#mermaid-svg-QaglgJonL45vitRJ .section3{fill:#fff;opacity:0.2}#mermaid-svg-QaglgJonL45vitRJ .sectionTitle0{fill:#333}#mermaid-svg-QaglgJonL45vitRJ .sectionTitle1{fill:#333}#mermaid-svg-QaglgJonL45vitRJ .sectionTitle2{fill:#333}#mermaid-svg-QaglgJonL45vitRJ .sectionTitle3{fill:#333}#mermaid-svg-QaglgJonL45vitRJ .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-QaglgJonL45vitRJ .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ .grid path{stroke-width:0}#mermaid-svg-QaglgJonL45vitRJ .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-QaglgJonL45vitRJ .task{stroke-width:2}#mermaid-svg-QaglgJonL45vitRJ .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ .taskText:not([font-size]){font-size:11px}#mermaid-svg-QaglgJonL45vitRJ .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-QaglgJonL45vitRJ .task.clickable{cursor:pointer}#mermaid-svg-QaglgJonL45vitRJ .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-QaglgJonL45vitRJ .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-QaglgJonL45vitRJ .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-QaglgJonL45vitRJ .taskText0,#mermaid-svg-QaglgJonL45vitRJ .taskText1,#mermaid-svg-QaglgJonL45vitRJ .taskText2,#mermaid-svg-QaglgJonL45vitRJ .taskText3{fill:#fff}#mermaid-svg-QaglgJonL45vitRJ .task0,#mermaid-svg-QaglgJonL45vitRJ .task1,#mermaid-svg-QaglgJonL45vitRJ .task2,#mermaid-svg-QaglgJonL45vitRJ .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-QaglgJonL45vitRJ .taskTextOutside0,#mermaid-svg-QaglgJonL45vitRJ .taskTextOutside2{fill:#000}#mermaid-svg-QaglgJonL45vitRJ .taskTextOutside1,#mermaid-svg-QaglgJonL45vitRJ .taskTextOutside3{fill:#000}#mermaid-svg-QaglgJonL45vitRJ .active0,#mermaid-svg-QaglgJonL45vitRJ .active1,#mermaid-svg-QaglgJonL45vitRJ .active2,#mermaid-svg-QaglgJonL45vitRJ .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-QaglgJonL45vitRJ .activeText0,#mermaid-svg-QaglgJonL45vitRJ .activeText1,#mermaid-svg-QaglgJonL45vitRJ .activeText2,#mermaid-svg-QaglgJonL45vitRJ .activeText3{fill:#000 !important}#mermaid-svg-QaglgJonL45vitRJ .done0,#mermaid-svg-QaglgJonL45vitRJ .done1,#mermaid-svg-QaglgJonL45vitRJ .done2,#mermaid-svg-QaglgJonL45vitRJ .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-QaglgJonL45vitRJ .doneText0,#mermaid-svg-QaglgJonL45vitRJ .doneText1,#mermaid-svg-QaglgJonL45vitRJ .doneText2,#mermaid-svg-QaglgJonL45vitRJ .doneText3{fill:#000 !important}#mermaid-svg-QaglgJonL45vitRJ .crit0,#mermaid-svg-QaglgJonL45vitRJ .crit1,#mermaid-svg-QaglgJonL45vitRJ .crit2,#mermaid-svg-QaglgJonL45vitRJ .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-QaglgJonL45vitRJ .activeCrit0,#mermaid-svg-QaglgJonL45vitRJ .activeCrit1,#mermaid-svg-QaglgJonL45vitRJ .activeCrit2,#mermaid-svg-QaglgJonL45vitRJ .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-QaglgJonL45vitRJ .doneCrit0,#mermaid-svg-QaglgJonL45vitRJ .doneCrit1,#mermaid-svg-QaglgJonL45vitRJ .doneCrit2,#mermaid-svg-QaglgJonL45vitRJ .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-QaglgJonL45vitRJ .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-QaglgJonL45vitRJ .milestoneText{font-style:italic}#mermaid-svg-QaglgJonL45vitRJ .doneCritText0,#mermaid-svg-QaglgJonL45vitRJ .doneCritText1,#mermaid-svg-QaglgJonL45vitRJ .doneCritText2,#mermaid-svg-QaglgJonL45vitRJ .doneCritText3{fill:#000 !important}#mermaid-svg-QaglgJonL45vitRJ .activeCritText0,#mermaid-svg-QaglgJonL45vitRJ .activeCritText1,#mermaid-svg-QaglgJonL45vitRJ .activeCritText2,#mermaid-svg-QaglgJonL45vitRJ .activeCritText3{fill:#000 !important}#mermaid-svg-QaglgJonL45vitRJ .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-QaglgJonL45vitRJ g.classGroup text .title{font-weight:bolder}#mermaid-svg-QaglgJonL45vitRJ g.clickable{cursor:pointer}#mermaid-svg-QaglgJonL45vitRJ g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-QaglgJonL45vitRJ g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-QaglgJonL45vitRJ .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-QaglgJonL45vitRJ .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-QaglgJonL45vitRJ .dashed-line{stroke-dasharray:3}#mermaid-svg-QaglgJonL45vitRJ #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ .commit-id,#mermaid-svg-QaglgJonL45vitRJ .commit-msg,#mermaid-svg-QaglgJonL45vitRJ .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-QaglgJonL45vitRJ g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-QaglgJonL45vitRJ g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-QaglgJonL45vitRJ g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-QaglgJonL45vitRJ g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-QaglgJonL45vitRJ .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-QaglgJonL45vitRJ .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-QaglgJonL45vitRJ .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-QaglgJonL45vitRJ .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-QaglgJonL45vitRJ .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-QaglgJonL45vitRJ .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-QaglgJonL45vitRJ .edgeLabel text{fill:#333}#mermaid-svg-QaglgJonL45vitRJ .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-QaglgJonL45vitRJ .node circle.state-start{fill:black;stroke:black}#mermaid-svg-QaglgJonL45vitRJ .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-QaglgJonL45vitRJ #statediagram-barbEnd{fill:#9370db}#mermaid-svg-QaglgJonL45vitRJ .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-QaglgJonL45vitRJ .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-QaglgJonL45vitRJ .statediagram-state .divider{stroke:#9370db}#mermaid-svg-QaglgJonL45vitRJ .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-QaglgJonL45vitRJ .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-QaglgJonL45vitRJ .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-QaglgJonL45vitRJ .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-QaglgJonL45vitRJ .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-QaglgJonL45vitRJ .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-QaglgJonL45vitRJ .note-edge{stroke-dasharray:5}#mermaid-svg-QaglgJonL45vitRJ .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-QaglgJonL45vitRJ .error-icon{fill:#522}#mermaid-svg-QaglgJonL45vitRJ .error-text{fill:#522;stroke:#522}#mermaid-svg-QaglgJonL45vitRJ .edge-thickness-normal{stroke-width:2px}#mermaid-svg-QaglgJonL45vitRJ .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-QaglgJonL45vitRJ .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-QaglgJonL45vitRJ .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-QaglgJonL45vitRJ .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-QaglgJonL45vitRJ .marker{fill:#333}#mermaid-svg-QaglgJonL45vitRJ .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;} #mermaid-svg-QaglgJonL45vitRJ { color: rgba(0, 0, 0, 0.75); font: ; }
输出
输出
输出 /cmd_vel
输入
输入
输入
输出
输入
Gazebo
雷达扫描数据Scan
里程计odom
导航定位算法
机器人link之间关系
地图

跟上面的建图时有所不同,我们不需要键盘控制机器人了,而且我们需要建好的地图(通过map_server)作为输入给到导航定位模块。

二、将gazebo替换成你的真实机器人 2.1 真实机器人的建图

假如我们是在真实机器人上进行的建图,就要把gazebo去掉,把gazebo的原本的输出让真实机器人来输出,对gazbeo的输出cmd_vel也变成对真实机器人的输入。 真实机器人建图数据流程图如下:

#mermaid-svg-gUdvo0x2PcKBIwws .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-gUdvo0x2PcKBIwws .label text{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .node rect,#mermaid-svg-gUdvo0x2PcKBIwws .node circle,#mermaid-svg-gUdvo0x2PcKBIwws .node ellipse,#mermaid-svg-gUdvo0x2PcKBIwws .node polygon,#mermaid-svg-gUdvo0x2PcKBIwws .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-gUdvo0x2PcKBIwws .node .label{text-align:center;fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .node.clickable{cursor:pointer}#mermaid-svg-gUdvo0x2PcKBIwws .arrowheadPath{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-gUdvo0x2PcKBIwws .flowchart-link{stroke:#333;fill:none}#mermaid-svg-gUdvo0x2PcKBIwws .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-gUdvo0x2PcKBIwws .edgeLabel rect{opacity:0.9}#mermaid-svg-gUdvo0x2PcKBIwws .edgeLabel span{color:#333}#mermaid-svg-gUdvo0x2PcKBIwws .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-gUdvo0x2PcKBIwws .cluster text{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-gUdvo0x2PcKBIwws .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-gUdvo0x2PcKBIwws text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-gUdvo0x2PcKBIwws .actor-line{stroke:grey}#mermaid-svg-gUdvo0x2PcKBIwws .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-gUdvo0x2PcKBIwws .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-gUdvo0x2PcKBIwws #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-gUdvo0x2PcKBIwws .sequenceNumber{fill:#fff}#mermaid-svg-gUdvo0x2PcKBIwws #sequencenumber{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws #crosshead path{fill:#333;stroke:#333}#mermaid-svg-gUdvo0x2PcKBIwws .messageText{fill:#333;stroke:#333}#mermaid-svg-gUdvo0x2PcKBIwws .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-gUdvo0x2PcKBIwws .labelText,#mermaid-svg-gUdvo0x2PcKBIwws .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-gUdvo0x2PcKBIwws .loopText,#mermaid-svg-gUdvo0x2PcKBIwws .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-gUdvo0x2PcKBIwws .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-gUdvo0x2PcKBIwws .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-gUdvo0x2PcKBIwws .noteText,#mermaid-svg-gUdvo0x2PcKBIwws .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-gUdvo0x2PcKBIwws .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-gUdvo0x2PcKBIwws .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-gUdvo0x2PcKBIwws .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-gUdvo0x2PcKBIwws .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws .section{stroke:none;opacity:0.2}#mermaid-svg-gUdvo0x2PcKBIwws .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-gUdvo0x2PcKBIwws .section2{fill:#fff400}#mermaid-svg-gUdvo0x2PcKBIwws .section1,#mermaid-svg-gUdvo0x2PcKBIwws .section3{fill:#fff;opacity:0.2}#mermaid-svg-gUdvo0x2PcKBIwws .sectionTitle0{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .sectionTitle1{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .sectionTitle2{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .sectionTitle3{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-gUdvo0x2PcKBIwws .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws .grid path{stroke-width:0}#mermaid-svg-gUdvo0x2PcKBIwws .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-gUdvo0x2PcKBIwws .task{stroke-width:2}#mermaid-svg-gUdvo0x2PcKBIwws .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws .taskText:not([font-size]){font-size:11px}#mermaid-svg-gUdvo0x2PcKBIwws .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-gUdvo0x2PcKBIwws .task.clickable{cursor:pointer}#mermaid-svg-gUdvo0x2PcKBIwws .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-gUdvo0x2PcKBIwws .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-gUdvo0x2PcKBIwws .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-gUdvo0x2PcKBIwws .taskText0,#mermaid-svg-gUdvo0x2PcKBIwws .taskText1,#mermaid-svg-gUdvo0x2PcKBIwws .taskText2,#mermaid-svg-gUdvo0x2PcKBIwws .taskText3{fill:#fff}#mermaid-svg-gUdvo0x2PcKBIwws .task0,#mermaid-svg-gUdvo0x2PcKBIwws .task1,#mermaid-svg-gUdvo0x2PcKBIwws .task2,#mermaid-svg-gUdvo0x2PcKBIwws .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-gUdvo0x2PcKBIwws .taskTextOutside0,#mermaid-svg-gUdvo0x2PcKBIwws .taskTextOutside2{fill:#000}#mermaid-svg-gUdvo0x2PcKBIwws .taskTextOutside1,#mermaid-svg-gUdvo0x2PcKBIwws .taskTextOutside3{fill:#000}#mermaid-svg-gUdvo0x2PcKBIwws .active0,#mermaid-svg-gUdvo0x2PcKBIwws .active1,#mermaid-svg-gUdvo0x2PcKBIwws .active2,#mermaid-svg-gUdvo0x2PcKBIwws .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-gUdvo0x2PcKBIwws .activeText0,#mermaid-svg-gUdvo0x2PcKBIwws .activeText1,#mermaid-svg-gUdvo0x2PcKBIwws .activeText2,#mermaid-svg-gUdvo0x2PcKBIwws .activeText3{fill:#000 !important}#mermaid-svg-gUdvo0x2PcKBIwws .done0,#mermaid-svg-gUdvo0x2PcKBIwws .done1,#mermaid-svg-gUdvo0x2PcKBIwws .done2,#mermaid-svg-gUdvo0x2PcKBIwws .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-gUdvo0x2PcKBIwws .doneText0,#mermaid-svg-gUdvo0x2PcKBIwws .doneText1,#mermaid-svg-gUdvo0x2PcKBIwws .doneText2,#mermaid-svg-gUdvo0x2PcKBIwws .doneText3{fill:#000 !important}#mermaid-svg-gUdvo0x2PcKBIwws .crit0,#mermaid-svg-gUdvo0x2PcKBIwws .crit1,#mermaid-svg-gUdvo0x2PcKBIwws .crit2,#mermaid-svg-gUdvo0x2PcKBIwws .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-gUdvo0x2PcKBIwws .activeCrit0,#mermaid-svg-gUdvo0x2PcKBIwws .activeCrit1,#mermaid-svg-gUdvo0x2PcKBIwws .activeCrit2,#mermaid-svg-gUdvo0x2PcKBIwws .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-gUdvo0x2PcKBIwws .doneCrit0,#mermaid-svg-gUdvo0x2PcKBIwws .doneCrit1,#mermaid-svg-gUdvo0x2PcKBIwws .doneCrit2,#mermaid-svg-gUdvo0x2PcKBIwws .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-gUdvo0x2PcKBIwws .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-gUdvo0x2PcKBIwws .milestoneText{font-style:italic}#mermaid-svg-gUdvo0x2PcKBIwws .doneCritText0,#mermaid-svg-gUdvo0x2PcKBIwws .doneCritText1,#mermaid-svg-gUdvo0x2PcKBIwws .doneCritText2,#mermaid-svg-gUdvo0x2PcKBIwws .doneCritText3{fill:#000 !important}#mermaid-svg-gUdvo0x2PcKBIwws .activeCritText0,#mermaid-svg-gUdvo0x2PcKBIwws .activeCritText1,#mermaid-svg-gUdvo0x2PcKBIwws .activeCritText2,#mermaid-svg-gUdvo0x2PcKBIwws .activeCritText3{fill:#000 !important}#mermaid-svg-gUdvo0x2PcKBIwws .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-gUdvo0x2PcKBIwws g.classGroup text .title{font-weight:bolder}#mermaid-svg-gUdvo0x2PcKBIwws g.clickable{cursor:pointer}#mermaid-svg-gUdvo0x2PcKBIwws g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-gUdvo0x2PcKBIwws g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-gUdvo0x2PcKBIwws .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-gUdvo0x2PcKBIwws .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-gUdvo0x2PcKBIwws .dashed-line{stroke-dasharray:3}#mermaid-svg-gUdvo0x2PcKBIwws #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws .commit-id,#mermaid-svg-gUdvo0x2PcKBIwws .commit-msg,#mermaid-svg-gUdvo0x2PcKBIwws .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-gUdvo0x2PcKBIwws g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-gUdvo0x2PcKBIwws g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-gUdvo0x2PcKBIwws g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-gUdvo0x2PcKBIwws .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-gUdvo0x2PcKBIwws .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-gUdvo0x2PcKBIwws .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-gUdvo0x2PcKBIwws .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-gUdvo0x2PcKBIwws .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-gUdvo0x2PcKBIwws .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-gUdvo0x2PcKBIwws .edgeLabel text{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-gUdvo0x2PcKBIwws .node circle.state-start{fill:black;stroke:black}#mermaid-svg-gUdvo0x2PcKBIwws .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-gUdvo0x2PcKBIwws #statediagram-barbEnd{fill:#9370db}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-state .divider{stroke:#9370db}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-gUdvo0x2PcKBIwws .note-edge{stroke-dasharray:5}#mermaid-svg-gUdvo0x2PcKBIwws .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-gUdvo0x2PcKBIwws .error-icon{fill:#522}#mermaid-svg-gUdvo0x2PcKBIwws .error-text{fill:#522;stroke:#522}#mermaid-svg-gUdvo0x2PcKBIwws .edge-thickness-normal{stroke-width:2px}#mermaid-svg-gUdvo0x2PcKBIwws .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-gUdvo0x2PcKBIwws .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-gUdvo0x2PcKBIwws .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-gUdvo0x2PcKBIwws .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-gUdvo0x2PcKBIwws .marker{fill:#333}#mermaid-svg-gUdvo0x2PcKBIwws .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;} #mermaid-svg-gUdvo0x2PcKBIwws { color: rgba(0, 0, 0, 0.75); font: ; }
/cmd_vel底盘控制
输出
输出
输入
输入
输入
输出
输入
输出
输出
键盘控制节点
真实机器人上
雷达扫描数据Scan
里程计odom
odom坐标系下机器人的位置tf
gampping
urdf文件
base_link->odom和base_link->scan
map栅格地图等数据
map坐标系和odomtf

这个流程看起来就很清晰了,将gazebo换成真实的机器人就行,等下我们再说说一般真实机器人是如何接收cmd_vel控制信息的,又是如何发布odom和scan话题的。

2.2 真实机器人的导航

这个和刚刚的建图如法炮制,直接上图

#mermaid-svg-fw96ZXMcoDsc98fN .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-fw96ZXMcoDsc98fN .label text{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .node rect,#mermaid-svg-fw96ZXMcoDsc98fN .node circle,#mermaid-svg-fw96ZXMcoDsc98fN .node ellipse,#mermaid-svg-fw96ZXMcoDsc98fN .node polygon,#mermaid-svg-fw96ZXMcoDsc98fN .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-fw96ZXMcoDsc98fN .node .label{text-align:center;fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .node.clickable{cursor:pointer}#mermaid-svg-fw96ZXMcoDsc98fN .arrowheadPath{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-fw96ZXMcoDsc98fN .flowchart-link{stroke:#333;fill:none}#mermaid-svg-fw96ZXMcoDsc98fN .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-fw96ZXMcoDsc98fN .edgeLabel rect{opacity:0.9}#mermaid-svg-fw96ZXMcoDsc98fN .edgeLabel span{color:#333}#mermaid-svg-fw96ZXMcoDsc98fN .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-fw96ZXMcoDsc98fN .cluster text{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-fw96ZXMcoDsc98fN .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-fw96ZXMcoDsc98fN text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-fw96ZXMcoDsc98fN .actor-line{stroke:grey}#mermaid-svg-fw96ZXMcoDsc98fN .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-fw96ZXMcoDsc98fN .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-fw96ZXMcoDsc98fN #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-fw96ZXMcoDsc98fN .sequenceNumber{fill:#fff}#mermaid-svg-fw96ZXMcoDsc98fN #sequencenumber{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN #crosshead path{fill:#333;stroke:#333}#mermaid-svg-fw96ZXMcoDsc98fN .messageText{fill:#333;stroke:#333}#mermaid-svg-fw96ZXMcoDsc98fN .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-fw96ZXMcoDsc98fN .labelText,#mermaid-svg-fw96ZXMcoDsc98fN .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-fw96ZXMcoDsc98fN .loopText,#mermaid-svg-fw96ZXMcoDsc98fN .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-fw96ZXMcoDsc98fN .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-fw96ZXMcoDsc98fN .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-fw96ZXMcoDsc98fN .noteText,#mermaid-svg-fw96ZXMcoDsc98fN .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-fw96ZXMcoDsc98fN .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-fw96ZXMcoDsc98fN .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-fw96ZXMcoDsc98fN .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-fw96ZXMcoDsc98fN .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN .section{stroke:none;opacity:0.2}#mermaid-svg-fw96ZXMcoDsc98fN .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-fw96ZXMcoDsc98fN .section2{fill:#fff400}#mermaid-svg-fw96ZXMcoDsc98fN .section1,#mermaid-svg-fw96ZXMcoDsc98fN .section3{fill:#fff;opacity:0.2}#mermaid-svg-fw96ZXMcoDsc98fN .sectionTitle0{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .sectionTitle1{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .sectionTitle2{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .sectionTitle3{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-fw96ZXMcoDsc98fN .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN .grid path{stroke-width:0}#mermaid-svg-fw96ZXMcoDsc98fN .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-fw96ZXMcoDsc98fN .task{stroke-width:2}#mermaid-svg-fw96ZXMcoDsc98fN .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN .taskText:not([font-size]){font-size:11px}#mermaid-svg-fw96ZXMcoDsc98fN .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-fw96ZXMcoDsc98fN .task.clickable{cursor:pointer}#mermaid-svg-fw96ZXMcoDsc98fN .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-fw96ZXMcoDsc98fN .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-fw96ZXMcoDsc98fN .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-fw96ZXMcoDsc98fN .taskText0,#mermaid-svg-fw96ZXMcoDsc98fN .taskText1,#mermaid-svg-fw96ZXMcoDsc98fN .taskText2,#mermaid-svg-fw96ZXMcoDsc98fN .taskText3{fill:#fff}#mermaid-svg-fw96ZXMcoDsc98fN .task0,#mermaid-svg-fw96ZXMcoDsc98fN .task1,#mermaid-svg-fw96ZXMcoDsc98fN .task2,#mermaid-svg-fw96ZXMcoDsc98fN .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-fw96ZXMcoDsc98fN .taskTextOutside0,#mermaid-svg-fw96ZXMcoDsc98fN .taskTextOutside2{fill:#000}#mermaid-svg-fw96ZXMcoDsc98fN .taskTextOutside1,#mermaid-svg-fw96ZXMcoDsc98fN .taskTextOutside3{fill:#000}#mermaid-svg-fw96ZXMcoDsc98fN .active0,#mermaid-svg-fw96ZXMcoDsc98fN .active1,#mermaid-svg-fw96ZXMcoDsc98fN .active2,#mermaid-svg-fw96ZXMcoDsc98fN .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-fw96ZXMcoDsc98fN .activeText0,#mermaid-svg-fw96ZXMcoDsc98fN .activeText1,#mermaid-svg-fw96ZXMcoDsc98fN .activeText2,#mermaid-svg-fw96ZXMcoDsc98fN .activeText3{fill:#000 !important}#mermaid-svg-fw96ZXMcoDsc98fN .done0,#mermaid-svg-fw96ZXMcoDsc98fN .done1,#mermaid-svg-fw96ZXMcoDsc98fN .done2,#mermaid-svg-fw96ZXMcoDsc98fN .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-fw96ZXMcoDsc98fN .doneText0,#mermaid-svg-fw96ZXMcoDsc98fN .doneText1,#mermaid-svg-fw96ZXMcoDsc98fN .doneText2,#mermaid-svg-fw96ZXMcoDsc98fN .doneText3{fill:#000 !important}#mermaid-svg-fw96ZXMcoDsc98fN .crit0,#mermaid-svg-fw96ZXMcoDsc98fN .crit1,#mermaid-svg-fw96ZXMcoDsc98fN .crit2,#mermaid-svg-fw96ZXMcoDsc98fN .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-fw96ZXMcoDsc98fN .activeCrit0,#mermaid-svg-fw96ZXMcoDsc98fN .activeCrit1,#mermaid-svg-fw96ZXMcoDsc98fN .activeCrit2,#mermaid-svg-fw96ZXMcoDsc98fN .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-fw96ZXMcoDsc98fN .doneCrit0,#mermaid-svg-fw96ZXMcoDsc98fN .doneCrit1,#mermaid-svg-fw96ZXMcoDsc98fN .doneCrit2,#mermaid-svg-fw96ZXMcoDsc98fN .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-fw96ZXMcoDsc98fN .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-fw96ZXMcoDsc98fN .milestoneText{font-style:italic}#mermaid-svg-fw96ZXMcoDsc98fN .doneCritText0,#mermaid-svg-fw96ZXMcoDsc98fN .doneCritText1,#mermaid-svg-fw96ZXMcoDsc98fN .doneCritText2,#mermaid-svg-fw96ZXMcoDsc98fN .doneCritText3{fill:#000 !important}#mermaid-svg-fw96ZXMcoDsc98fN .activeCritText0,#mermaid-svg-fw96ZXMcoDsc98fN .activeCritText1,#mermaid-svg-fw96ZXMcoDsc98fN .activeCritText2,#mermaid-svg-fw96ZXMcoDsc98fN .activeCritText3{fill:#000 !important}#mermaid-svg-fw96ZXMcoDsc98fN .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-fw96ZXMcoDsc98fN g.classGroup text .title{font-weight:bolder}#mermaid-svg-fw96ZXMcoDsc98fN g.clickable{cursor:pointer}#mermaid-svg-fw96ZXMcoDsc98fN g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-fw96ZXMcoDsc98fN g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-fw96ZXMcoDsc98fN .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-fw96ZXMcoDsc98fN .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-fw96ZXMcoDsc98fN .dashed-line{stroke-dasharray:3}#mermaid-svg-fw96ZXMcoDsc98fN #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN .commit-id,#mermaid-svg-fw96ZXMcoDsc98fN .commit-msg,#mermaid-svg-fw96ZXMcoDsc98fN .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-fw96ZXMcoDsc98fN g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-fw96ZXMcoDsc98fN g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-fw96ZXMcoDsc98fN g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-fw96ZXMcoDsc98fN .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-fw96ZXMcoDsc98fN .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-fw96ZXMcoDsc98fN .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-fw96ZXMcoDsc98fN .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-fw96ZXMcoDsc98fN .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-fw96ZXMcoDsc98fN .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-fw96ZXMcoDsc98fN .edgeLabel text{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-fw96ZXMcoDsc98fN .node circle.state-start{fill:black;stroke:black}#mermaid-svg-fw96ZXMcoDsc98fN .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-fw96ZXMcoDsc98fN #statediagram-barbEnd{fill:#9370db}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-state .divider{stroke:#9370db}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-fw96ZXMcoDsc98fN .note-edge{stroke-dasharray:5}#mermaid-svg-fw96ZXMcoDsc98fN .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-fw96ZXMcoDsc98fN .error-icon{fill:#522}#mermaid-svg-fw96ZXMcoDsc98fN .error-text{fill:#522;stroke:#522}#mermaid-svg-fw96ZXMcoDsc98fN .edge-thickness-normal{stroke-width:2px}#mermaid-svg-fw96ZXMcoDsc98fN .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-fw96ZXMcoDsc98fN .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-fw96ZXMcoDsc98fN .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-fw96ZXMcoDsc98fN .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-fw96ZXMcoDsc98fN .marker{fill:#333}#mermaid-svg-fw96ZXMcoDsc98fN .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;} #mermaid-svg-fw96ZXMcoDsc98fN { color: rgba(0, 0, 0, 0.75); font: ; }
输出
输出
输入
输入
输入
输入
输出
输出 /cmd_vel
真实机器人
雷达扫描数据Scan
里程计odom
导航定位算法
机器人link之间关系
地图文件
urdf

总结一下可以发现,只要把现在仿真的机器人gazebo干掉,将urdf的link关系改成真实机器人的link关系。然后将真实机器人的数据发布出来,再订阅一个话题cmd_vel话题给真实机器人即可。

三、如何连接真实机器人和建图导航定位程序

这一点做过嵌入式和上位机的同学很清楚(小鱼高中时玩过一段时间单片机,后面大学也搞了下rtos之类的),但是做软件的同学可能就不知道怎么做了,小鱼这里多说两句。

从上面的流程图可以看出来,我们需要真实机器人提供的是里程计信息和雷达信息。

3.1 里程计获取与控制指令的发布

里程计信息获取一般是如下结构。

#mermaid-svg-xydfaqSaFTY1legM .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-xydfaqSaFTY1legM .label text{fill:#333}#mermaid-svg-xydfaqSaFTY1legM .node rect,#mermaid-svg-xydfaqSaFTY1legM .node circle,#mermaid-svg-xydfaqSaFTY1legM .node ellipse,#mermaid-svg-xydfaqSaFTY1legM .node polygon,#mermaid-svg-xydfaqSaFTY1legM .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-xydfaqSaFTY1legM .node .label{text-align:center;fill:#333}#mermaid-svg-xydfaqSaFTY1legM .node.clickable{cursor:pointer}#mermaid-svg-xydfaqSaFTY1legM .arrowheadPath{fill:#333}#mermaid-svg-xydfaqSaFTY1legM .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-xydfaqSaFTY1legM .flowchart-link{stroke:#333;fill:none}#mermaid-svg-xydfaqSaFTY1legM .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-xydfaqSaFTY1legM .edgeLabel rect{opacity:0.9}#mermaid-svg-xydfaqSaFTY1legM .edgeLabel span{color:#333}#mermaid-svg-xydfaqSaFTY1legM .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-xydfaqSaFTY1legM .cluster text{fill:#333}#mermaid-svg-xydfaqSaFTY1legM div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-xydfaqSaFTY1legM .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-xydfaqSaFTY1legM text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-xydfaqSaFTY1legM .actor-line{stroke:grey}#mermaid-svg-xydfaqSaFTY1legM .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-xydfaqSaFTY1legM .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-xydfaqSaFTY1legM #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-xydfaqSaFTY1legM .sequenceNumber{fill:#fff}#mermaid-svg-xydfaqSaFTY1legM #sequencenumber{fill:#333}#mermaid-svg-xydfaqSaFTY1legM #crosshead path{fill:#333;stroke:#333}#mermaid-svg-xydfaqSaFTY1legM .messageText{fill:#333;stroke:#333}#mermaid-svg-xydfaqSaFTY1legM .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-xydfaqSaFTY1legM .labelText,#mermaid-svg-xydfaqSaFTY1legM .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-xydfaqSaFTY1legM .loopText,#mermaid-svg-xydfaqSaFTY1legM .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-xydfaqSaFTY1legM .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-xydfaqSaFTY1legM .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-xydfaqSaFTY1legM .noteText,#mermaid-svg-xydfaqSaFTY1legM .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-xydfaqSaFTY1legM .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-xydfaqSaFTY1legM .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-xydfaqSaFTY1legM .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-xydfaqSaFTY1legM .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM .section{stroke:none;opacity:0.2}#mermaid-svg-xydfaqSaFTY1legM .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-xydfaqSaFTY1legM .section2{fill:#fff400}#mermaid-svg-xydfaqSaFTY1legM .section1,#mermaid-svg-xydfaqSaFTY1legM .section3{fill:#fff;opacity:0.2}#mermaid-svg-xydfaqSaFTY1legM .sectionTitle0{fill:#333}#mermaid-svg-xydfaqSaFTY1legM .sectionTitle1{fill:#333}#mermaid-svg-xydfaqSaFTY1legM .sectionTitle2{fill:#333}#mermaid-svg-xydfaqSaFTY1legM .sectionTitle3{fill:#333}#mermaid-svg-xydfaqSaFTY1legM .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-xydfaqSaFTY1legM .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM .grid path{stroke-width:0}#mermaid-svg-xydfaqSaFTY1legM .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-xydfaqSaFTY1legM .task{stroke-width:2}#mermaid-svg-xydfaqSaFTY1legM .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM .taskText:not([font-size]){font-size:11px}#mermaid-svg-xydfaqSaFTY1legM .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-xydfaqSaFTY1legM .task.clickable{cursor:pointer}#mermaid-svg-xydfaqSaFTY1legM .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-xydfaqSaFTY1legM .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-xydfaqSaFTY1legM .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-xydfaqSaFTY1legM .taskText0,#mermaid-svg-xydfaqSaFTY1legM .taskText1,#mermaid-svg-xydfaqSaFTY1legM .taskText2,#mermaid-svg-xydfaqSaFTY1legM .taskText3{fill:#fff}#mermaid-svg-xydfaqSaFTY1legM .task0,#mermaid-svg-xydfaqSaFTY1legM .task1,#mermaid-svg-xydfaqSaFTY1legM .task2,#mermaid-svg-xydfaqSaFTY1legM .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-xydfaqSaFTY1legM .taskTextOutside0,#mermaid-svg-xydfaqSaFTY1legM .taskTextOutside2{fill:#000}#mermaid-svg-xydfaqSaFTY1legM .taskTextOutside1,#mermaid-svg-xydfaqSaFTY1legM .taskTextOutside3{fill:#000}#mermaid-svg-xydfaqSaFTY1legM .active0,#mermaid-svg-xydfaqSaFTY1legM .active1,#mermaid-svg-xydfaqSaFTY1legM .active2,#mermaid-svg-xydfaqSaFTY1legM .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-xydfaqSaFTY1legM .activeText0,#mermaid-svg-xydfaqSaFTY1legM .activeText1,#mermaid-svg-xydfaqSaFTY1legM .activeText2,#mermaid-svg-xydfaqSaFTY1legM .activeText3{fill:#000 !important}#mermaid-svg-xydfaqSaFTY1legM .done0,#mermaid-svg-xydfaqSaFTY1legM .done1,#mermaid-svg-xydfaqSaFTY1legM .done2,#mermaid-svg-xydfaqSaFTY1legM .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-xydfaqSaFTY1legM .doneText0,#mermaid-svg-xydfaqSaFTY1legM .doneText1,#mermaid-svg-xydfaqSaFTY1legM .doneText2,#mermaid-svg-xydfaqSaFTY1legM .doneText3{fill:#000 !important}#mermaid-svg-xydfaqSaFTY1legM .crit0,#mermaid-svg-xydfaqSaFTY1legM .crit1,#mermaid-svg-xydfaqSaFTY1legM .crit2,#mermaid-svg-xydfaqSaFTY1legM .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-xydfaqSaFTY1legM .activeCrit0,#mermaid-svg-xydfaqSaFTY1legM .activeCrit1,#mermaid-svg-xydfaqSaFTY1legM .activeCrit2,#mermaid-svg-xydfaqSaFTY1legM .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-xydfaqSaFTY1legM .doneCrit0,#mermaid-svg-xydfaqSaFTY1legM .doneCrit1,#mermaid-svg-xydfaqSaFTY1legM .doneCrit2,#mermaid-svg-xydfaqSaFTY1legM .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-xydfaqSaFTY1legM .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-xydfaqSaFTY1legM .milestoneText{font-style:italic}#mermaid-svg-xydfaqSaFTY1legM .doneCritText0,#mermaid-svg-xydfaqSaFTY1legM .doneCritText1,#mermaid-svg-xydfaqSaFTY1legM .doneCritText2,#mermaid-svg-xydfaqSaFTY1legM .doneCritText3{fill:#000 !important}#mermaid-svg-xydfaqSaFTY1legM .activeCritText0,#mermaid-svg-xydfaqSaFTY1legM .activeCritText1,#mermaid-svg-xydfaqSaFTY1legM .activeCritText2,#mermaid-svg-xydfaqSaFTY1legM .activeCritText3{fill:#000 !important}#mermaid-svg-xydfaqSaFTY1legM .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-xydfaqSaFTY1legM g.classGroup text .title{font-weight:bolder}#mermaid-svg-xydfaqSaFTY1legM g.clickable{cursor:pointer}#mermaid-svg-xydfaqSaFTY1legM g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-xydfaqSaFTY1legM g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-xydfaqSaFTY1legM .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-xydfaqSaFTY1legM .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-xydfaqSaFTY1legM .dashed-line{stroke-dasharray:3}#mermaid-svg-xydfaqSaFTY1legM #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM .commit-id,#mermaid-svg-xydfaqSaFTY1legM .commit-msg,#mermaid-svg-xydfaqSaFTY1legM .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-xydfaqSaFTY1legM g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-xydfaqSaFTY1legM g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-xydfaqSaFTY1legM g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-xydfaqSaFTY1legM g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-xydfaqSaFTY1legM .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-xydfaqSaFTY1legM .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-xydfaqSaFTY1legM .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-xydfaqSaFTY1legM .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-xydfaqSaFTY1legM .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-xydfaqSaFTY1legM .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-xydfaqSaFTY1legM .edgeLabel text{fill:#333}#mermaid-svg-xydfaqSaFTY1legM .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-xydfaqSaFTY1legM .node circle.state-start{fill:black;stroke:black}#mermaid-svg-xydfaqSaFTY1legM .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-xydfaqSaFTY1legM #statediagram-barbEnd{fill:#9370db}#mermaid-svg-xydfaqSaFTY1legM .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-xydfaqSaFTY1legM .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-xydfaqSaFTY1legM .statediagram-state .divider{stroke:#9370db}#mermaid-svg-xydfaqSaFTY1legM .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-xydfaqSaFTY1legM .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-xydfaqSaFTY1legM .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-xydfaqSaFTY1legM .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-xydfaqSaFTY1legM .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-xydfaqSaFTY1legM .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-xydfaqSaFTY1legM .note-edge{stroke-dasharray:5}#mermaid-svg-xydfaqSaFTY1legM .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-xydfaqSaFTY1legM .error-icon{fill:#522}#mermaid-svg-xydfaqSaFTY1legM .error-text{fill:#522;stroke:#522}#mermaid-svg-xydfaqSaFTY1legM .edge-thickness-normal{stroke-width:2px}#mermaid-svg-xydfaqSaFTY1legM .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-xydfaqSaFTY1legM .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-xydfaqSaFTY1legM .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-xydfaqSaFTY1legM .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-xydfaqSaFTY1legM .marker{fill:#333}#mermaid-svg-xydfaqSaFTY1legM .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;} #mermaid-svg-xydfaqSaFTY1legM { color: rgba(0, 0, 0, 0.75); font: ; }
PWM等
编码器
里程计
输出
控制指令cmd_vel
嵌入式板子stm32等
电机驱动板
电机
base_control节点
里程计odom

这个方法其实也有很多,比如走can、串口都是可以。如果你是买的底盘,厂家会提供好通信的接口和线,都是可以直接用的。

我们一般会在ROS端编写一个base_control节点,这个节点具备和嵌入式通信的能力。

3.2雷达信息

雷达信息直接使用厂家的雷达驱动即可拿到对应话题数据。

#mermaid-svg-wQCDNMsF503TgKNn .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-wQCDNMsF503TgKNn .label text{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .node rect,#mermaid-svg-wQCDNMsF503TgKNn .node circle,#mermaid-svg-wQCDNMsF503TgKNn .node ellipse,#mermaid-svg-wQCDNMsF503TgKNn .node polygon,#mermaid-svg-wQCDNMsF503TgKNn .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-wQCDNMsF503TgKNn .node .label{text-align:center;fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .node.clickable{cursor:pointer}#mermaid-svg-wQCDNMsF503TgKNn .arrowheadPath{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-wQCDNMsF503TgKNn .flowchart-link{stroke:#333;fill:none}#mermaid-svg-wQCDNMsF503TgKNn .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-wQCDNMsF503TgKNn .edgeLabel rect{opacity:0.9}#mermaid-svg-wQCDNMsF503TgKNn .edgeLabel span{color:#333}#mermaid-svg-wQCDNMsF503TgKNn .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-wQCDNMsF503TgKNn .cluster text{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-wQCDNMsF503TgKNn .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-wQCDNMsF503TgKNn text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-wQCDNMsF503TgKNn .actor-line{stroke:grey}#mermaid-svg-wQCDNMsF503TgKNn .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-wQCDNMsF503TgKNn .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-wQCDNMsF503TgKNn #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-wQCDNMsF503TgKNn .sequenceNumber{fill:#fff}#mermaid-svg-wQCDNMsF503TgKNn #sequencenumber{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn #crosshead path{fill:#333;stroke:#333}#mermaid-svg-wQCDNMsF503TgKNn .messageText{fill:#333;stroke:#333}#mermaid-svg-wQCDNMsF503TgKNn .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-wQCDNMsF503TgKNn .labelText,#mermaid-svg-wQCDNMsF503TgKNn .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-wQCDNMsF503TgKNn .loopText,#mermaid-svg-wQCDNMsF503TgKNn .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-wQCDNMsF503TgKNn .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-wQCDNMsF503TgKNn .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-wQCDNMsF503TgKNn .noteText,#mermaid-svg-wQCDNMsF503TgKNn .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-wQCDNMsF503TgKNn .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-wQCDNMsF503TgKNn .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-wQCDNMsF503TgKNn .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-wQCDNMsF503TgKNn .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn .section{stroke:none;opacity:0.2}#mermaid-svg-wQCDNMsF503TgKNn .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-wQCDNMsF503TgKNn .section2{fill:#fff400}#mermaid-svg-wQCDNMsF503TgKNn .section1,#mermaid-svg-wQCDNMsF503TgKNn .section3{fill:#fff;opacity:0.2}#mermaid-svg-wQCDNMsF503TgKNn .sectionTitle0{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .sectionTitle1{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .sectionTitle2{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .sectionTitle3{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-wQCDNMsF503TgKNn .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn .grid path{stroke-width:0}#mermaid-svg-wQCDNMsF503TgKNn .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-wQCDNMsF503TgKNn .task{stroke-width:2}#mermaid-svg-wQCDNMsF503TgKNn .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn .taskText:not([font-size]){font-size:11px}#mermaid-svg-wQCDNMsF503TgKNn .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-wQCDNMsF503TgKNn .task.clickable{cursor:pointer}#mermaid-svg-wQCDNMsF503TgKNn .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-wQCDNMsF503TgKNn .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-wQCDNMsF503TgKNn .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-wQCDNMsF503TgKNn .taskText0,#mermaid-svg-wQCDNMsF503TgKNn .taskText1,#mermaid-svg-wQCDNMsF503TgKNn .taskText2,#mermaid-svg-wQCDNMsF503TgKNn .taskText3{fill:#fff}#mermaid-svg-wQCDNMsF503TgKNn .task0,#mermaid-svg-wQCDNMsF503TgKNn .task1,#mermaid-svg-wQCDNMsF503TgKNn .task2,#mermaid-svg-wQCDNMsF503TgKNn .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-wQCDNMsF503TgKNn .taskTextOutside0,#mermaid-svg-wQCDNMsF503TgKNn .taskTextOutside2{fill:#000}#mermaid-svg-wQCDNMsF503TgKNn .taskTextOutside1,#mermaid-svg-wQCDNMsF503TgKNn .taskTextOutside3{fill:#000}#mermaid-svg-wQCDNMsF503TgKNn .active0,#mermaid-svg-wQCDNMsF503TgKNn .active1,#mermaid-svg-wQCDNMsF503TgKNn .active2,#mermaid-svg-wQCDNMsF503TgKNn .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-wQCDNMsF503TgKNn .activeText0,#mermaid-svg-wQCDNMsF503TgKNn .activeText1,#mermaid-svg-wQCDNMsF503TgKNn .activeText2,#mermaid-svg-wQCDNMsF503TgKNn .activeText3{fill:#000 !important}#mermaid-svg-wQCDNMsF503TgKNn .done0,#mermaid-svg-wQCDNMsF503TgKNn .done1,#mermaid-svg-wQCDNMsF503TgKNn .done2,#mermaid-svg-wQCDNMsF503TgKNn .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-wQCDNMsF503TgKNn .doneText0,#mermaid-svg-wQCDNMsF503TgKNn .doneText1,#mermaid-svg-wQCDNMsF503TgKNn .doneText2,#mermaid-svg-wQCDNMsF503TgKNn .doneText3{fill:#000 !important}#mermaid-svg-wQCDNMsF503TgKNn .crit0,#mermaid-svg-wQCDNMsF503TgKNn .crit1,#mermaid-svg-wQCDNMsF503TgKNn .crit2,#mermaid-svg-wQCDNMsF503TgKNn .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-wQCDNMsF503TgKNn .activeCrit0,#mermaid-svg-wQCDNMsF503TgKNn .activeCrit1,#mermaid-svg-wQCDNMsF503TgKNn .activeCrit2,#mermaid-svg-wQCDNMsF503TgKNn .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-wQCDNMsF503TgKNn .doneCrit0,#mermaid-svg-wQCDNMsF503TgKNn .doneCrit1,#mermaid-svg-wQCDNMsF503TgKNn .doneCrit2,#mermaid-svg-wQCDNMsF503TgKNn .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-wQCDNMsF503TgKNn .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-wQCDNMsF503TgKNn .milestoneText{font-style:italic}#mermaid-svg-wQCDNMsF503TgKNn .doneCritText0,#mermaid-svg-wQCDNMsF503TgKNn .doneCritText1,#mermaid-svg-wQCDNMsF503TgKNn .doneCritText2,#mermaid-svg-wQCDNMsF503TgKNn .doneCritText3{fill:#000 !important}#mermaid-svg-wQCDNMsF503TgKNn .activeCritText0,#mermaid-svg-wQCDNMsF503TgKNn .activeCritText1,#mermaid-svg-wQCDNMsF503TgKNn .activeCritText2,#mermaid-svg-wQCDNMsF503TgKNn .activeCritText3{fill:#000 !important}#mermaid-svg-wQCDNMsF503TgKNn .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-wQCDNMsF503TgKNn g.classGroup text .title{font-weight:bolder}#mermaid-svg-wQCDNMsF503TgKNn g.clickable{cursor:pointer}#mermaid-svg-wQCDNMsF503TgKNn g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-wQCDNMsF503TgKNn g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-wQCDNMsF503TgKNn .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-wQCDNMsF503TgKNn .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-wQCDNMsF503TgKNn .dashed-line{stroke-dasharray:3}#mermaid-svg-wQCDNMsF503TgKNn #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn .commit-id,#mermaid-svg-wQCDNMsF503TgKNn .commit-msg,#mermaid-svg-wQCDNMsF503TgKNn .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-wQCDNMsF503TgKNn g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-wQCDNMsF503TgKNn g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-wQCDNMsF503TgKNn g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-wQCDNMsF503TgKNn .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-wQCDNMsF503TgKNn .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-wQCDNMsF503TgKNn .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-wQCDNMsF503TgKNn .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-wQCDNMsF503TgKNn .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-wQCDNMsF503TgKNn .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-wQCDNMsF503TgKNn .edgeLabel text{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-wQCDNMsF503TgKNn .node circle.state-start{fill:black;stroke:black}#mermaid-svg-wQCDNMsF503TgKNn .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-wQCDNMsF503TgKNn #statediagram-barbEnd{fill:#9370db}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-state .divider{stroke:#9370db}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-wQCDNMsF503TgKNn .note-edge{stroke-dasharray:5}#mermaid-svg-wQCDNMsF503TgKNn .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-wQCDNMsF503TgKNn .error-icon{fill:#522}#mermaid-svg-wQCDNMsF503TgKNn .error-text{fill:#522;stroke:#522}#mermaid-svg-wQCDNMsF503TgKNn .edge-thickness-normal{stroke-width:2px}#mermaid-svg-wQCDNMsF503TgKNn .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-wQCDNMsF503TgKNn .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-wQCDNMsF503TgKNn .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-wQCDNMsF503TgKNn .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-wQCDNMsF503TgKNn .marker{fill:#333}#mermaid-svg-wQCDNMsF503TgKNn .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;} #mermaid-svg-wQCDNMsF503TgKNn { color: rgba(0, 0, 0, 0.75); font: ; }
输出
雷达
雷达驱动节点
雷达扫描数据Scan
四、总结

今天小鱼算是把整个结构图都画了出来,导航部分没有展开来说,大家可以使用rqt_graph查看计算图。 如果还有不明白的地方,欢迎关注公众号《鱼香ROS》加入鱼群一起交流。

关注
打赏
1666092100
查看更多评论
立即登录/注册

微信扫码登录

5.3219s