ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Visualize robot in gmapping

asked 2016-05-11 14:20:49 -0500

Bert gravatar image

updated 2016-05-12 03:52:20 -0500

Hi

I have gmapping working for my mobile robot. image description

Now I can see the position of my robot by visualizing tf, so that I can see the base link and laser. But I want to see a simplified version of my robot, a rectangle should do, but how do I get this?

Thanks!

EDIT: This is my current launch file:

<?xml version="1.0"?>

<launch>

<!-- start hokuyo_node -->
<node name="hokuyo_node" pkg="hokuyo_node" type="hokuyo_node" output="screen"/>

  <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
  <arg name="base_frame" default="base_footprint"/>
  <arg name="odom_frame" default="nav"/>
  <arg name="pub_map_odom_transform" default="true"/>
  <arg name="scan_subscriber_queue_size" default="5"/>
  <arg name="scan_topic" default="scan"/>
  <arg name="map_size" default="2048"/>


<!-- start odometry_node -->
<node name="odometry" pkg="mastering_ros_demo_pkg" type="odometry" output="screen"/> 


<!-- start g_mapping -->
<node name="slam_gmapping" pkg="gmapping" type="slam_gmapping" output="screen">
    <param name="ogain" value="10"/>        <!-- default 3 -->
    <param name="throttle_scans" value="1"/> 
    <param name="map_update_interval" value="1"/>    
    <param name="iterations" value="20"/>       <!-- default 5 -->
    <param name="lsigma" value="0.075"/>    <!-- default 0.075 -->
    <param name="delta" value="0.03"/>      <!-- default 0.05 -->
    <param name="linearUpdate" value="0.5"/>    <!-- default 1.0 -->
    <param name="angularUpdate" value="0.5"/>   <!-- default 0.5 -->
</node>


    <!-- Frame names -->
    <param name="map_frame" value="map" />
<!--    
<param name="base_frame" value="$(arg base_frame)" />
    <param name="odom_frame" value="$(arg odom_frame)" />
-->

    <param name="base_frame" value="base_frame" />
    <param name="odom_frame" value="base_frame" />

    <!-- Tf use -->   
    <param name="use_tf_scan_transformation" value="true"/>
    <param name="use_tf_pose_start_estimate" value="false"/>
<!--
 <param name="pub_map_odom_transform" value="$(arg pub_map_odom_transform)"/>
-->
     <param name="pub_map_odom_transform" value="true"/>
    <!-- Map size / start point -->
    <param name="map_resolution" value="0.010"/>
    <param name="map_size" value="$(arg map_size)"/>
    <param name="map_start_x" value="0.5"/>
    <param name="map_start_y" value="0.5" />
    <param name="map_multi_res_levels" value="2" />

    <!-- Map update parameters -->
    <param name="update_factor_free" value="0.4"/>
    <param name="update_factor_occupied" value="0.9" />    
    <param name="map_update_distance_thresh" value="0.4"/>
    <param name="map_update_angle_thresh" value="0.06" />
    <param name="laser_z_min_value" value = "-1.0" />
    <param name="laser_z_max_value" value = "1.0" />

    <!-- Advertising config --> 
    <param name="advertise_map_service" value="true"/>

    <param name="scan_subscriber_queue_size" value="$(arg scan_subscriber_queue_size)"/>
    <param name="scan_topic" value="$(arg scan_topic)"/>

    <!-- Debug parameters -->
    <!--
      <param name="output_timing" value="false"/>
      <param name="pub_drawings" value="true"/>
      <param name="pub_debug_output" value="true"/>
    -->
    <param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)" />
  <!--
</node>
-->    
  <node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="-0.45 0 0 3.1765 0 3.1415 /base_link /laser 100"/>



 <node pkg="rviz" type="rviz" name="rviz"/>
</launch>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-05-11 18:06:21 -0500

curranw gravatar image

updated 2016-05-12 12:18:08 -0500

If you add the robot model to the topics you are visualizing in RViz, you'll be able to see whatever model is represented by the parameter "robot_description". This is your URDF file.

If you are using a pre-built robot (i.e. turtlebot) this is usually set for you.

If you are using a custom robot, you'll need to set it yourself in your launch file. Here is an example:

<param name="robot_description" command="$(find xacro)/xacro.py '$(find pkg_name)/urdf/robot_urdf.xacro'" />

If you are not running xacro, the command is similar:

<param name="robot_description" command="cat $(find pkg_name)/urdf/robot_urdf.urdf" />

Since you are able to see the robot tf frames, I assume you're running robot_state_publisher and robot_joint_publisher. Both of these use the robot_description parameter, so it is likely to already be set.

edit flag offensive delete link more

Comments

Do I need the xacro file? Or can I just work with my urdf file?

Bert gravatar image Bert  ( 2016-05-12 03:46:00 -0500 )edit

You do not need the xacro file. xacro is just really useful for URDF files, it allows you to parameterize them. I'll change my answer accordingly.

curranw gravatar image curranw  ( 2016-05-12 12:17:10 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-11 14:20:49 -0500

Seen: 459 times

Last updated: May 12 '16