libgazebo)ros_laser.so does not generate topic to publish my laser scan data

asked 2015-04-02 04:25:52 -0500

Mamoon gravatar image

updated 2015-04-02 09:07:37 -0500

nkoenig gravatar image

hello! I am newbie trying to learn ROS and Gazebo. I am trying to simulate iRobot create with hokuyo laser sensor. Everything is working fine except that during simulation topic to publish my laser scan data into gazebo is not generated. I reckon that the plugin does not run but I am not sure about it. I am using the xacro for laser sensor for erratic robot to simulate mine.

The attached code is

<?xml version="1.0"?>

<robot
    xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
    xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
    xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface">

    <macro name="erratic_hokuyo_laser" params="parent *origin">
        <joint name="laser_base_mount_joint" type="fixed">
            <insert_block name="origin" /> 
            <parent link="${parent}"/>
            <child link="laser_base_link"/>
        </joint>

        <link name="laser_base_link" type="fixed">
            <inertial>
                <mass value="0.1"/>
                <origin xyz="0 0 0.0"/>
                <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
            </inertial>

            <visual>
                <origin rpy="0 0 0" xyz="0 0 0.025"/>
                <geometry>
                    <box size="0.05 0.05 0.05"/>
                </geometry>
            </visual>

            <collision>
                <origin rpy="0 0 0" xyz="0 0 0.025"/>
                <geometry>
                    <box size="0.05 0.05 0.05"/>
                </geometry>
            </collision>
        </link>

        <joint name="base_scan_joint" type="fixed" >
            <origin xyz="0 0 0.05" rpy="0 0 0" />
            <parent link="laser_base_link" />
            <child link="base_scan_link"/>
        </joint>

        <link name="base_scan_link" type="laser">
            <inertial>
                <mass value="0.1"/>
                <origin xyz="0 0 0.0"/>
                <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
            </inertial>

            <visual>
                <origin rpy="0 0 0" xyz="0 0 0.014"/>
                <geometry>
                    <cylinder radius="0.0229" length="0.028"/>
                </geometry>
            </visual>

            <collision>
                <origin rpy="0 0 0" xyz="0 0 0.014"/>
                <geometry>
                    <cylinder radius="0.0229" length="0.028"/>
                </geometry>
            </collision>
        </link>

        <gazebo reference="turtlebot_hardware">
            <sensor:ray name="laser">
                <rayCount>683</rayCount>
                <rangeCount>683</rangeCount>
                <laserCount>1</laserCount>

                <origin>0.0 0.0 0.0</origin>
                <displayRays>false</displayRays>

                <minAngle>-135</minAngle>
                <maxAngle> 135</maxAngle>

                <minRange>0.06</minRange>
                <maxRange>4.0</maxRange>
                <resRange>0.001</resRange>
                <updateRate>10.0</updateRate>

              <controller:gazebo_ros_laser name="gazebo_ros_base_scan_link_controller" plugin="libgazebo_ros_laser.so">
                    <gaussianNoise>0.005</gaussianNoise>
                    <alwaysOn>true</alwaysOn>
                    <updateRate>10.0</updateRate>
                    <topicName>/scan</topicName>
                    <frameName>base_scan_link</frameName>
                    <interface:laser name="gazebo_ros_base_scan_link_iface"/>
                </controller:gazebo_ros_laser>
            </sensor:ray> 

        </gazebo>

        <gazebo reference="laser_base_link">
            <material>Erratic/Grey</material>
        </gazebo>

        <gazebo reference="base_scan_link">
            <material>Erratic/Black</material>
        </gazebo>
    </macro>
</robot>

Any help will be appreciated. Regards

edit retag flag offensive close merge delete

Comments

Can you visualize the laser in Gazebo (in the Gazebo gui, press Ctrl-T then find the laser scan topic)? Also check from the command line using ros topic list to see if the topic is there and ros topic echo to dump output from the topic. If those fail, check that the model is loaded properly by inspecting the model in the gazebo gui through the model tree list on the left side.

nkoenig gravatar imagenkoenig ( 2015-04-02 09:12:49 -0500 )edit

I can visualize the laser on my robot but the link name is not present in model tree. There is one warning message generated on my terminal when I run the launch file " Warning [ModelDatabase.cc:205] Unable to connect to model database using [http://gazebosim.org/models//database.config]. Only locally installed models will be available " One more thing to be noticed is that I have used <gazebo reference="turtlebothardware"> in my code instead of <gazebo reference="basescan_link">

Mamoon gravatar imageMamoon ( 2015-04-03 08:29:37 -0500 )edit

because otherwise an error shows up "Error [parser.cc:697] XML Element[sensor:ray], child of element[link] not defined in SDF. Ignoring [link] Error [parser.cc:688] Error reading element <link> Error [parser.cc:688] Error reading element <model> Error [parser.cc:348] Unable to read element <sdf> Error [parser.cc:299] parse as old deprecated model file failed. " I referred to your answer on this link http://answers.gazebosim.org/question/4592/gazebo-plugin-for-6d-velocity-error/

Mamoon gravatar imageMamoon ( 2015-04-03 08:32:02 -0500 )edit
1

@nkoenig! The problem is resolved! apparently I was using the syntax for the older version of gazebo. Thanks for your help.

Mamoon gravatar imageMamoon ( 2015-04-04 07:08:07 -0500 )edit

Can you create an answer so that others can benefit from the solution to this question?

SL Remy gravatar imageSL Remy ( 2016-02-11 19:11:59 -0500 )edit