Browse Source

启动多机器人的控制

corvin 5 years ago
parent
commit
5ec5dd215d

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.vscode

+ 23 - 0
mkr2018_mrc/robot_coordination/launch/startup_robots_control.launch

@@ -0,0 +1,23 @@
+<!--
+Copyright: 2016-2019 wwww.corvin.cn ROS小课堂
+Author: corvin
+Description:
+
+History:
+    20191030:init this file.
+-->
+<launch>
+    <arg name="namespace_0" default="robot0" />
+    <arg name="namespace_1" default="robot1" />
+
+    <group ns="$(arg namespace_0)">
+        <node pkg="robot_coordination" type="robot_node" name="control_path" output="screen" required="true">
+        </node>
+    </group>
+    
+    <group ns="$(arg namespace_1)">
+        <node pkg="robot_coordination" type="robot_node" name="control_path" output="screen" required="true">
+        </node>
+    </group>
+</launch>
+

+ 1 - 0
mkr2018_mrc/robot_coordination/scripts/example_robot_control.py

@@ -125,3 +125,4 @@ def main():
 
 if __name__ == '__main__':
     main()
+

+ 2 - 0
mkr2018_mrc/robot_coordination/src/robot.cpp

@@ -124,3 +124,5 @@ bool Robot::followTheCarrot() {
     return false;
   }
 }
+
+

+ 11 - 6
mkr2018_mrc/simulator_e130/launch/simulator.launch

@@ -8,16 +8,21 @@
 
 	<include file="$(find simulator_e130)/launch/robots.launch" />
   
-    <!-- startup move_base node -->
-    <include file="$(find stdr_move_base)/launch/stdr_move_base.launch" />
-    
-    <!-- load home map -->
+    <!-- startup multi robots control node -->
+    <include file="$(find robot_coordination)/launch/startup_robots_control.launch" />
+
+    <!-- load map show in rviz -->
     <node pkg="map_server" type="map_server" name="stdr_load_map" args="$(find simulator_e130)/maps/e129_e130.yaml">
         <remap from="map" to="/amcl/map" />
     </node>
 
-    <!-- startup amcl node -->
-    <include file="$(find stdr_amcl)/launch/stdr_amcl.launch" />
+    <!-- startup rviz show process -->
+    <include file="$(find stdr_amcl)/launch/stdr_rviz.launch" />
 
+    <!-- startup move_base node -->
+    <!--<include file="$(find stdr_move_base)/launch/stdr_move_base.launch" />-->
+    
+    <!-- startup amcl node -->
+    <!-- <include file="$(find stdr_amcl)/launch/stdr_amcl.launch" /> -->
 </launch>
 

+ 14 - 0
mkr2018_mrc/stdr_amcl/launch/stdr_rviz.launch

@@ -0,0 +1,14 @@
+<!--
+  Copyright: 2016-2018 ROS小课堂 www.corvin.cn
+  Author: corvin
+  Description:
+    启动amcl节点,这样就可以在全局地图上对机器人进行定位了。
+  History:
+    20180528: initial this file.
+    20190102: 删除加载地图的launch文件,在自动导航时来启动加载地图的launch文件.
+-->
+<launch>
+  <!-- startup rviz node to show amcl process -->
+  <node name="amcl_rviz" type="rviz" pkg="rviz" args="-d $(find stdr_amcl)/rviz/stdr_config.rviz" />
+
+</launch>

+ 60 - 34
mkr2018_mrc/stdr_amcl/rviz/stdr_amcl_config.rviz

@@ -4,9 +4,12 @@ Panels:
     Name: Displays
     Property Tree Widget:
       Expanded:
+        - /Odometry1
         - /Odometry1/Covariance1
+        - /Odometry2
+        - /Odometry2/Covariance1
       Splitter Ratio: 0.522222221
-    Tree Height: 359
+    Tree Height: 595
   - Class: rviz/Selection
     Name: Selection
   - Class: rviz/Tool Properties
@@ -26,6 +29,8 @@ Panels:
     Name: Time
     SyncMode: 0
     SyncSource: LaserScan
+Toolbars:
+  toolButtonStyle: 2
 Visualization Manager:
   Class: ""
   Displays:
@@ -60,16 +65,10 @@ Visualization Manager:
           Value: true
         robot0_laser_0:
           Value: false
-        robot0_sonar_0:
-          Value: false
-        robot0_sonar_1:
-          Value: false
-        robot0_sonar_2:
-          Value: false
-        robot0_sonar_3:
-          Value: false
-        robot0_sonar_4:
-          Value: false
+        robot1:
+          Value: true
+        robot1_laser_0:
+          Value: true
         world:
           Value: false
       Marker Scale: 1
@@ -84,15 +83,8 @@ Visualization Manager:
               robot0:
                 robot0_laser_0:
                   {}
-                robot0_sonar_0:
-                  {}
-                robot0_sonar_1:
-                  {}
-                robot0_sonar_2:
-                  {}
-                robot0_sonar_3:
-                  {}
-                robot0_sonar_4:
+              robot1:
+                robot1_laser_0:
                   {}
       Update Interval: 0.100000001
       Value: true
@@ -111,9 +103,9 @@ Visualization Manager:
       Enabled: true
       Invert Rainbow: true
       Max Color: 255; 255; 255
-      Max Intensity: 8.80745792
+      Max Intensity: 2.16938996
       Min Color: 0; 0; 0
-      Min Intensity: 2.19338179
+      Min Intensity: 1.74193037
       Name: LaserScan
       Position Transformer: XYZ
       Queue Size: 10
@@ -255,6 +247,40 @@ Visualization Manager:
       Topic: /robot0/odom
       Unreliable: false
       Value: true
+    - Angle Tolerance: 0.100000001
+      Class: rviz/Odometry
+      Covariance:
+        Orientation:
+          Alpha: 0.5
+          Color: 255; 255; 127
+          Color Style: Unique
+          Frame: Local
+          Offset: 1
+          Scale: 1
+          Value: true
+        Position:
+          Alpha: 0.300000012
+          Color: 204; 51; 204
+          Scale: 1
+          Value: true
+        Value: true
+      Enabled: true
+      Keep: 110
+      Name: Odometry
+      Position Tolerance: 0.100000001
+      Shape:
+        Alpha: 1
+        Axes Length: 1
+        Axes Radius: 0.100000001
+        Color: 255; 25; 0
+        Head Length: 0.300000012
+        Head Radius: 0.100000001
+        Shaft Length: 1
+        Shaft Radius: 0.0500000007
+        Value: Arrow
+      Topic: /robot1/odom
+      Unreliable: false
+      Value: true
     - Alpha: 1
       Class: rviz/Polygon
       Color: 255; 24; 105
@@ -323,33 +349,33 @@ Visualization Manager:
   Views:
     Current:
       Class: rviz/Orbit
-      Distance: 15.2291393
+      Distance: 22.6343079
       Enable Stereo Rendering:
         Stereo Eye Separation: 0.0599999987
         Stereo Focal Distance: 1
         Swap Stereo Eyes: false
         Value: false
       Focal Point:
-        X: 8.06713963
-        Y: 5.65849018
-        Z: 2.00396991
+        X: -1.8066324
+        Y: -1.07674348
+        Z: -1.4573499
       Focal Shape Fixed Size: true
       Focal Shape Size: 0.0500000007
       Invert Z Axis: false
       Name: Current View
       Near Clip Distance: 0.00999999978
-      Pitch: 1.20480001
+      Pitch: 1.32979989
       Target Frame: <Fixed Frame>
       Value: Orbit (rviz)
-      Yaw: 4.68818998
+      Yaw: 4.83319378
     Saved: ~
 Window Geometry:
   Displays:
-    collapsed: true
-  Height: 1056
-  Hide Left Dock: true
+    collapsed: false
+  Height: 876
+  Hide Left Dock: false
   Hide Right Dock: true
-  QMainWindow State: 000000ff00000000fd00000004000000000000016a00000396fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006100fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed0000022400000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073000000002800000396000000d700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002e2fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730000000028000002e2000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000073f0000003efc0100000002fb0000000800540069006d006501000000000000073f0000030000fffffffb0000000800540069006d006501000000000000045000000000000000000000073f0000039600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
+  QMainWindow State: 000000ff00000000fd00000004000000000000016a000002e2fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006100fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed0000022400000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000028000002e2000000d700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002e2fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730000000028000002e2000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000006400000003efc0100000002fb0000000800540069006d00650100000000000006400000030000fffffffb0000000800540069006d00650100000000000004500000000000000000000004d0000002e200000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
   Selection:
     collapsed: false
   Time:
@@ -358,6 +384,6 @@ Window Geometry:
     collapsed: false
   Views:
     collapsed: true
-  Width: 1855
-  X: 65
+  Width: 1600
+  X: 0
   Y: 24

+ 389 - 0
mkr2018_mrc/stdr_amcl/rviz/stdr_config.rviz

@@ -0,0 +1,389 @@
+Panels:
+  - Class: rviz/Displays
+    Help Height: 78
+    Name: Displays
+    Property Tree Widget:
+      Expanded:
+        - /Odometry1/Shape1
+        - /Odometry1/Covariance1
+        - /Odometry2/Shape1
+        - /Odometry2/Covariance1
+      Splitter Ratio: 0.522222221
+    Tree Height: 595
+  - Class: rviz/Selection
+    Name: Selection
+  - Class: rviz/Tool Properties
+    Expanded:
+      - /2D Pose Estimate1
+      - /2D Nav Goal1
+      - /Publish Point1
+    Name: Tool Properties
+    Splitter Ratio: 0.588679016
+  - Class: rviz/Views
+    Expanded:
+      - /Current View1
+    Name: Views
+    Splitter Ratio: 0.5
+  - Class: rviz/Time
+    Experimental: false
+    Name: Time
+    SyncMode: 0
+    SyncSource: LaserScan
+Toolbars:
+  toolButtonStyle: 2
+Visualization Manager:
+  Class: ""
+  Displays:
+    - Alpha: 0.400000006
+      Cell Size: 1
+      Class: rviz/Grid
+      Color: 160; 160; 164
+      Enabled: true
+      Line Style:
+        Line Width: 0.0299999993
+        Value: Lines
+      Name: Grid
+      Normal Cell Count: 0
+      Offset:
+        X: 5
+        Y: 5
+        Z: 0
+      Plane: XY
+      Plane Cell Count: 40
+      Reference Frame: map
+      Value: true
+    - Class: rviz/TF
+      Enabled: true
+      Frame Timeout: 15
+      Frames:
+        All Enabled: false
+        map:
+          Value: true
+        map_static:
+          Value: true
+        robot0:
+          Value: true
+        robot0_laser_0:
+          Value: false
+        robot1:
+          Value: true
+        robot1_laser_0:
+          Value: true
+        world:
+          Value: false
+      Marker Scale: 1
+      Name: TF
+      Show Arrows: false
+      Show Axes: true
+      Show Names: true
+      Tree:
+        world:
+          map:
+            map_static:
+              robot0:
+                robot0_laser_0:
+                  {}
+              robot1:
+                robot1_laser_0:
+                  {}
+      Update Interval: 0.100000001
+      Value: true
+    - Alpha: 1
+      Autocompute Intensity Bounds: true
+      Autocompute Value Bounds:
+        Max Value: 10
+        Min Value: -10
+        Value: true
+      Axis: Z
+      Channel Name: x
+      Class: rviz/LaserScan
+      Color: 255; 255; 255
+      Color Transformer: Intensity
+      Decay Time: 0
+      Enabled: true
+      Invert Rainbow: true
+      Max Color: 255; 255; 255
+      Max Intensity: 2.16938996
+      Min Color: 0; 0; 0
+      Min Intensity: 1.74193037
+      Name: LaserScan
+      Position Transformer: XYZ
+      Queue Size: 10
+      Selectable: true
+      Size (Pixels): 3
+      Size (m): 0.100000001
+      Style: Flat Squares
+      Topic: /robot0/laser_0
+      Unreliable: false
+      Use Fixed Frame: true
+      Use rainbow: true
+      Value: true
+    - Alpha: 1
+      Arrow Length: 0.100000001
+      Axes Length: 0.300000012
+      Axes Radius: 0.00999999978
+      Class: rviz/PoseArray
+      Color: 139; 205; 248
+      Enabled: true
+      Head Length: 0.0700000003
+      Head Radius: 0.0299999993
+      Name: PoseArray
+      Shaft Length: 0.230000004
+      Shaft Radius: 0.00999999978
+      Shape: Arrow (Flat)
+      Topic: /particlecloud
+      Unreliable: false
+      Value: true
+    - Alpha: 0.699999988
+      Class: rviz/Map
+      Color Scheme: costmap
+      Draw Behind: true
+      Enabled: true
+      Name: Map
+      Topic: /amcl/map
+      Unreliable: false
+      Use Timestamp: false
+      Value: true
+    - Alpha: 0.600000024
+      Buffer Length: 20
+      Class: rviz/Path
+      Color: 57; 70; 255
+      Enabled: true
+      Head Diameter: 0.0299999993
+      Head Length: 0.0500000007
+      Length: 0.300000012
+      Line Style: Lines
+      Line Width: 0.0299999993
+      Name: Path
+      Offset:
+        X: 0
+        Y: 0
+        Z: 0
+      Pose Color: 0; 85; 255
+      Pose Style: None
+      Radius: 0.0299999993
+      Shaft Diameter: 0.00999999978
+      Shaft Length: 0.0299999993
+      Topic: /stdr_move_base/GlobalPlanner/plan
+      Unreliable: false
+      Value: true
+    - Alpha: 0.800000012
+      Buffer Length: 20
+      Class: rviz/Path
+      Color: 250; 232; 28
+      Enabled: true
+      Head Diameter: 0.0299999993
+      Head Length: 0.0299999993
+      Length: 0.300000012
+      Line Style: Billboards
+      Line Width: 0.00499999989
+      Name: Path
+      Offset:
+        X: 0
+        Y: 0
+        Z: 0
+      Pose Color: 250; 232; 28
+      Pose Style: None
+      Radius: 0.0299999993
+      Shaft Diameter: 0.00999999978
+      Shaft Length: 0.00999999978
+      Topic: /stdr_move_base/DWAPlannerROS/global_plan
+      Unreliable: false
+      Value: true
+    - Alpha: 0.5
+      Buffer Length: 1
+      Class: rviz/Path
+      Color: 255; 23; 112
+      Enabled: true
+      Head Diameter: 0.300000012
+      Head Length: 0.200000003
+      Length: 0.300000012
+      Line Style: Lines
+      Line Width: 0.0299999993
+      Name: Path
+      Offset:
+        X: 0
+        Y: 0
+        Z: 0
+      Pose Color: 255; 85; 255
+      Pose Style: None
+      Radius: 0.0299999993
+      Shaft Diameter: 0.100000001
+      Shaft Length: 0.100000001
+      Topic: /stdr_move_base/DWAPlannerROS/local_plan
+      Unreliable: false
+      Value: true
+    - Angle Tolerance: 0.100000001
+      Class: rviz/Odometry
+      Covariance:
+        Orientation:
+          Alpha: 0.5
+          Color: 255; 255; 127
+          Color Style: Unique
+          Frame: Local
+          Offset: 1
+          Scale: 1
+          Value: true
+        Position:
+          Alpha: 0.300000012
+          Color: 204; 51; 204
+          Scale: 1
+          Value: true
+        Value: true
+      Enabled: true
+      Keep: 110
+      Name: Odometry
+      Position Tolerance: 0.100000001
+      Shape:
+        Alpha: 0.699999988
+        Axes Length: 1
+        Axes Radius: 0.100000001
+        Color: 206; 255; 206
+        Head Length: 0.100000001
+        Head Radius: 0.100000001
+        Shaft Length: 0.200000003
+        Shaft Radius: 0.0500000007
+        Value: Arrow
+      Topic: /robot0/odom
+      Unreliable: false
+      Value: true
+    - Angle Tolerance: 0.100000001
+      Class: rviz/Odometry
+      Covariance:
+        Orientation:
+          Alpha: 0.5
+          Color: 255; 255; 127
+          Color Style: Unique
+          Frame: Local
+          Offset: 1
+          Scale: 1
+          Value: true
+        Position:
+          Alpha: 0.300000012
+          Color: 204; 51; 204
+          Scale: 1
+          Value: true
+        Value: true
+      Enabled: true
+      Keep: 110
+      Name: Odometry
+      Position Tolerance: 0.100000001
+      Shape:
+        Alpha: 0.699999988
+        Axes Length: 1
+        Axes Radius: 0.100000001
+        Color: 255; 25; 0
+        Head Length: 0.100000001
+        Head Radius: 0.100000001
+        Shaft Length: 0.200000003
+        Shaft Radius: 0.0500000007
+        Value: Arrow
+      Topic: /robot1/odom
+      Unreliable: false
+      Value: true
+    - Alpha: 1
+      Class: rviz/Polygon
+      Color: 255; 24; 105
+      Enabled: true
+      Name: Polygon
+      Topic: /stdr_move_base/local_costmap/footprint
+      Unreliable: false
+      Value: true
+    - Alpha: 0.300000012
+      Class: rviz/Map
+      Color Scheme: map
+      Draw Behind: false
+      Enabled: true
+      Name: Map
+      Topic: /stdr_move_base/local_costmap/costmap
+      Unreliable: false
+      Use Timestamp: false
+      Value: true
+    - Alpha: 0.699999988
+      Axes Length: 1
+      Axes Radius: 0.100000001
+      Class: rviz/Pose
+      Color: 239; 76; 35
+      Enabled: true
+      Head Length: 0.200000003
+      Head Radius: 0.200000003
+      Name: Pose
+      Shaft Length: 0.5
+      Shaft Radius: 0.0500000007
+      Shape: Arrow
+      Topic: /move_base_simple/goal
+      Unreliable: false
+      Value: true
+    - Alpha: 0.400000006
+      Class: rviz/Map
+      Color Scheme: map
+      Draw Behind: false
+      Enabled: true
+      Name: Map
+      Topic: /stdr_move_base/global_costmap/costmap
+      Unreliable: false
+      Use Timestamp: false
+      Value: true
+  Enabled: true
+  Global Options:
+    Background Color: 48; 48; 48
+    Default Light: true
+    Fixed Frame: map
+    Frame Rate: 20
+  Name: root
+  Tools:
+    - Class: rviz/Interact
+      Hide Inactive Objects: true
+    - Class: rviz/MoveCamera
+    - Class: rviz/Select
+    - Class: rviz/FocusCamera
+    - Class: rviz/Measure
+    - Class: rviz/SetInitialPose
+      Topic: /initialpose
+    - Class: rviz/SetGoal
+      Topic: /move_base_simple/goal
+    - Class: rviz/PublishPoint
+      Single click: true
+      Topic: /clicked_point
+  Value: true
+  Views:
+    Current:
+      Class: rviz/Orbit
+      Distance: 22.6343079
+      Enable Stereo Rendering:
+        Stereo Eye Separation: 0.0599999987
+        Stereo Focal Distance: 1
+        Swap Stereo Eyes: false
+        Value: false
+      Focal Point:
+        X: -1.8066324
+        Y: -1.07674348
+        Z: -1.4573499
+      Focal Shape Fixed Size: true
+      Focal Shape Size: 0.0500000007
+      Invert Z Axis: false
+      Name: Current View
+      Near Clip Distance: 0.00999999978
+      Pitch: 1.32979989
+      Target Frame: <Fixed Frame>
+      Value: Orbit (rviz)
+      Yaw: 4.83319378
+    Saved: ~
+Window Geometry:
+  Displays:
+    collapsed: true
+  Height: 876
+  Hide Left Dock: true
+  Hide Right Dock: true
+  QMainWindow State: 000000ff00000000fd00000004000000000000016a000002e2fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006100fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed0000022400000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730000000028000002e2000000d700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002e2fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730000000028000002e2000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000006400000003efc0100000002fb0000000800540069006d00650100000000000006400000030000fffffffb0000000800540069006d0065010000000000000450000000000000000000000640000002e200000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
+  Selection:
+    collapsed: false
+  Time:
+    collapsed: false
+  Tool Properties:
+    collapsed: false
+  Views:
+    collapsed: true
+  Width: 1600
+  X: 0
+  Y: 24