I am using Ros Kinetic 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">
<xacro:insert_block name="origin"/>
<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>${update_rate}</update_rate>
<ray>
<scan>
<horizontal>
<samples>$(ray_count)</samples>
<resolution>1</resolution>
<min_angle>${min_angle}</min_angle>
<max_angle>${max_angle}</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="120">
<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. This happens 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 2836, 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/d05c3eec-3cf8-11e9-b7d9-bc855666be67/gazebo-2.log]. log file: /home/viswa/.ros/log/d05c3eec-3cf8-11e9-b7d9-bc855666be67/gazebo-2*.log
Further I added a callback with a subscriber:
void callback(const sensor_msgs::LaserScan::ConstPtr& input)
{
ROS_INFO("Laser Scan Message recieved");
}
The subscriber keeps displaying the following message:
[ INFO] [1551537504.870564767, 5.000000000]: Laser Scan Message recieved
The simulation stops when it detects an obstacle with the same Segmentation Fault.
What needs to be added to make this work?
Originally posted by viswa_1211 on ROS Answers with karma: 1 on 2019-03-02
Post score: 0