Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Kinect plugin in Gazebo crashes on start(Seg fault)

I'm new to Gazebo, and I'm trying to model my robot. I got differential drive working with a few hiccups but now I'm working on adding a Kinect. I pulled some information from here: http://gazebosim.org/tutorials?tut=ros_gzplugins, and changed it slightly to add the Kinect as a sensor within the appropriate tags. When I launch it, Gazebo crashes(Segmentation fault). This is the output:

lukas@lukas-master:~/tortoisebot_ws/src/tortoisebot_description/urdf$ roslaunch tortoisebot_bringup simulation.launch 
... logging to /home/lukas/.ros/log/80918c22-3d96-11e7-b789-1078d27496be/roslaunch-lukas-master-3885.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://localhost:52336/

SUMMARY
========

PARAMETERS
 * /robot_description: <?xml version="1....
 * /rosdistro: indigo
 * /rosversion: 1.11.13
 * /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    spawn_urdf (gazebo_ros/spawn_model)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[gazebo-1]: started with pid [3903]
process[gazebo_gui-2]: started with pid [3909]
process[spawn_urdf-3]: started with pid [3917]
Gazebo multi-robot simulator, version 2.2.3
Copyright (C) 2012-2014 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

Gazebo multi-robot simulator, version 2.2.3
Copyright (C) 2012-2014 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

process[robot_state_publisher-4]: started with pid [3920]
[ INFO] [1495312596.828281935]: Finished loading Gazebo ROS API Plugin.
Msg Waiting for masterMsg Waiting for master

[ INFO] [1495312596.830693779]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
sg Connected to gazebo master @ http://127.0.0.1:11345
32mMsg Msg Publicized address: 192.168.1.2
Connected to gazebo master @ http://127.0.0.1:11345
Msg Publicized address: 192.168.1.2
[ INFO] [1495312597.281770980, 0.023000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
Error [SDF.cc:788] Missing element description for [pointCloudCutoffMax]
[ INFO] [1495312597.818713671, 0.139000000]: Camera Plugin (robotNamespace = /), Info: Using the 'robotNamespace' param: '/'
[ INFO] [1495312597.831408740, 0.139000000]: Starting plugin DiffDrive(ns = //)!
[ WARN] [1495312597.835350878, 0.139000000]: DiffDrive(ns = //): missing <rosDebugLevel> default is na
[ INFO] [1495312597.840829281, 0.139000000]: DiffDrive(ns = //): <tf_prefix> = 
[ WARN] [1495312597.841349503, 0.139000000]: DiffDrive(ns = //): missing <commandTopic> default is cmd_vel
[ WARN] [1495312597.841710823, 0.139000000]: DiffDrive(ns = //): missing <odometryTopic> default is odom
[ WARN] [1495312597.841986734, 0.139000000]: DiffDrive(ns = //): missing <odometryFrame> default is odom
[ WARN] [1495312597.842767638, 0.139000000]: DiffDrive(ns = //): missing <wheelAcceleration> default is 0
[ WARN] [1495312597.843110448, 0.139000000]: DiffDrive(ns = //): missing <wheelTorque> default is 5
[ WARN] [1495312597.843383629, 0.139000000]: DiffDrive(ns = //): missing <updateRate> default is 100
[ WARN] [1495312597.843795218, 0.139000000]: DiffDrive(ns = //): missing <odometrySource> default is 1
[ WARN] [1495312597.844212206, 0.139000000]: GazeboRosDiffDrive Plugin (ns = ) missing <publishTf>, defaults to 1
[ INFO] [1495312597.849545673, 0.139000000]: DiffDrive(ns = //): Advertise joint_states!
[ INFO] [1495312597.853124327, 0.139000000]: DiffDrive(ns = //): Try to subscribe to cmd_vel!
[ INFO] [1495312597.862958832, 0.139000000]: Physics dynamic reconfigure ready.
[ INFO] [1495312597.872353844, 0.139000000]: DiffDrive(ns = //): Subscribe to cmd_vel!
[ INFO] [1495312597.876092652, 0.139000000]: DiffDrive(ns = //): Advertise odom on odom !
[ WARN] [1495312597.879190185, 0.139000000]: GazeboRosJointStatePublisher Plugin (ns = //) missing <updateRate>, defaults to 100.000000
[ INFO] [1495312597.879273726, 0.139000000]: GazeboRosJointStatePublisher is going to publish joint: rear_caster_joint
[ INFO] [1495312597.879311381, 0.139000000]: GazeboRosJointStatePublisher is going to publish joint: kinect_to_base_joint
[ INFO] [1495312597.879344889, 0.139000000]: Starting GazeboRosJointStatePublisher Plugin (ns = //)!, parent name: tortoisebot
[spawn_urdf-3] process has finished cleanly
log file: /home/lukas/.ros/log/80918c22-3d96-11e7-b789-1078d27496be/spawn_urdf-3*.log
Segmentation fault (core dumped)
[gazebo-1] process has died [pid 3903, exit code 139, cmd /opt/ros/indigo/lib/gazebo_ros/gzserver -e ode worlds/empty.world __name:=gazebo __log:=/home/lukas/.ros/log/80918c22-3d96-11e7-b789-1078d27496be/gazebo-1.log].
log file: /home/lukas/.ros/log/80918c22-3d96-11e7-b789-1078d27496be/gazebo-1*.log

Here is my main urdf, tortoisebot.urdf.xacro(I manually convert the xacro to URDF before launching:

<?xml version="1.0"?>

<robot name="tortoisebot" xmlns:xacro="http://www.ros.org/wiki/xacro" &gt;="" <xacro:property="" name="camera_name" value="camera"/> <material name="white"> <color rgba="1, 1, 1, 1"/> </material>

<material name="green">
    <color rgba="0.05 0.75 0.05 1"/>
</material>

<material name="black">
    <color rgba="1, 1, 1, 1"/>
</material>

<material name="red">
    <color rgba="0.75, 0.05, 0.05, 1"/>
</material>

<link name="base_link">
    <visual>
        <geometry>
            <cylinder length="0.2" radius="0.17"/>
        </geometry>
    </visual>
    <collision>
        <geometry>
        <xacro:property name="the_radius" value="2.1" />    <cylinder length="0.2" radius="0.17"/>
        </geometry>
    </collision>
    <inertial>
        <mass value="2.0"/>
        <inertia ixx="0.0211166667" iyy="0.0211166667" izz="0.0289" 
            ixy="0" ixz="0" iyz="0"/>
    </inertial>
</link>

<link name="rear_caster">
    <visual>
        <geometry>  
            <sphere radius="0.01"/>
        </geometry>

    </visual>

    <collision>
        <geometry>
            <sphere radius="0.01"/>
        </geometry>
    </collision>

    <inertial>
        <mass value="0.1"/>
        <inertia ixx="4e-6" iyy="4e-6" izz="4e-6" 
            ixy="0" ixz="0" iyz="0"/>
    </inertial>
</link>

<joint name="rear_caster_joint" type="continuous">
    <axis xyz="0 1 0"/>
    <parent link="base_link"/>
    <child link="rear_caster"/>
    <origin rpy="0 0 0" xyz="-0.1 0 -0.1"/>
</joint>

<link name="left_wheel">
    <visual>
        <geometry>  
            <cylinder length="0.025" radius="0.036"/>
        </geometry>
        <material name="white"/>
    </visual>
    <collision>
        <geometry>
            <cylinder length="0.025" radius="0.036"/>
        </geometry>
    </collision>
    <inertial>
        <mass value="0.1"/>
        <inertia ixx="3.760833333e-5" iyy="3.760833333e-5" izz="6.48e-5" 
            ixy="0" ixz="0" iyz="0"/>
    </inertial>
</link>

<joint name="left_wheel_joint" type="continuous">
    <axis xyz="0 0 1"/>
    <parent link="base_link"/>
    <child link="left_wheel"/>

    <origin rpy="-1.5708 0 0" xyz="0 0.1175 -0.074"/>
</joint>

<link name="right_wheel">
    <visual>
        <geometry>  
            <cylinder length="0.025" radius="0.036"/>
        </geometry>
        <material name="red"/>
    </visual>
    <collision>
        <geometry>
            <cylinder length="0.025" radius="0.036"/>
        </geometry>
    </collision>
    <inertial>
        <mass value="0.1"/>
        <inertia ixx="3.760833333e-5" iyy="3.760833333e-5" izz="6.48e-5" 
            ixy="0" ixz="0" iyz="0"/>
    </inertial>
</link>

<joint name="right_wheel_joint" type="continuous">
    <axis xyz="0 0 1"/>
    <parent link="base_link"/>
    <child link="right_wheel"/>
    <origin rpy="-1.5708 0 0" xyz="0 -0.1175 -0.074"/>
</joint>

<link name="kinect_link">
    <visual>
        <geometry>  
            <box size="0.05 0.3 0.05"/>
        </geometry>
        <material name="black"/>
    </visual>
    <collision>
        <geometry>
            <box size="0.05 0.3 0.05"/>
        </geometry>
    </collision>
    <inertial>
        <mass value="0.1"/>
        <inertia ixx="0.1083333333" iyy="0.06666666666" izz="0.1083333333" 
            ixy="0" ixz="0" iyz="0"/>
    </inertial> 
</link>

<joint name="kinect_to_base_joint" type="fixed">
    <parent link="base_link"/>
    <child link="kinect_link"/>
    <origin rpy="0 0 0" xyz="-0.2 0 0.5"/>
</joint>
<gazebo>
    <plugin name="differential_drive_controller"
        filename="libgazebo_ros_diff_drive.so">
        <leftJoint>right_wheel_joint</leftJoint>
        <rightJoint>left_wheel_joint</rightJoint>
        <robotBaseFrame>base_link</robotBaseFrame>
        <wheelSeparation>0.235</wheelSeparation>
        <wheelDiameter>0.072</wheelDiameter>
        <publishWheelJointState>true</publishWheelJointState>
        <publishWheelTF>false</publishWheelTF>
    </plugin>

    <plugin name="joint_state_publisher"
        filename="libgazebo_ros_joint_state_publisher.so">
        <jointName>rear_caster_joint, kinect_to_base_joint</jointName>
    </plugin>
</gazebo>
<gazebo reference="kinect_link">
    <sensor type="depth" name="kinect_camera">       
    <always_on>1</always_on>
    <visualize>true</visualize>             
    <camera>
        <horizontal_fov>1.047</horizontal_fov>  
        <image>
            <width>640</width>
            <height>480</height>
            <format>R8G8B8</format>
        </image>
        <depth_camera>

        </depth_camera>
        <clip>
            <near>0.1</near>
            <far>100</far>
        </clip>
    </camera>
    <plugin name="camera_controller" filename="libgazebo_ros_openni_kinect.so">
        <alwaysOn>true</alwaysOn>
            <updateRate>10.0</updateRate>
            <cameraName>camera</cameraName>
            <frameName>kinect_link</frameName>                   
        <imageTopicName>rgb/image_raw</imageTopicName>
        <depthImageTopicName>depth/image_raw</depthImageTopicName>
        <pointCloudTopicName>depth/points</pointCloudTopicName>
        <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>              
        <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>            
        <pointCloudCutoff>0.4</pointCloudCutoff>                
            <hackBaseline>0.07</hackBaseline>
            <distortionK1>0.0</distortionK1>
            <distortionK2>0.0</distortionK2>
            <distortionK3>0.0</distortionK3>
            <distortionT1>0.0</distortionT1>
            <distortionT2>0.0</distortionT2>
        <CxPrime>0.0</CxPrime>
        <Cx>0.0</Cx>
        <Cy>0.0</Cy>
        <focalLength>0.0</focalLength>
        </plugin>
    </sensor>
</gazebo>

</robot>

And here is my launch file

<launch>
    <param name="robot_description" 
        textfile="$(find tortoisebot_description)/urdf/tortoisebot.urdf" />
    <include file="$(find gazebo_ros)/launch/empty_world.launch"/>
    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model"
        args="-param robot_description -urdf -model tortoisebot" />
    <node name="robot_state_publisher" pkg="robot_state_publisher"
        type="robot_state_publisher"/>
</launch>

Any idea what I'm doing wrong or what is causing this, and how to fix it? Thanks, kk6axq