Hokuyo not publishing in Gazebo

asked 2021-02-25 02:02:48 -0500

Abdulla gravatar image

Hi Everyone, I am using ROS Kinetic, Ubuntu 16.04 and Gazebo 3.0 I am trying to attach a lidar to a drone simulator in Gazebo, when I launch the file I can see the lidar in Gazebo, but there are not any data that is being taken, no scan topic is published in rostopic list.

My . Gazebo file is

      <!-- hokuyo -->
  <gazebo reference="hokuyo">
    <sensor name="laser" type="ray">
        <pose>0.01 0 0.0175 0 -0 0</pose>
    <topic>~/laser_scan</topic>
        <ray>
          <scan>
            <horizontal>
              <samples>640</samples>
              <resolution>1</resolution>
              <min_angle>-2.26889</min_angle>
              <max_angle>2.268899</max_angle>
            </horizontal>
          </scan>
          <range>
            <min>0.08</min>
            <max>10</max>
            <resolution>0.01</resolution>
          </range>
        </ray>
        <plugin name="laser" filename="libgazeboroslaser.so"> 
        <topicName>/hokuyo_laser</topicName> 
        <frameName>map</frameName> </plugin> 
        <always_on>1</always_on>
        <update_rate>30</update_rate>
        <visualize>true</visualize>
      </sensor>
   </gazebo>

And the URDF file is

<?xml version="1.0"?>

<robot xmlns:xacro="http://www.ros.org/wiki/xacro">

  <xacro:property name="pi" value="3.1415926535897931" />
  <xacro:property name="M_PI" value="3.1415926535897931" />

  <xacro:include filename="$(find hku_m100_description)/urdf/hku_m100.gazebo" />
 -->  
 <!-- Main quadrotor link -->
  <xacro:macro name="hku_m100_base_macro">
    <link name="base_link">
      <inertial>
        <mass value="1.477" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.01152" ixy="0.0" ixz="0.0" iyy="0.01152" iyz="0.0" izz="0.0218" />
      </inertial>

      <visual>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <geometry>
          <mesh filename="package://hku_m100_description/meshes/hku_m100/hku_m100.dae"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <geometry>
          <mesh filename="package://hku_m100_description/meshes/hku_m100/hku_m100.stl"/>
        </geometry>
      </collision>
    </link>

    <!-- Sonar height sensor -->
     <!--<xacro:sonar_sensor name="sonar" parent="base_link" ros_topic="sonar_height" update_rate="10" min_range="0.03" max_range="3.0" field_of_view="${40*pi/180}" ray_count="3">
      <origin xyz="-0.16 0.0 -0.012" rpy="0 ${90*pi/180} 0"/>
    </xacro:sonar_sensor>-->
    <!-- Camera -->
    <!-- <link name="camera_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://hku_m100_description/meshes/hku_m100/gimbal.dae"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://hku_m100_description/meshes/hku_m100/gimbal.stl"/>
      </geometry>
    </visual>

    <inertial>
      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
    </inertial>
  </link>

  <joint name="camera_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="$0 0 0" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="camera_link"/>
  </joint>
 -->
  <!-- <xacro:include filename="$(find hku_m100_description)/urdf/hku_m100.gazebo" /> -->
<!--   <xacro:include filename="$(find hku_m100_description)/urdf/gimbal_camera.urdf.xacro"/>
  <xacro:gimbal_camera name="camera" parent="base_link" ros_topic="camera/image" cam_info_topic="camera/camera_info" update_rate="10" res_x="320" res_y="240 ...
(more)
edit retag flag offensive close merge delete

Comments

Hi, Do you have any errors/warnings when running the simulation? I think your URDF is not well formed.

Jasmin gravatar image Jasmin  ( 2021-02-26 03:33:19 -0500 )edit