Localization issues with Encoder

asked 2020-03-27 13:52:40 -0500

femitof gravatar image

Hi,

I am quite new to using ROS, I have been able to successfully do localization with Laser_scan_matcher using the Lidar and the map (hector_slam) and it gives me accurate localization.. ( see atatched: https://drive.google.com/file/d/18U5x... )

However, I am now trying to use ROS_ARDUINO_BRIDGE for autonomous navigation which publishes cmd_velocity and odometry data from the encoders, this distorts localization and scatters the pose arrays and shakes it ( see attached: https://drive.google.com/file/d/1O4y5...)

How can i resolve this, it is killing me>> Someone please help

See my various launch files below:

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>

Laser_Scan_matcher Launch file: < <launch>

 <launch>

   <arg name="IS_TWISTSTAMPED" default="true" />
    <arg name="publish_covariance" default="false"/> 

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

    <group if="$(arg publish_covariance)">
<param name="laser_scan_matcher_node/do_compute_covariance" value="1"/>
<param name="laser_scan_matcher_node/publish_pose_with_covariance" value="true"/>
<param name="laser_scan_matcher_node/publish_pose_with_covariance_stamped" value="true"/>
   </group>

    <param name="fixed_frame" value="odom"/>
    <param name="max_iterations" value="10"/>
    <param name="use_odom" value="true"/>

  </node>

</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 ...
(more)
edit retag flag offensive close merge delete

Comments

@Namal Senarathne@Delb Please assist if you can.. Thanks

femitof gravatar image femitof  ( 2020-03-27 14:04:58 -0500 )edit

@tom Moore Can you please help with this? The ROS_Arduino_bridge publishes a TF from Odom to baselink, and the Laser_Scan_Matcher also publishes another Odom to Baselink TF?..

any ideas how i can combine this

This disrupts the Localization and makes it jump and shake

I am be stuck here.. Please help

femitof gravatar image femitof  ( 2020-03-28 02:04:19 -0500 )edit

You've already identified the problem it sounds like. You have two nodes publishing the same TF and ODOM. If You have encoder why would you use Laser scan matcher? Or if laser scan matcher works well, why would you use encoder? Pick one.

billy gravatar image billy  ( 2020-03-28 13:43:38 -0500 )edit

@billy..i tried localization using encoders but it was stuck in one position and not moving.. ANy ideas how to get that working (encoders and AMCL), as i believe this would solve the problem and i wont run mad anymore

pleaseee

femitof gravatar image femitof  ( 2020-03-28 14:21:18 -0500 )edit

Not moving on the floor or not moving in RVIZ? The node that does ODOM needs to publish both a TF and a ODOM topic, and then only one node should be doing that. So if you're trying to use the encoder, make sure the encoder node is publishing TF and ODOM topic and and tele-op the robot around and make sure the data is consistent with actual movement. And make sure Laser Scan Matcher isn't running.

billy gravatar image billy  ( 2020-03-28 14:39:55 -0500 )edit

Not moving in RVIZ...just stationary even when the robot is moving in reality...

Yeah, the ODOM publishes both a TF (odom to base link) and odom topic resolution... but it Still doesnt move in RVIZ

femitof gravatar image femitof  ( 2020-03-28 14:56:40 -0500 )edit

@billy Hi... See screenshots of my RQT_graph and RViz - how it stays stationary in RVIZ.(RVIZ.

RQT_graph

Please help check..Thanks

femitof gravatar image femitof  ( 2020-03-29 02:48:51 -0500 )edit

Your graph looks correct. If you watch the ODOM topic while moving the robot around, does the pose and twist make sense? If you watch the TF while moving, does it also make senses?

billy gravatar image billy  ( 2020-03-29 03:46:06 -0500 )edit