【ROS】Gazebo插件gazebo_ros_head_hokuyo_controller的命名空间

【ROS】Gazebo插件gazebo_ros_head_hokuyo_controller的命名空间

  • 1.目标
  • 2.修改

1.目标

如果有多个机器人,上面都有激光雷达,希望使得不同的无人机上的雷达发布的话题不一样
例如

/iris_0/scan
/iris_1/scan
...

2.修改

在激光雷达hokuyo_lidar的model.sdf中的plugin中添加:

<robotNamespace>robotNamespace>

如下所示:

<plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
    <robotNamespace>robotNamespace>
    <topicName>scantopicName>
    <frameName>laserframeName>
plugin>

全文是这样的:


<sdf version="1.5">
  <model name="hokuyo_lidar">
    <pose>0 0 0 0 0 0pose>
    <link name="link">
      <inertial>      
        <mass>0.001mass>     
        <inertia>          	
          <ixx>0.001ixx>      
                
          <ixy>0.0ixy>      
               
          <ixz>0.0ixz>        
                  
          <iyy>0.001iyy>       
                    			
          <iyz>0.0iyz>        
                 
          <izz>0.001izz>      
                  		  
        inertia>    
      inertial>

      <visual name="visual">
        <geometry>
          <mesh>
            <uri>model://hokuyo/meshes/hokuyo.daeuri>
          mesh>
        geometry>
      visual>

      <collision name="collision-base">
        <pose>0 0 -0.0145 0 0 0pose>
        <geometry>
          <box>
            <size>0.05 0.05 0.041size>
          box>
        geometry>
      collision>

      <collision name="collision-top">
        <pose>0 0 0.0205 0 0 0pose>
        <geometry>
          <cylinder>
            <radius>0.021radius>
            <length>0.029length>
          cylinder>
        geometry>
      collision>

      <sensor name="laser" type="ray">
        <pose>0.25 0 0.0175 0 -0 0pose>
        <ray>
          <scan>
            <horizontal>
              <samples>520samples>
              <resolution>1resolution>
              <min_angle>-1.57min_angle>
              <max_angle>1.57max_angle>
            horizontal>
          scan>
          <range>
            <min>0.00min>
            <max>6max>
            <resolution>0.01resolution>
          range>
        ray>
        <plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
          <robotNamespace>robotNamespace>
          <topicName>scantopicName>
          <frameName>laserframeName>
        plugin>
        <always_on>1always_on>
        <update_rate>500update_rate>
        <visualize>truevisualize>
      sensor> 
    link>
  model>
sdf>

参考
1.Gazebo plugins in ROS

你可能感兴趣的:(ROS,ros,gazebo,lidar)