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

Trouble getting my robot to move in rviz

asked 2023-05-08 21:44:34 -0500

Love Fist gravatar image

Hi I am new to ROS. I am having issues getting my robot to move in rviz. When I use the 2d Nav goal, i see that the tf for my front wheels rotate but my robot doesn't move in rviz. My robot however rotates in gazebo. A bit about my setup.

  1. I am using the differential_drive_controller gazebo plugin
  2. i use the hector_mapping node to publish my odom topic (scanmatch_odom)
  3. scanmatch_odom is used in my amcl launch file

Here are some of my launch files:

Hector mapping file

<launch> <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/> <arg name="base_frame" default="base_link"/> <arg name="odom_frame" default="scanmatch_odom"/> <arg name="pub_map_odom_transform" default="false"/> <arg name="scan_subscriber_queue_size" default="5"/> <arg name="scan_topic" default="scan"/> <arg name="map_size" default="2048"/> <arg name="pub_odometry" default="true"/>

<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">

<!-- Frame names -->
<remap from="map" to="hector_map" />
<param name="map_frame" value="hector_map_frame" />
<param name="base_frame" value="$(arg base_frame)" />
<param name="odom_frame" value="$(arg odom_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)"/>

<!-- Map size / start point -->
<param name="map_resolution" value="0.050"/>
<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 0 0 0 0 0 map 100"/>


AMCL file <launch>

<node pkg="amcl" type="amcl" name="amcl">

    <remap from="scan" to="scan" />
    <param name="odom_model_type" value="diff" />
    <param name="transform_tolerance" value="0.2" />
    <param name="gui_publish_rate" value="-1.0"/>
    <param name="laser_max_beams" value="30"/>
    <param name="laser_max_range" value="29.5"/>
    <param name="min_particles" value="3"/>
    <param name="max_particles" value="20"/>
    <param name="update_min_d" value="0.01"/>
    <param name="kld_err" value="0.01"/>
    <param name="kld_z" value="0.99"/>
    <param name="odom_alpha1" value="0.2"/>
    <param name="odom_alpha2" value="0.2"/>
    <param name="odom_alpha3" value="0.2"/>
    <param name="odom_alpha4" value="0.2"/>
    <param name="odom_alpha5" value="0.2"/>
    <param name="laser_z_hit" value="0.95"/>
    <param name="laser_z_short" value="0.1"/>
    <param name="laser_z_max" value ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-06-27 20:52:00 -0500

The hector_mapping node needs subscribe your odom topic rather than "publish".

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2023-05-08 21:33:40 -0500

Seen: 77 times

Last updated: May 08 '23