Robotics StackExchange | Archived questions

Trouble getting my robot to move in rviz

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 differentialdrivecontroller gazebo plugin
  2. i use the hectormapping node to publish my odom topic (scanmatchodom)
  3. scanmatch_odom is used in my amcl launch file

Here are some of my launch files:

Hector mapping file

<!-- 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)" />

AMCL file

    <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="0.05"/>
    <param name="laser_z_rand" value="0.05"/>
    <param name="laser_sigma_hit" value="0.2"/>
    <param name="laser_lambda_short" value="0.1"/>
    <param name="laser_model_type" value="likelihood_field"/>
    <param name="laser_likelihood_max_dist" value="2.0"/>
    <param name="update_min_a" value="0.5"/>
    <param name="resample_interval" value="2"/>
    <param name="transform_tolerance" value="0.1"/>
    <param name="recovery_alpha_slow" value="0.0"/>
    <param name="recovery_alpha_fast" value="0.0"/>
  </node>

Main Launch file (bringup) <!-- Arguments -->

<!-- Map server -->

<!-- AMCL -->

<!-- movebase --> <include file="$(find libotdescription)/launch/movebase2.launch"/>

<!-- rviz --> <node pkg="rviz" type="rviz" name="rviz" args="-d $(find libot_description)/launch/navigation.rviz" required="true"

/>  

Movebase file

<!-- Arguments -->

<!-- movebase --> <node pkg="movebase" type="movebase" respawn="false" name="movebase" output="screen">

<rosparam file="$(find libot_description)/param/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find libot_description)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find libot_description)/param/local_costmap_params.yaml" command="load" />
<rosparam file="$(find libot_description)/param/global_costmap_params.yaml" command="load" />
<rosparam file="$(find libot_description)/param/move_base_params.yaml" command="load" />
<rosparam file="$(find libot_description)/param/dwa_local_planner_params.yaml" command="load" />
<remap from="cmd_vel" to="$(arg cmd_vel_topic)"/>
<remap from="odom" to="$(arg odom_topic)"/>

I would appreciate any help I can get. Thanks

Asked by Love Fist on 2023-05-08 21:33:40 UTC

Comments

Answers

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

Asked by MichaelShuo on 2023-06-27 20:52:00 UTC

Comments