Hokuyo not publishing in Gazebo
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" image_format="R8G8B8" hfov="90">
<origin xyz="0.05 0.0 -0.06" rpy="0 0 0"/>
</xacro:gimbal_camera>
-->
<!-- Hokuyo Laser -->
<link name="hokuyo_link">
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 0.1"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://hku_m100_description/meshes/hokuyo.dae"/>
</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="hokuyo_joint" type="fixed">
<axis xyz="0 1 0" />
<origin xyz="0 0 0.125" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="hokuyo_link"/>
</joint>
<joint name="camera_joint" type="floating">
<origin xyz="0.1 0 -0.04" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="camera_link"/>
</joint>
<link name="camera_link">
<inertial>
<mass value="0.0010" />
<origin xyz="0 0 0" rpy="0 0 0" />
<inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hku_m100_description/meshes/hku_m100/gimbal.dae"/>
</geometry>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hku_m100_description/meshes/hku_m100/gimbal.stl"/>
</geometry>
</collision>
</link>
<joint name="camera_optical_joint" type="floating">
<origin xyz="0 0 0" rpy="${-M_PI/2} 0.0 ${-M_PI/2}" />
<parent link="camera_link" />
<child link="camera_optical_frame"/>
</joint>
<link name="camera_optical_frame"/>
<gazebo reference="camera_link">
<sensor type="camera" name="camera_camera_sensor">
<update_rate>10</update_rate>
<camera>
<!-- <pose>0.027 0 -0.027 0 1.57 0</pose> -->
<!-- <pose>0.027 0 -0.027 0 1.57 0</pose> -->
<pose>0.027 0 -0.027 0 0 0</pose>
<horizontal_fov>${94 * M_PI/180.0}</horizontal_fov>
<image>
<format>R8G8B8</format>
<width>640</width>
<height>480</height>
</image>
<clip>
<near>0.01</near>
<far>100</far>
</clip>
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<cameraName>camera</cameraName>
<alwaysOn>true</alwaysOn>
<updateRate>10</updateRate>
<imageTopicName>/dji_sdk/image_raw</imageTopicName>
<cameraInfoTopicName>/dji_sdk/camera_info</cameraInfoTopicName>
<!-- <imageTopicName>camera/image</imageTopicName> -->
<!-- <cameraInfoTopicName>camera/camera_info</cameraInfoTopicName> -->
<frameName>camera_optical_frame</frameName>
</plugin>
</sensor>
</gazebo>
</xacro:macro>
</robot>
I tried using the gpu_laer and the laser without gpu but it's still the same, ple help. Thank you !!
Asked by Abdulla on 2021-02-25 03:02:48 UTC
Comments
Hi, Do you have any errors/warnings when running the simulation? I think your URDF is not well formed.
Asked by Jasmin on 2021-02-26 04:33:19 UTC