• gazebo中添加动态障碍物


    gazebo 教程

    1. gazebo github
      https://github.com/gazebosim/gazebo-classic/tree/gazebo9
    2. gazebo tutorials
      https://classic.gazebosim.org/tutorials
    3. 运行一个空白环境
    
      
    
        
          0.4 0.4 0.4 1
          0.7 0.7 0.7 1
          true
        
    
        
        
          model://sun
        
    
        
        
          model://ground_plane
        
     
      
    
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    gazebo 添加动态障碍物

    参照官方教程:
    https://classic.gazebosim.org/tutorials?tut=actor&cat=build_robot
    在这里插入图片描述

    actor标签范围内的模型配置。人会在多点间运动

    
      
        
          model://sun
        
        
          
            walk.dae
          
          
            walk.dae
          
          
        
      
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39

    问题: 这个人或其它模型的配置是透明的,激光无法监测到对应的物体

    gazebo添加动态障碍物插件

    参照: https://zhuanlan.zhihu.com/p/404197579
    https://blog.csdn.net/allenhsu6/article/details/114068662

    默认gazebo9 的插件路径: /usr/lib/x86_64-linux-gnu/gazebo-9/plugins

    kint@kint:~$ ls /usr/lib/x86_64-linux-gnu/gazebo-9/plugins 
    libActorPlugin.so           libCameraPlugin.so       libFiducialCameraPlugin.so  libHydraPlugin.so            libLinearBatteryConsumerPlugin.so  libRandomVelocityPlugin.so  libSkidSteerDrivePlugin.so
    libActuatorPlugin.so        libCartDemoPlugin.so     libFollowerPlugin.so        libImuSensorPlugin.so        libLinearBatteryPlugin.so          libRayPlugin.so             libSonarPlugin.so
    libArduCopterPlugin.so      libCessnaGUIPlugin.so    libForceTorquePlugin.so     libInitialVelocityPlugin.so  libLinkPlot3DPlugin.so             libRaySensorNoisePlugin.so  libSphereAtlasDemoPlugin.so
    libArrangePlugin.so         libCessnaPlugin.so       libGimbalSmall2dPlugin.so   libJointTrajectoryPlugin.so  libLookAtDemoPlugin.so             libRegionEventBoxPlugin.so  libTimerGUIPlugin.so
    libAttachLightPlugin.so     libContactPlugin.so      libGpuRayPlugin.so          libKeyboardGUIPlugin.so      libModelPropShop.so                libRestUiPlugin.so          libTouchPlugin.so
    libBlinkVisualPlugin.so     libDepthCameraPlugin.so  libHarnessPlugin.so         libKeysToJointsPlugin.so     libMudPlugin.so                    libRestWebPlugin.so         libTransporterPlugin.so
    libBreakableJointPlugin.so  libDiffDrivePlugin.so    libHeightmapLODPlugin.so    libLensFlareSensorPlugin.so  libPlaneDemoPlugin.so              libRubblePlugin.so          libVehiclePlugin.so
    libBuoyancyPlugin.so        libElevatorPlugin.so     libHydraDemoPlugin.so       libLiftDragPlugin.so         libPressurePlugin.so               libSimEventsPlugin.so       libWindPlugin.so
    
    kint@kint:~$ ls /usr/lib/x86_64-linux-gnu/gazebo-9/plugins  | grep libActorCollisionsPlugin
    
    编译并拷贝好对应插件后
    kint@kint:~$ ls /usr/lib/x86_64-linux-gnu/gazebo-9/plugins  | grep libActorCollisionsPlugin
    libActorCollisionsPlugin.so
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    参考自己下载源码去编译,注意gazebo的版本和branch对应

    附:在gazebo中添加碰撞插件
    
    1.下载gazebo源码
    
    git clone https://github.com/gazebosim/gazebo-classic 
    注意branch: gazebo9
    
    2.进入actor_collisions文件夹
    
    cd examples/plugins/actor_collisions
    3.编译碰撞插件
    
    mkdir build
    cd build
    cmake ..
    make
    4.插件拷贝
    
    sudo cp libActorCollisionsPlugin.so /usr/lib/x86_64-linux-gnu/gazebo-9/plugins 
    5.测试插件
    
    gazebo actor_collisions.world
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    actor_collisions.world 中的动态物体代码部分如下,如要在原静态world中添加,直接将actor标签整过去就行,修改相应的运行轨迹waypoint:

     
    
       
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
       
       
         walk.dae
         1.0
       
       
         walk.dae
         1.000000
         true
       
       
     
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250

    激光可视效果图:
    在这里插入图片描述

    在这里插入图片描述

    gazebo中动态障碍物实时pose

    1. gazebo_ros_p3d 无法发布world中model的pose
      运动中机器人是可以通过这以odometer的形式发布话题
      https://github.com/ros-simulation/gazebo_ros_pkgs/blob/noetic-devel/gazebo_plugins/src/gazebo_ros_p3d.cpp
     
       true
       50.0
       base_link
       robot_pose
       0.01
       world
       0 0 0
       0 0 0
        
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    动态模型使用gazebo_ros_p3d插件发布pose待研究

    无效的
        
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    1. gazebo提供相应的服务与话题接口可以查看model的pose信息
    int@kint:~$ rostopic list | grep state
    /gazebo/link_states
    /gazebo/model_states
    
    kint@kint:~$ rosservice list | grep state
    /gazebo/get_link_state
    /gazebo/get_model_state
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    kint@kint:~$ rostopic  echo  /gazebo/model_states
    name: 
      - ground_plane
      - Untitled
      - cube_20k
      - Dumpster
      - Dumpster_0
      - jersey_barrier
      - actor
      - turtlebot3_burger
    pose: 
      - 
        position: 
          x: 0.0
          y: 0.0
          z: 0.0
        orientation: 
          x: 0.0
          y: 0.0
          z: 0.0
          w: 1.0
      - 
        position: 
          x: 0.603431
          y: 0.0078
          z: 0.0
        orientation: 
          x: 0.0
          y: 0.0
          z: 0.0
          w: 1.0
      - 
        position: 
          x: -5.38602065236
          y: -6.80744881043
          z: 0.499999533763
        orientation: 
          x: -1.56147498596e-07
          y: 4.11218458777e-07
          z: 0.000350767461665
          w: 0.999999938481
      - 
        position: 
          x: 5.96634000329
          y: -7.4192400014
          z: 0.000917228865924
        orientation: 
          x: -4.4374537364e-08
          y: 8.20482662792e-07
          z: -3.21807825887e-11
          w: 1.0
      - 
        position: 
          x: 6.01622000329
          y: 6.8208899986
          z: 0.000917228865924
        orientation: 
          x: -4.4374537364e-08
          y: 8.20482662792e-07
          z: -3.21807825887e-11
          w: 1.0
      - 
        position: 
          x: -2.42989
          y: -0.195854
          z: 0.0
        orientation: 
          x: 0.0
          y: 0.0
          z: 0.703329181425
          w: 0.710864306711
      - 
        position: 
          x: -0.762738254539
          y: -0.685481094471
          z: 1.032665
        orientation: 
          x: -0.224475849993
          y: 0.65300445035
          z: 0.665474749341
          w: -0.283441596422
      - 
        position: 
          x: -0.0451317038465
          y: 0.0244496431331
          z: -0.00100340529416
        orientation: 
          x: -0.00228018314614
          y: 0.00312514199549
          z: 0.588102512665
          w: 0.808777144119
    twist: 
      - 
        linear: 
          x: 0.0
          y: 0.0
          z: 0.0
        angular: 
          x: 0.0
          y: 0.0
          z: 0.0
      - 
        linear: 
          x: 0.0
          y: 0.0
          z: 0.0
        angular: 
          x: 0.0
          y: 0.0
          z: 0.0
      - 
        linear: 
          x: 0.0
          y: 0.0
          z: 0.0
        angular: 
          x: 0.0
          y: 0.0
          z: 0.0
      - 
        linear: 
          x: 0.0
          y: 0.0
          z: 0.0
        angular: 
          x: 0.0
          y: 0.0
          z: 0.0
      - 
        linear: 
          x: 0.0
          y: 0.0
          z: 0.0
        angular: 
          x: 0.0
          y: 0.0
          z: 0.0
      - 
        linear: 
          x: 0.0
          y: 0.0
          z: 0.0
        angular: 
          x: 0.0
          y: 0.0
          z: 0.0
      - 
        linear: 
          x: 0.0
          y: 0.0
          z: 0.0
        angular: 
          x: 0.0
          y: 0.0
          z: 0.0
      - 
        linear: 
          x: -0.00109069429249
          y: 0.000179601510918
          z: 1.84796141906e-05
        angular: 
          x: 7.65645076952e-05
          y: -1.82519279997e-05
          z: 0.0165613168548
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    kint@kint:~$ rosservice call /gazebo/get_model_state "model_name: 'actor'
    relative_entity_name: ''" 
    header: 
      seq: 1
      stamp: 
        secs: 628
        nsecs: 363000000
      frame_id: ''
    pose: 
      position: 
        x: -0.734865579665
        y: 0.655232085776
        z: 1.030874
      orientation: 
        x: 0.261328317576
        y: 0.654221918987
        z: 0.66146012535
        w: 0.257238592986
    twist: 
      linear: 
        x: 0.0
        y: 0.0
        z: 0.0
      angular: 
        x: 0.0
        y: 0.0
        z: 0.0
    success: True
    status_message: "GetModelState: got properties"
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    1. 常见一个ros节点程序,订阅gazebo模型发布的pose, 再将目标模型的pose以odometer方式发布
  • 相关阅读:
    Go并发可视化解释 - sync.WaitGroup
    自媒体新人,如何快速积累粉丝,我的业余Python能帮助我干些什么
    QT的按钮按钮控件
    如何使用摩尔信使MThings连接网络设备
    文件包含漏洞的详解
    反射的作用、应用场景
    Redisson
    UVM之TLM port基础
    Docker compose插件安装
    联影医疗通过注册:拟募资125亿 薛敏控制32%股权
  • 原文地址:https://blog.csdn.net/zyh821351004/article/details/128203687