Using robot localization to fuse sensor data in your robot

Now, we have our robot and we have different sources that can be used to localize the robot such as the wheel encoders and the 9DoF Razor IMU. We are going to install a new package to combine the data from these sensors to improve our robot position estimation. The package robot_localization use an Extended Kalman Filter (EKF) to calculate the new estimation using data from multiple sensors.

To install this package, we will type the following command in a terminal:

    $ sudo apt-get install ros-kinetic-robot-localization
  

Once we have installed this package, the next step is learning how to use it. So, we are going to explore inside the package, a launch file named ekf_template.launch:

    $ rosed robot_localization ekf_template.launch
  

When the file is opened, we will see the following code:

<launch> 
  <node pkg="robot_localization" type="ekf_localization_node" 
name="ekf_se" clear_params="true"> <rosparam command="load" file="$(find
robot_localization)/params/ekf_template.yaml" /> <!-- Placeholder for output topic remapping <remap from="odometry/filtered" to=""/> --> </node> </launch>

And we will see the code in order to launch the ekf_localization_node and load some parameters that are saved in ekf_template.yaml. The yaml file is similar to this format:

#Configuation for robot odometry EKF 
# 
frequency: 50 
 
odom0: /odom 
odom0_config: [false, false, false, 
false, false, false, 
true, true, true, 
false, false, true, 
false, false, false] 
odom0_differential: false 
 
imu0: /imu_data 
imu0_config: [false, false, false, 
false, false, true, 
false, false, false, 
false, false, true, 
true, false, false] 
imu0_differential: false 
 
odom_frame: odom 
base_link_frame: base_footprint 
world_frame: odom 

In this file, we define the name of our IMU topic, our odometry topic, also thebase_link_frame. The EKF filter uses only data from the IMU and odometry topics that are selected by a 6 x 3 matrix filled with true or false.

We are going to save this yaml file in chapter8_tutorials/config with the name robot_localization.yaml, and we are going to create a new launch file in the launch folder of the chapter named robot_localization.yaml:

<launch> 
  <node pkg="robot_localization" type="ekf_localization_node" 
name="ekf_localization"> <rosparam command="load" file="$(find
chapter8_tutorials)/config/robot_localization.yaml" /> </node> </launch>

Now, we have finished the code of our robot and we can test all the parts:

    $ roscore
    $ rosrun rosserial_python serial_node.py /dev/ttyACM0
    $ roslaunch razor_imu_9dof razor-pub-and-display.launch
    $ roslaunch chapter8_tutorials chapter8_robot_encoders.launch
    $ roslaunch chapter8_tutorials robot_localization
  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.179.43