Segmentation fault while using Hokuyo lidar with Rotors_Simulator
I am using Ros Kinetic and Gazebo-7 on Ubuntu 16.04. I am trying to simulate a quadrotor with lidar attached to it.
I have found the Rotors_Simulator repository and manually added a Hokuyo lidar for simulation in Gazebo using the following code:
<!-- Hokuyo Lidar Range Sensor -->
<xacro:macro name="hokuyo_utm30lx" params="robot_namespace *origin update_rate ray_count min_angle max_angle">
<link name="${robot_namespace}/laser_lidar_link12">
<inertial>
<mass value="0.001" />
<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>
<geometry>
<!--<mesh filename="package://turtlebot_description/meshes/sensors/hokuyo_utm30lx/hokuyo_utm_30lx.dae"/> -->
<box size="0.05 0.05 0.02"/>
</geometry>
</visual>
<collision>
<origin xyz="0 0 -0.0115" rpy="0 0 0" />
<geometry>
<box size="0.058 0.058 0.087" />
<!--<mesh filename="package://hector_sensors_description/meshes/hokuyo_utm30lx/hokuyo_utm_30lx.stl"/>-->
</geometry>
</collision>
</link>
<joint name="laser_lidar_joint" type="fixed">
<origin xyz="0.0 0.0 0.12" rpy="3.14159 0.0 0.0" />
<parent link="${robot_namespace}/base_link"/>
<child link="${robot_namespace}/laser_lidar_link12"/>
</joint>
<gazebo reference="${robot_namespace}/laser_lidar_link12">
<sensor type="ray" name="iris_laser_lidar">
<pose>0 0 0 0 0 0</pose>
<visualize>false</visualize>
<update_rate>1</update_rate>
<ray>
<scan>
<horizontal>
<samples>3</samples>
<resolution>10</resolution>
<min_angle>-1</min_angle>
<max_angle>1</max_angle>
</horizontal>
</scan>
<range>
<min>0.10</min>
<max>20.0</max>
<resolution>0.01</resolution>
</range>
<noise>
<type>Gaussian</type>
<mean>0.0</mean>
<stddev>0.01</stddev>
</noise>
</ray>
<plugin name="ray" filename="libgazebo_ros_laser.so">
<topicName>/scan</topicName>
<frameName>iris/laser_lidar_link12</frameName>
<!-- <interface:laser name="gazebo_ros_${laser_suffix}_iface" /> -->
</plugin>
</sensor>
</gazebo>
</xacro:macro>
<xacro:hokuyo_utm30lx robot_namespace="${namespace}" min_angle="-1.047" max_angle="1.047"
update_rate="40" ray_count="10">
<origin xyz="0 0 0.5" rpy="0 0 0"/>
</xacro:hokuyo_utm30lx>
I could see the lidar in the simulation, and I did "rostopic echo /scan" to view the messages from the lidar. I could see the messages only when I am using an empty world for simulation. When I am adding an obstacle in the world in lidar's range, the simulation stops with the following message:
Segmentation fault (core dumped) [gazebo-2] process has died [pid 6201, exit code 139, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver -u -e ode /home/viswa/rotors_pravin/src/rotors_gazebo/worlds/basic.world __name:=gazebo __log:=/home/viswa/.ros/log/73106ace-3e60-11e9-b4ce-bc855666be67/gazebo-2.log]. log file: /home/viswa/.ros/log/73106ace-3e60-11e9-b4ce-bc855666be67/gazebo-2*.log
Can someone suggest me what could have gone wrong?