[Fixed] Gmapping and tf

asked 2016-10-28 22:46:51 -0500

NguyenPham gravatar image

updated 2016-11-02 21:57:45 -0500

Hi all

My robot in rviz has some problems when i run gmapping launch file. the robot model and it's wheel got to take apart. How can i fix it. Sorry for my bad english. Thanks first.

Here is the image

image description

My launch file

<?xml version="1.0"?>

<launch> <arg name="model"/> <arg name="gui" default="False"/> <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" &gt;="" <="" node="">

<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
    <param name="publish_frequency" type="double" value="5.0" />
</node>
<!--<node name="rviz" pkg="rviz" type="rviz" args="-d $(find urdf_tutorial)/urdf.rviz" />-->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find urdf_tutorial)/urdf.rviz" required="true" />

<!--Mapping-->
<node pkg="sicktoolbox_wrapper" type="sicklms" name="sicklms" >
    <param name="port" value="/dev/ttyUSB0" />                       <!--ttyUSB*-->
    <param name="baud" value="38400" />
    <param name="angle" value="180" />
    <param name="resolution" value="1.0" />
    <param name="units" value="mm" />
</node>

<!--TF-->
<node pkg="tf" type="static_transform_publisher" name="map_2_odom" args="0 0 0 0 0 0 /map /odom 100"/>
<node pkg="tf" type="static_transform_publisher" name="odom_2_base_link" args="0 0 0 0 0 0 /odom /base_link 100"/>
<node pkg="tf" type="static_transform_publisher" name="base_link_2_laser_link" args="0.256 0 0.0925 0 0 0 1 /base_link /laser 100"/>

<arg name="scan_topic" default="scan" />
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
    <param name="base_frame" value="/base_link" />
    <param name="odom_frame" value="/odom" />
    <param name="map_update_interval" value="5.0"/>
    <param name="maxUrange" value="6.0"/>
    <param name="maxRange" value="8.0"/>        
    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="lskip" value="0"/>
    <!--<param name="minimumScore" value="100"/> -->
    <param name="srr" value="0.01"/>
    <param name="srt" value="0.02"/>
    <param name="str" value="0.01"/>
    <param name="stt" value="0.02"/>
    <param name="linearUpdate" value="0.5"/>
    <param name="angularUpdate" value="0.436"/>
    <param name="temporalUpdate" value="1"/>
    <param name="resampleThreshold" value="0.5"/>
    <param name="particles" value="50"/>          <!--xxxxxxxxxxx-->

    <param name="xmin" value="-100.0"/>
    <param name="ymin" value="-100.0"/>
    <param name="xmax" value="100.0"/>
    <param name="ymax" value="100.0"/>

    <param name="delta" value="0.05"/>
    <param name="llsamplerange" value="0.01"/>
    <param name="llsamplestep" value="0.01"/>
    <param name="lasamplerange" value="0.005"/>
    <param name="lasamplestep" value="0.005"/>
    <param name="transform_publish_period" value="0.05"/>
    <remap from="scan" to="$(arg scan_topic)"/>
</node>

</launch>

My urdf model

<robot name="robot_seldat">

<link name="base_link" >
    <visual>
        <geometry>
            <box size="0.642 0.81 0.7"/> <!--kich thuoc robot-->
        </geometry>
        <origin rpy="0 0 0" xyz="-0.158 0 0.35"/> <!--vi tri so voi base link-->
        <material name="magenta"> <!--blue 0 0 255 0.6-->
            <color rgba="192 192 192 0.3"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="0.642 0.81 0.7"/>
        </geometry>
    </collision>
    <inertial>
        <mass value="100"/>
        <inertia ixx="1.0" ixy="0.0" ixz="0.0 ...
(more)
edit retag flag offensive close merge delete

Comments

Can you edit your question to add more details about what you want and compare to what you're seeing different? Also please try provide more context so we might be able to reproduce your problem.

tfoote gravatar image tfoote  ( 2016-10-29 18:22:29 -0500 )edit

Thankyou tfoote I want to use navigation stack for my real robot. But first, i want to create a map using gmapping. I have a real robot and urdf model of it. I created a launch file as above and run along with urdf model. Here the video of my robot.

NguyenPham gravatar image NguyenPham  ( 2016-10-30 22:39:16 -0500 )edit

Perhaps you could post a picture of your tf tree by running rosrun tf view_frames. If I had to guess I would say that use of static_transform_publisher might be causing the issue. The tf from /odom to /base_link should come from an odometry source like wheel encoders.

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2016-11-02 21:25:32 -0500 )edit
1

Thanks shoemakerlevy9. I fixed the problem. Just remove the line "<node pkg="tf" type="static_transform_publisher" name="odom_2_base_link" args="0 0 0 0 0 0 /odom /base_link 100"/>" and the robot work fine. I think the problem come from my odometry node. It's also publish the tf of odom and baselink

NguyenPham gravatar image NguyenPham  ( 2016-11-02 21:57:23 -0500 )edit