Robotics StackExchange | Archived questions

Robot (base_link) facing opposite direction - 180 Degrees

Hello all,

I am new to ROS, currently trying to implement autonomous navigation. I used Hectorslam to build my map, I discovered that the robot faces the opposite direction (180 degrees) away from the map. Please see attached pictures [images]. (https://docs.google.com/document/d/1wf0ERJsyATlpF_AsNLKduKk9rQsv9Z7DiZpVuEmO0I/edit?usp=sharing) 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"?>

<launch>
  <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>

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

</launch>

LaserScanmatcher Launch file: <

 <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>

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

AMCL Launch file:

<launch>
<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" value="0.05"/>
  <param name="kld_z" value="0.99"/>
  <param name="odom_alpha1" value="0.2"/>
  <param name="odom_alpha2" value="0.2"/>
  <!-- translation std dev, m -->
  <param name="odom_alpha3" value="0.8"/>
  <param name="odom_alpha4" value="0.2"/>
  <param name="laser_z_hit" value="0.5"/>
  <param name="laser_z_short" value="0.05"/>
  <param name="laser_z_max" value="0.05"/>
  <param name="laser_z_rand" value="0.5"/>
  <param name="laser_sigma_hit" value="0.2"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_model_type" value="likelihood_field"/>
  <!-- <param name="laser_model_type" value="beam"/> -->
  <param name="laser_likelihood_max_dist" value="2.0"/>
  <param name="update_min_d" value="0.2"/>
  <param name="update_min_a" value="0.5"/>
  <param name="odom_frame_id" value="odom"/>
  <param name="resample_interval" value="1"/>
  <param name="transform_tolerance" value="0.1"/>
  <param name="recovery_alpha_slow" value="0.0"/>
  <param name="recovery_alpha_fast" value="0.0"/>
</node>


</launch>

Asked by femitof on 2020-03-12 01:03:48 UTC

Comments

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

Asked by femitof on 2020-03-12 01:04:47 UTC

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

Asked by Delb on 2020-03-12 03:07:16 UTC

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

Thanks for the response @Delb

Asked by femitof on 2020-03-12 09:39:33 UTC

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.

Asked by Delb on 2020-03-13 02:55:22 UTC

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

Asked by femitof on 2020-03-16 15:05:18 UTC

@Delb posted as requested.. Thanks

Asked by femitof on 2020-03-16 15:13:14 UTC

@Delb waiting on your response.. Please

Asked by femitof on 2020-03-18 13:13:51 UTC

Answers