Robot (base_link) facing opposite direction - 180 Degrees

asked 2020-03-12 01:03:48 -0500

femitof gravatar image

updated 2020-03-16 15:12:56 -0500

Hello all,

I am new to ROS, currently trying to implement autonomous navigation. I used Hector_slam to build my map, I discovered that the robot faces the opposite direction (180 degrees) away from the map. Please see attached pictures [images]. ( Also when initially setting a navigation goal, the wheelchair keeps turning in circles and cannot move to destination.

Hector SLAM - launch file

<?xml version="1.0"?>

  <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
  <arg name="base_frame" default="base_link"/>
  <arg name="odom_frame" default="base_link"/>
  <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"/>

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

    <!-- Frame names -->
    <param name="map_frame" value="map" />
    <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 pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 100" />


Laser_Scan_matcher Launch file: < <launch>

 <node pkg="laser_scan_matcher" type="laser_scan_matcher_node" 
    name="laser_scan_matcher_node" output="screen">

    <param name="base_frame" value="base_link"/>
    <param name="fixed_frame" value="odom"/>
    <param name="use_alpha_beta" value="false"/>
    <param name="use_odom" value="true"/>
    <param name="use_imu" value="false"/>
    <param name="max_iterations" value="4"/>
    <param name="publish_pose" value="true"/>
    <param name="publish_tf" value="true"/>


  <node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 100" />

AMCL Launch file:

<node pkg="amcl" type="amcl" name="amcl" output="screen">
  <!-- Publish scans from best pose at a max of 10 Hz -->
  <param name="odom_model_type" value="diff"/>
  <param name="odom_alpha5" value="0.1"/>
  <param name="transform_tolerance" value="0.2" />
  <param name="gui_publish_rate" value="10.0"/>
  <param name="laser_max_beams" value="30"/>
  <param name="min_particles" value="500"/>
  <param name="max_particles" value="5000"/>
  <param name="kld_err ...
edit retag flag offensive close merge delete


@Namal Senarathne please can you assist if possible. Thank you very much I am stuck.

femitof gravatar image femitof  ( 2020-03-12 01:04:47 -0500 )edit

Can you show your urdf file please ? Also if you are using a tf publisher/broadcaster please include it too.

Delb gravatar image Delb  ( 2020-03-12 03:07:16 -0500 )edit

by urdf file, do you mean launch files or the cpp files?

Thanks for the response @Delb

femitof gravatar image femitof  ( 2020-03-12 09:39:33 -0500 )edit

I mean your robot model, you should have a file with the extension .urdf (that should be used to set the parameter robot_description of your launch file). Your launch file could be useful if you launch some static_transform_publisher nodes.

Delb gravatar image Delb  ( 2020-03-13 02:55:22 -0500 )edit

I have no ".urdf' files.. please see above my launch files. Thanks

femitof gravatar image femitof  ( 2020-03-16 15:05:18 -0500 )edit

@Delb posted as requested.. Thanks

femitof gravatar image femitof  ( 2020-03-16 15:13:14 -0500 )edit

@Delb waiting on your response.. Please

femitof gravatar image femitof  ( 2020-03-18 13:13:51 -0500 )edit