# Revision history [back]

### How to use robot_localization /odometry/filtered

So I have two robot_localization nodes setup. The first fuses the vehicle odometry and the imu data. The second will add in GPS and hector_slam pose estimates.

My question is, should I fuse the output of the first node (/odometry/filtered) into the second node or should I re-fuse the vehicle odometry and imu data? If the former, the second (map) robot_localization node never publishes anything if I fuse the output of the first directly. (Also, the navsat node doesn't work with the /odometry/filtered data either).

Here is a sample /odometry/filtered message (output from the first node).

header:
seq: 235
stamp:
secs: 1455846048
nsecs: 782704923
frame_id: odom
pose:
pose:
position:
x: 0.060692385786
y: 8.51043448483e-06
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 7.45214107357e-05
w: 0.999999997223
covariance: [0.39148006559512866, -1.0221015344746652e-08, 0.0, 0.0, 0.0, 7.160358808761269e-08, -1.0221015344746746e-08, 0.39152977031124553, 0.0, 0.0, 0.0, 6.453229401104118e-05, 0.0, 0.0, 3.332912064876806e-07, 1.341899911334871e-24, 5.233156817556127e-19, 0.0, 0.0, 0.0, 1.3418999113348712e-24, 3.3324912207294784e-07, -1.6669589116712293e-32, 0.0, 0.0, 0.0, 5.233156817556124e-19, -1.6669590914679116e-32, 3.3324912207294784e-07, 0.0, 7.160358808761269e-08, 6.453229401104114e-05, 0.0, 0.0, 0.0, 0.0773158946732772]
twist:
twist:
linear:
x: -0.000285365096838
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 5.54621444365e-05
covariance: [0.0019138416154638686, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0019138416154638686, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.332701589929017e-07, 1.9950504214512513e-31, 1.2764323815697058e-27, 0.0, 0.0, 0.0, 1.9950504214512495e-31, 3.330812024673111e-07, -1.34664748772665e-39, 0.0, 0.0, 0.0, 1.276432381569705e-27, -1.5229681057398406e-38, 3.330812024673111e-07, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.04978277263316132]


And here is my localization launch file ...

<!-- Launch file for ekf_localization_node -->

<!-- Layer 1 Localization: Odometry Frame -->
<launch>
<node pkg="tf" type="static_transform_publisher" name="tach_odom123" args="0 0 0 0 0 0 1 odom tach_odom 100" />
<node pkg="rsl_rover" type="imu_overrid_covariance.py" name="IOC" />
<!--    <node pkg="rsl_rover" type="virt_yaw_sensor.py" name="VirtYaw" output="screen"/> -->
<node pkg="imu_complementary_filter" type="complementary_filter_node" name="complementary_filter_node" >
<remap from="imu/data_raw" to="imu/data_cov" />
<remap from="imu/mag" to="imu/mag" />
<remap from="imu/data" to="imu/data_filtered" />
<param name="do_bias_estimation" value="true"/>
<param name="use_mag" value="false"/>
<param name="gain_acc" value="0.01"/>
<param name="gain_mag" value="0.01"/>
</node>

<!-- This node will take in measurements from odometry, IMU, stamped pose, and stamped twist messages. It tracks
the state of the robot, with the state vector being defined as X position, Y position, Z position,
roll, pitch, yaw, their respective velocites, and linear acceleration. Units for all measurements are assumed
to conform to the SI standard as specified in REP-103. -->
<node pkg="robot_localization" type="ekf_localization_node" name="odom_localization" clear_params="true" output="screen">

<!-- ======== STANDARD PARAMETERS ======== -->

<!-- The frequency, in Hz, at which the filter will output a position estimate. Note that
the filter will not begin computation until it receives at least one message from
one of the inputs. It will then run continuously at the frequency specified here,
regardless of whether it receives more measurements. Defaults to 30 if unspecified. -->
<param name="frequency" value="30"/>

<!-- The period, in seconds, after which we consider a sensor to have timed out. In this event, we
carry out a predict cycle on the EKF without correcting it. This parameter can be thought of
as the minimum frequency with which the filter will generate new output. Defaults to 1 / frequency
if not specified. -->
<param name="sensor_timeout" value="0.1"/>

<!-- If this is set to true, no 3D information will be used in your state estimate. Use this if you
are operating in a planar environment and want to ignore the effect of small variations in the
ground plane that might otherwise be detected by, for example, an IMU. Defaults to false if
unspecified. -->
<param name="two_d_mode" value="true"/>

<!-- REP-105 (http://www.ros.org/reps/rep-0105.html) specifies three principal coordinate frames: map,
odom, and base_link. base_link is the coordinate frame that is affixed to the robot. The robot's
position in the odom frame will drift over time, but is accurate in the short term and should be
continuous. The odom frame is therefore the best frame for executing local motion plans. The map
frame, like the odom frame, is a world-fixed coordinate frame, and while it contains the most
globally accurate position estimate for your robot, it is subject to discrete jumps, e.g., due to
the fusion of GPS data. Here is how to use the following settings:
1. Set the map_frame, odom_frame, and base_link frames to the appropriate frame names for your system.
* If your system does not have a map_frame, just remove it, and make sure "world_frame" is set
to the value of odom_frame.
2. If you are fusing continuous position data such as wheel encoder odometry, visual odometry, or IMU data,
set "world_frame" to your odom_frame value. This is the default behavior for robot_localization's state
estimation nodes.
3. If you are fusing global absolute position data that is subject to discrete jumps (e.g., GPS or position
3b. MAKE SURE something else is generating the odom->base_link transform. Note that this can even be
another instance of robot_localization! However, that instance should *not* fuse the global data. -->
<!-- Defaults to "map" if unspecified -->
<param name="map_frame" value="map"/>
<!-- Defaults to "odom" if unspecified -->
<param name="odom_frame" value="odom"/>
<!-- Defaults to "base_link" if unspecified -->
<!-- Defaults to the value of "odom_frame" if unspecified -->
<param name="world_frame" value="odom"/>

<!-- Use this parameter to provide an offset to the transform generated by ekf_localization_node. This
can be used for future dating the transform, which is required for interaction with some other
packages. Defaults to 0.0 if unspecified. -->
<param name="transform_time_offset" value="0.0"/>

<!-- The filter accepts an arbitrary number of inputs from each input message type (Odometry, PoseStamped,
TwistStamped, Imu). To add a new one, simply append the next number in the sequence to its base name,
e.g., odom0, odom1, twist0, twist1, imu0, imu1, imu2, etc. The value should be the topic name. These
parameters obviously have no default values, and must be specified. -->
<param name="odom0" value="/VehicleTach"/>
<!--      <param name="odom1" value="/VirtYaw"/> -->
<param name="imu0" value="imu/data_filtered"/>

<!-- Each sensor reading updates some or all of the filter's state. These options give you greater control over
which values from each measurement are fed to the filter. For example, if you have an odometry message as input,
but only want to use its Z position value, then set the entire vector to false, except for the third entry.
The order of the values is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Note that not some
message types lack certain variables. For example, a TwistWithCovarianceStamped message has no pose information, so
the first six values would be meaningless in that case. Each vector defaults to all false if unspecified, effectively
making this parameter required for each sensor. -->
<rosparam param="odom0_config">[false, false, false,
false, false, false,
true,  true, false,
false, false, false,
false, false, false]</rosparam>

<!--      <rosparam param="odom1_config">[false, false, false,
false, false, false,
false,  false, false,
false, false, true,
false, false, false]</rosparam> -->

<rosparam param="imu0_config">[false, false, false,
true,  true,  true,
false, false, false,
false,  false,  false,
false,  false,  false]</rosparam>

<!-- The best practice for including new sensors in robot_localization's state estimation nodes is to pass in velocity
measurements and let the nodes integrate them. However, this isn't always feasible, and so the state estimation
nodes support fusion of absolute measurements. If you have more than one sensor providing absolute measurements,
however, you may run into problems if your covariances are not large enough, as the sensors will inevitably
diverge from one another, causing the filter to jump back and forth rapidly. To combat this situation, you can
either increase the covariances for the variables in question, or you can simply set the sensor's differential
parameter to true. When differential mode is enabled, all absolute pose data is converted to velocity data by
differentiating the absolute pose measurements. These velocities are then integrated as usual. NOTE: this only
applies to sensors that provide absolute measurements, so setting differential to true for twit measurements has
no effect.

Users should take care when setting this to true for orientation variables: if you have only one source of
absolute orientation data, you should not set the differential parameter to true. This is due to the fact that
integration of velocities leads to slowly increasing error in the absolute (pose) variable. For position variables,
this is acceptable. For orientation variables, it can lead to trouble. Users should make sure that all orientation
variables have at least one source of absolute measurement. -->
<param name="odom0_differential" value="false"/>
<!--      <param name="odom1_differential" value="false"/> -->
<param name="imu0_differential" value="false"/>

<!-- When the node starts, if this parameter is true, then the first measurement is treated as a "zero point" for all
future measurements. While you can achieve the same effect with the differential paremeter, the key difference is
that the relative parameter doesn't cause the measurement to be converted to a velocity before integrating it. If
you simply want your measurements to start at 0 for a given sensor, set this to true. -->
<param name="odom0_relative" value="false"/>
<!--      <param name="odom1_relative" value="false"/> -->
<param name="imu0_relative" value="true"/>

<!-- If we're including accelerations in our state estimate, then we'll probably want to remove any acceleration that
is due to gravity for each IMU. If you don't want to, then set this to false. Defaults to false if unspecified. -->
<param name="imu0_remove_gravitational_acceleration" value="false"/>

<!-- If you're having trouble, try setting this to true, and then echo the /diagnostics_agg topic to see
if the node is unhappy with any settings or data. -->
<param name="print_diagnostics" value="true"/>

<!-- ======== ADVANCED PARAMETERS ======== -->

<!-- Most users will be able to remove these parameters from the launch file without any consequences. We recommend
that users do not set values for these parameters without having a thorough understanding of
the parameters do. -->

<!-- By default, the subscription queue size for each message type is 1. If you wish to increase that so as not
miss any messages (even if your frequency is set to a relatively small value), increase these. -->
<param name="odom0_queue_size" value="2"/>
<!--<param name="odom1_queue_size" value="2"/> -->
<param name="imu0_queue_size" value="10"/>

<!-- If your data is subject to outliers, use these threshold settings, expressed as Mahalanobis distances, to control
how far away from the current vehicle state a sensor measurement is permitted to be. Each defaults to
numeric_limits<double>::max() if unspecified. -->
<param name="odom0_pose_rejection_threshold" value="5"/>
<param name="odom0_twist_rejection_threshold" value="1"/>
<!--      <param name="odom1_pose_rejection_threshold" value="5"/>
<param name="odom1_twist_rejection_threshold" value="1"/> -->
<param name="imu0_pose_rejection_threshold" value="0.3"/>
<param name="imu0_twist_rejection_threshold" value="0.1"/>
<param name="imu0_linear_acceleration_rejection_threshold" value="0.1"/>

<!-- Debug settings. Not for the faint of heart. Outputs a ludicrous amount of information to the file
specified by debug_out_file. I hope you like matrices! Defaults to false if unspecified. -->
<param name="debug"           value="false"/>
<!-- Defaults to "robot_localization_debug.txt" if unspecified. -->
<param name="debug_out_file"  value="debug_ekf_localization.txt"/>

<!-- The process noise covariance matrix can be difficult to tune, and can vary for each application, so it
is exposed as a configuration parameter. The values are ordered as x, y, z, roll, pitch, yaw, vx, vy, vz,
vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if unspecified. -->
<rosparam param="process_noise_covariance">[0.05, 0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0.05, 0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0.06, 0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0.03, 0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0.06, 0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0.025, 0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0.025, 0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0.04, 0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0.01, 0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0.01, 0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0.02, 0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0.01, 0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0.01, 0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0.015]</rosparam>

<!-- This represents the initial value for the state estimate error covariance matrix. Setting a diagonal value (a
variance) to a large value will result in early measurements for that variable being accepted quickly. Users should
take care not to use large values for variables that will not be measured directly. The values are ordered as x, y,
z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if unspecified. -->
<rosparam param="initial_estimate_covariance">[1e-9, 0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    1e-9, 0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    1e-9, 0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    1e-9, 0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    1e-9, 0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    1e-9, 0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    1e-9, 0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    1e-9, 0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    1e-9, 0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    1e-9,  0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     1e-9,  0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     1e-9,  0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     1e-9, 0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    1e-9, 0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    1e-9]</rosparam>

<!--  Placeholder for output topic remapping
<remap from="odometry/filtered" to=""/>
-->

</node>

<node pkg="robot_localization" type="navsat_transform_node" name="navsat_transform_node" respawn="false" output="screen">

<param name="yaw_offset" value="0"/>
<remap from="/imu/data" to="/imu/data" />
<remap from="/gps/fix" to="/fix" />
<remap from="/odometry/filtered" to="/odometry/filtered" />

</node>

<!-- Layer 2 Localization: Map Frame -->
<node pkg="robot_localization" type="ekf_localization_node" name="map_localization" clear_params="true" output="screen">

<!-- ======== STANDARD PARAMETERS ======== -->

<!-- The frequency, in Hz, at which the filter will output a position estimate. Note that
the filter will not begin computation until it receives at least one message from
one of the inputs. It will then run continuously at the frequency specified here,
regardless of whether it receives more measurements. Defaults to 30 if unspecified. -->
<param name="frequency" value="30"/>

<!-- The period, in seconds, after which we consider a sensor to have timed out. In this event, we
carry out a predict cycle on the EKF without correcting it. This parameter can be thought of
as the minimum frequency with which the filter will generate new output. Defaults to 1 / frequency
if not specified. -->
<param name="sensor_timeout" value="0.1"/>

<!-- If this is set to true, no 3D information will be used in your state estimate. Use this if you
are operating in a planar environment and want to ignore the effect of small variations in the
ground plane that might otherwise be detected by, for example, an IMU. Defaults to false if
unspecified. -->
<param name="two_d_mode" value="true"/>

<!-- REP-105 (http://www.ros.org/reps/rep-0105.html) specifies three principal coordinate frames: map,
odom, and base_link. base_link is the coordinate frame that is affixed to the robot. The robot's
position in the odom frame will drift over time, but is accurate in the short term and should be
continuous. The odom frame is therefore the best frame for executing local motion plans. The map
frame, like the odom frame, is a world-fixed coordinate frame, and while it contains the most
globally accurate position estimate for your robot, it is subject to discrete jumps, e.g., due to
the fusion of GPS data. Here is how to use the following settings:
1. Set the map_frame, odom_frame, and base_link frames to the appropriate frame names for your system.
* If your system does not have a map_frame, just remove it, and make sure "world_frame" is set
to the value of odom_frame.
2. If you are fusing continuous position data such as wheel encoder odometry, visual odometry, or IMU data,
set "world_frame" to your odom_frame value. This is the default behavior for robot_localization's state
estimation nodes.
3. If you are fusing global absolute position data that is subject to discrete jumps (e.g., GPS or position
3b. MAKE SURE something else is generating the odom->base_link transform. Note that this can even be
another instance of robot_localization! However, that instance should *not* fuse the global data. -->
<!-- Defaults to "map" if unspecified -->
<param name="map_frame" value="map"/>
<!-- Defaults to "odom" if unspecified -->
<param name="odom_frame" value="odom"/>
<!-- Defaults to "base_link" if unspecified -->
<!-- Defaults to the value of "odom_frame" if unspecified -->
<param name="world_frame" value="map"/>

<!-- Use this parameter to provide an offset to the transform generated by ekf_localization_node. This
can be used for future dating the transform, which is required for interaction with some other
packages. Defaults to 0.0 if unspecified. -->
<param name="transform_time_offset" value="0.0"/>

<!-- The filter accepts an arbitrary number of inputs from each input message type (Odometry, PoseStamped,
TwistStamped, Imu). To add a new one, simply append the next number in the sequence to its base name,
e.g., odom0, odom1, twist0, twist1, imu0, imu1, imu2, etc. The value should be the topic name. These
parameters obviously have no default values, and must be specified. -->
<param name="odom0" value="/VehicleTach"/>
<param name="imu0" value="imu/data_filtered"/>
<!--      <param name="odom1" value="/odometry/gps" /> -->
<!--      <param name="odom2" value="/VirtYaw" /> -->
<!--<param name="pose0" value="/poseupdate" /> -->

<!-- Each sensor reading updates some or all of the filter's state. These options give you greater control over
which values from each measurement are fed to the filter. For example, if you have an odometry message as input,
but only want to use its Z position value, then set the entire vector to false, except for the third entry.
The order of the values is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Note that not some
message types lack certain variables. For example, a TwistWithCovarianceStamped message has no pose information, so
the first six values would be meaningless in that case. Each vector defaults to all false if unspecified, effectively
making this parameter required for each sensor. -->

<rosparam param="odom0_config">[false, false, false,
false, false, false,
true,  true, false,
false, false, false,
false, false, false]</rosparam>

<rosparam param="imu0_config">[false, false, false,
true,  true,  true,
false, false, false,
false,  false,  false,
false,  false,  false]</rosparam>

<!--      <rosparam param="odom1_config">[true,  true, false,
false, false, false,
false,  false, false,
true, true, false,
false, false, false]</rosparam> -->

<!--      <rosparam param="odom2_config">[false,  false, false,
false, false, false,
false,  false, false,
false, false, true,
false, false, false]</rosparam> -->

<rosparam param="pose0_config">[true,  true, false,
false, false, false,
false,  false, false,
false, false, false,
false, false, false]</rosparam>

<!-- The best practice for including new sensors in robot_localization's state estimation nodes is to pass in velocity
measurements and let the nodes integrate them. However, this isn't always feasible, and so the state estimation
nodes support fusion of absolute measurements. If you have more than one sensor providing absolute measurements,
however, you may run into problems if your covariances are not large enough, as the sensors will inevitably
diverge from one another, causing the filter to jump back and forth rapidly. To combat this situation, you can
either increase the covariances for the variables in question, or you can simply set the sensor's differential
parameter to true. When differential mode is enabled, all absolute pose data is converted to velocity data by
differentiating the absolute pose measurements. These velocities are then integrated as usual. NOTE: this only
applies to sensors that provide absolute measurements, so setting differential to true for twit measurements has
no effect.

Users should take care when setting this to true for orientation variables: if you have only one source of
absolute orientation data, you should not set the differential parameter to true. This is due to the fact that
integration of velocities leads to slowly increasing error in the absolute (pose) variable. For position variables,
this is acceptable. For orientation variables, it can lead to trouble. Users should make sure that all orientation
variables have at least one source of absolute measurement. -->
<param name="odom0_differential" value="false"/>
<param name="imu0_differential" value="false"/>
<!--      <param name="odom1_differential" value="true" /> -->
<param name="odom2_differential" value="false" />
<param name="pose0_differential" value="false"/>

<!-- When the node starts, if this parameter is true, then the first measurement is treated as a "zero point" for all
future measurements. While you can achieve the same effect with the differential paremeter, the key difference is
that the relative parameter doesn't cause the measurement to be converted to a velocity before integrating it. If
you simply want your measurements to start at 0 for a given sensor, set this to true. -->
<param name="odom0_relative" value="false"/>
<param name="imu0_relative" value="true"/>
<!--      <param name="odom1_relative" value="false"/> -->
<param name="odom2_relative" value="false"/>
<param name="pose0_relative" value="false"/>

<!-- If we're including accelerations in our state estimate, then we'll probably want to remove any acceleration that
is due to gravity for each IMU. If you don't want to, then set this to false. Defaults to false if unspecified. -->
<param name="imu0_remove_gravitational_acceleration" value="false"/>

<!-- If you're having trouble, try setting this to true, and then echo the /diagnostics_agg topic to see
if the node is unhappy with any settings or data. -->
<param name="print_diagnostics" value="true"/>

<!-- ======== ADVANCED PARAMETERS ======== -->

<!-- Most users will be able to remove these parameters from the launch file without any consequences. We recommend
that users do not set values for these parameters without having a thorough understanding of
the parameters do. -->

<!-- By default, the subscription queue size for each message type is 1. If you wish to increase that so as not
miss any messages (even if your frequency is set to a relatively small value), increase these. -->
<param name="odom0_queue_size" value="2"/>
<!--      <param name="odom1_queue_size" value="2"/> -->
<!--<param name="odom2_queue_size" value="2"/>-->
<param name="imu0_queue_size" value="10"/>

<!-- If your data is subject to outliers, use these threshold settings, expressed as Mahalanobis distances, to control
how far away from the current vehicle state a sensor measurement is permitted to be. Each defaults to
numeric_limits<double>::max() if unspecified. -->
<param name="odom0_pose_rejection_threshold" value="5"/>
<param name="odom0_twist_rejection_threshold" value="1"/>
<!--      <param name="odom1_pose_rejection_threshold" value="5"/>
<param name="odom1_twist_rejection_threshold" value="1"/> -->
<!--      <param name="odom2_pose_rejection_threshold" value="5"/>
<param name="odom2_twist_rejection_threshold" value="1"/>-->
<param name="imu0_pose_rejection_threshold" value="0.3"/>
<param name="imu0_twist_rejection_threshold" value="0.1"/>
<param name="imu0_linear_acceleration_rejection_threshold" value="0.1"/>

<!-- Debug settings. Not for the faint of heart. Outputs a ludicrous amount of information to the file
specified by debug_out_file. I hope you like matrices! Defaults to false if unspecified. -->
<param name="debug"           value="false"/>
<!-- Defaults to "robot_localization_debug.txt" if unspecified. -->
<param name="debug_out_file"  value="debug_ekf_localization.txt"/>

<!-- The process noise covariance matrix can be difficult to tune, and can vary for each application, so it
is exposed as a configuration parameter. The values are ordered as x, y, z, roll, pitch, yaw, vx, vy, vz,
vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if unspecified. -->
<rosparam param="process_noise_covariance">[0.05, 0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0.05, 0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0.06, 0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0.03, 0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0.06, 0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0.025, 0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0.025, 0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0.04, 0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0.01, 0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0.01, 0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0.02, 0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0.01, 0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0.01, 0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0.015]</rosparam>

<!-- This represents the initial value for the state estimate error covariance matrix. Setting a diagonal value (a
variance) to a large value will result in early measurements for that variable being accepted quickly. Users should
take care not to use large values for variables that will not be measured directly. The values are ordered as x, y,
z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if unspecified. -->
<rosparam param="initial_estimate_covariance">[1e-9, 0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    1e-9, 0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    1e-9, 0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    1e-9, 0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    1e-9, 0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    1e-9, 0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    1e-9, 0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    1e-9, 0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    1e-9, 0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    1e-9,  0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     1e-9,  0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     1e-9,  0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     1e-9, 0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    1e-9, 0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    1e-9]</rosparam>

<remap from="odometry/filtered" to="odometry/filtered_discont"/>

</node>

</launch>


### How to use robot_localization /odometry/filtered

So I have two robot_localization nodes setup. The first fuses the vehicle odometry and the imu data. The second will add in GPS and hector_slam pose estimates.

My question is, should I fuse the output of the first node (/odometry/filtered) into the second node or should I re-fuse the vehicle odometry and imu data? If the former, the second (map) robot_localization node never publishes anything if I fuse the output of the first directly. (Also, the navsat node doesn't work with the /odometry/filtered data either).

Here is a sample /odometry/filtered message (output from the first node).

header:
seq: 235
stamp:
secs: 1455846048
nsecs: 782704923
frame_id: odom
pose:
pose:
position:
x: 0.060692385786
y: 8.51043448483e-06
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 7.45214107357e-05
w: 0.999999997223
covariance: [0.39148006559512866, -1.0221015344746652e-08, 0.0, 0.0, 0.0, 7.160358808761269e-08, -1.0221015344746746e-08, 0.39152977031124553, 0.0, 0.0, 0.0, 6.453229401104118e-05, 0.0, 0.0, 3.332912064876806e-07, 1.341899911334871e-24, 5.233156817556127e-19, 0.0, 0.0, 0.0, 1.3418999113348712e-24, 3.3324912207294784e-07, -1.6669589116712293e-32, 0.0, 0.0, 0.0, 5.233156817556124e-19, -1.6669590914679116e-32, 3.3324912207294784e-07, 0.0, 7.160358808761269e-08, 6.453229401104114e-05, 0.0, 0.0, 0.0, 0.0773158946732772]
twist:
twist:
linear:
x: -0.000285365096838
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 5.54621444365e-05
covariance: [0.0019138416154638686, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0019138416154638686, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.332701589929017e-07, 1.9950504214512513e-31, 1.2764323815697058e-27, 0.0, 0.0, 0.0, 1.9950504214512495e-31, 3.330812024673111e-07, -1.34664748772665e-39, 0.0, 0.0, 0.0, 1.276432381569705e-27, -1.5229681057398406e-38, 3.330812024673111e-07, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.04978277263316132]


And here is my localization launch file ...

<!-- Launch file for ekf_localization_node -->

<!-- Layer 1 Localization: Odometry Frame -->
<launch>
<node pkg="tf" type="static_transform_publisher" name="tach_odom123" args="0 0 0 0 0 0 1 odom tach_odom 100" />
<node pkg="rsl_rover" type="imu_overrid_covariance.py" name="IOC" />
<!--    <node pkg="rsl_rover" type="virt_yaw_sensor.py" name="VirtYaw" output="screen"/> -->
<node pkg="imu_complementary_filter" type="complementary_filter_node" name="complementary_filter_node" >
<remap from="imu/data_raw" to="imu/data_cov" />
<remap from="imu/mag" to="imu/mag" />
<remap from="imu/data" to="imu/data_filtered" />
<param name="do_bias_estimation" value="true"/>
<param name="use_mag" value="false"/>
<param name="gain_acc" value="0.01"/>
<param name="gain_mag" value="0.01"/>
</node>

<!-- This node will take in measurements from odometry, IMU, stamped pose, and stamped twist messages. It tracks
the state of the robot, with the state vector being defined as X position, Y position, Z position,
roll, pitch, yaw, their respective velocites, and linear acceleration. Units for all measurements are assumed
to conform to the SI standard as specified in REP-103. -->
<node pkg="robot_localization" type="ekf_localization_node" name="odom_localization" clear_params="true" output="screen">

<!-- ======== STANDARD PARAMETERS ======== -->

<!-- The frequency, in Hz, at which the filter will output a position estimate. Note that
the filter will not begin computation until it receives at least one message from
one of the inputs. It will then run continuously at the frequency specified here,
regardless of whether it receives more measurements. Defaults to 30 if unspecified. -->
<param name="frequency" value="30"/>

<!-- The period, in seconds, after which we consider a sensor to have timed out. In this event, we
carry out a predict cycle on the EKF without correcting it. This parameter can be thought of
as the minimum frequency with which the filter will generate new output. Defaults to 1 / frequency
if not specified. -->
<param name="sensor_timeout" value="0.1"/>

<!-- If this is set to true, no 3D information will be used in your state estimate. Use this if you
are operating in a planar environment and want to ignore the effect of small variations in the
ground plane that might otherwise be detected by, for example, an IMU. Defaults to false if
unspecified. -->
<param name="two_d_mode" value="true"/>

<!-- REP-105 (http://www.ros.org/reps/rep-0105.html) specifies three principal coordinate frames: map,
odom, and base_link. base_link is the coordinate frame that is affixed to the robot. The robot's
position in the odom frame will drift over time, but is accurate in the short term and should be
continuous. The odom frame is therefore the best frame for executing local motion plans. The map
frame, like the odom frame, is a world-fixed coordinate frame, and while it contains the most
globally accurate position estimate for your robot, it is subject to discrete jumps, e.g., due to
the fusion of GPS data. Here is how to use the following settings:
1. Set the map_frame, odom_frame, and base_link frames to the appropriate frame names for your system.
* If your system does not have a map_frame, just remove it, and make sure "world_frame" is set
to the value of odom_frame.
2. If you are fusing continuous position data such as wheel encoder odometry, visual odometry, or IMU data,
set "world_frame" to your odom_frame value. This is the default behavior for robot_localization's state
estimation nodes.
3. If you are fusing global absolute position data that is subject to discrete jumps (e.g., GPS or position
3b. MAKE SURE something else is generating the odom->base_link transform. Note that this can even be
another instance of robot_localization! However, that instance should *not* fuse the global data. -->
<!-- Defaults to "map" if unspecified -->
<param name="map_frame" value="map"/>
<!-- Defaults to "odom" if unspecified -->
<param name="odom_frame" value="odom"/>
<!-- Defaults to "base_link" if unspecified -->
<!-- Defaults to the value of "odom_frame" if unspecified -->
<param name="world_frame" value="odom"/>

<!-- Use this parameter to provide an offset to the transform generated by ekf_localization_node. This
can be used for future dating the transform, which is required for interaction with some other
packages. Defaults to 0.0 if unspecified. -->
<param name="transform_time_offset" value="0.0"/>

<!-- The filter accepts an arbitrary number of inputs from each input message type (Odometry, PoseStamped,
TwistStamped, Imu). To add a new one, simply append the next number in the sequence to its base name,
e.g., odom0, odom1, twist0, twist1, imu0, imu1, imu2, etc. The value should be the topic name. These
parameters obviously have no default values, and must be specified. -->
<param name="odom0" value="/VehicleTach"/>
<!--      <param name="odom1" value="/VirtYaw"/> -->
<param name="imu0" value="imu/data_filtered"/>

<!-- Each sensor reading updates some or all of the filter's state. These options give you greater control over
which values from each measurement are fed to the filter. For example, if you have an odometry message as input,
but only want to use its Z position value, then set the entire vector to false, except for the third entry.
The order of the values is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Note that not some
message types lack certain variables. For example, a TwistWithCovarianceStamped message has no pose information, so
the first six values would be meaningless in that case. Each vector defaults to all false if unspecified, effectively
making this parameter required for each sensor. -->
<rosparam param="odom0_config">[false, false, false,
false, false, false,
true,  true, false,
false, false, false,
false, false, false]</rosparam>

<!--      <rosparam param="odom1_config">[false, false, false,
false, false, false,
false,  false, false,
false, false, true,
false, false, false]</rosparam> -->

<rosparam param="imu0_config">[false, false, false,
true,  true,  true,
false, false, false,
false,  false,  false,
false,  false,  false]</rosparam>

<!-- The best practice for including new sensors in robot_localization's state estimation nodes is to pass in velocity
measurements and let the nodes integrate them. However, this isn't always feasible, and so the state estimation
nodes support fusion of absolute measurements. If you have more than one sensor providing absolute measurements,
however, you may run into problems if your covariances are not large enough, as the sensors will inevitably
diverge from one another, causing the filter to jump back and forth rapidly. To combat this situation, you can
either increase the covariances for the variables in question, or you can simply set the sensor's differential
parameter to true. When differential mode is enabled, all absolute pose data is converted to velocity data by
differentiating the absolute pose measurements. These velocities are then integrated as usual. NOTE: this only
applies to sensors that provide absolute measurements, so setting differential to true for twit measurements has
no effect.
Users should take care when setting this to true for orientation variables: if you have only one source of
absolute orientation data, you should not set the differential parameter to true. This is due to the fact that
integration of velocities leads to slowly increasing error in the absolute (pose) variable. For position variables,
this is acceptable. For orientation variables, it can lead to trouble. Users should make sure that all orientation
variables have at least one source of absolute measurement. -->
<param name="odom0_differential" value="false"/>
<!--      <param name="odom1_differential" value="false"/> -->
<param name="imu0_differential" value="false"/>

<!-- When the node starts, if this parameter is true, then the first measurement is treated as a "zero point" for all
future measurements. While you can achieve the same effect with the differential paremeter, the key difference is
that the relative parameter doesn't cause the measurement to be converted to a velocity before integrating it. If
you simply want your measurements to start at 0 for a given sensor, set this to true. -->
<param name="odom0_relative" value="false"/>
<!--      <param name="odom1_relative" value="false"/> -->
<param name="imu0_relative" value="true"/>

<!-- If we're including accelerations in our state estimate, then we'll probably want to remove any acceleration that
is due to gravity for each IMU. If you don't want to, then set this to false. Defaults to false if unspecified. -->
<param name="imu0_remove_gravitational_acceleration" value="false"/>

<!-- If you're having trouble, try setting this to true, and then echo the /diagnostics_agg topic to see
if the node is unhappy with any settings or data. -->
<param name="print_diagnostics" value="true"/>

<!-- ======== ADVANCED PARAMETERS ======== -->

<!-- Most users will be able to remove these parameters from the launch file without any consequences. We recommend
that users do not set values for these parameters without having a thorough understanding of
the parameters do. -->
<!-- By default, the subscription queue size for each message type is 1. If you wish to increase that so as not
miss any messages (even if your frequency is set to a relatively small value), increase these. -->
<param name="odom0_queue_size" value="2"/>
<!--<param name="odom1_queue_size" value="2"/> -->
<param name="imu0_queue_size" value="10"/>

<!-- If your data is subject to outliers, use these threshold settings, expressed as Mahalanobis distances, to control
how far away from the current vehicle state a sensor measurement is permitted to be. Each defaults to
numeric_limits<double>::max() if unspecified. -->
<param name="odom0_pose_rejection_threshold" value="5"/>
<param name="odom0_twist_rejection_threshold" value="1"/>
<!--      <param name="odom1_pose_rejection_threshold" value="5"/>
<param name="odom1_twist_rejection_threshold" value="1"/> -->
<param name="imu0_pose_rejection_threshold" value="0.3"/>
<param name="imu0_twist_rejection_threshold" value="0.1"/>
<param name="imu0_linear_acceleration_rejection_threshold" value="0.1"/>

<!-- Debug settings. Not for the faint of heart. Outputs a ludicrous amount of information to the file
specified by debug_out_file. I hope you like matrices! Defaults to false if unspecified. -->
<param name="debug"           value="false"/>
<!-- Defaults to "robot_localization_debug.txt" if unspecified. -->
<param name="debug_out_file"  value="debug_ekf_localization.txt"/>

<!-- The process noise covariance matrix can be difficult to tune, and can vary for each application, so it
is exposed as a configuration parameter. The values are ordered as x, y, z, roll, pitch, yaw, vx, vy, vz,
vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if unspecified. -->
<rosparam param="process_noise_covariance">[0.05, 0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0.05, 0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0.06, 0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0.03, 0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0.06, 0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0.025, 0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0.025, 0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0.04, 0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0.01, 0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0.01, 0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0.02, 0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0.01, 0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0.01, 0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0.015]</rosparam>

<!-- This represents the initial value for the state estimate error covariance matrix. Setting a diagonal value (a
variance) to a large value will result in early measurements for that variable being accepted quickly. Users should
take care not to use large values for variables that will not be measured directly. The values are ordered as x, y,
z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if unspecified. -->
<rosparam param="initial_estimate_covariance">[1e-9, 0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    1e-9, 0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    1e-9, 0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    1e-9, 0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    1e-9, 0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    1e-9, 0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    1e-9, 0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    1e-9, 0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    1e-9, 0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    1e-9,  0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     1e-9,  0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     1e-9,  0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     1e-9, 0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    1e-9, 0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    1e-9]</rosparam>

<!--  Placeholder for output topic remapping
<remap from="odometry/filtered" to=""/>
-->

</node>

<node pkg="robot_localization" type="navsat_transform_node" name="navsat_transform_node" respawn="false" output="screen">

<param name="yaw_offset" value="0"/>
<remap from="/imu/data" to="/imu/data" />
<remap from="/gps/fix" to="/fix" />
<remap from="/odometry/filtered" to="/odometry/filtered" />

</node>

<!-- Layer 2 Localization: Map Frame -->
<node pkg="robot_localization" type="ekf_localization_node" name="map_localization" clear_params="true" output="screen">

<!-- ======== STANDARD PARAMETERS ======== -->

<!-- The frequency, in Hz, at which the filter will output a position estimate. Note that
the filter will not begin computation until it receives at least one message from
one of the inputs. It will then run continuously at the frequency specified here,
regardless of whether it receives more measurements. Defaults to 30 if unspecified. -->
<param name="frequency" value="30"/>

<!-- The period, in seconds, after which we consider a sensor to have timed out. In this event, we
carry out a predict cycle on the EKF without correcting it. This parameter can be thought of
as the minimum frequency with which the filter will generate new output. Defaults to 1 / frequency
if not specified. -->
<param name="sensor_timeout" value="0.1"/>

<!-- If this is set to true, no 3D information will be used in your state estimate. Use this if you
are operating in a planar environment and want to ignore the effect of small variations in the
ground plane that might otherwise be detected by, for example, an IMU. Defaults to false if
unspecified. -->
<param name="two_d_mode" value="true"/>

<!-- REP-105 (http://www.ros.org/reps/rep-0105.html) specifies three principal coordinate frames: map,
odom, and base_link. base_link is the coordinate frame that is affixed to the robot. The robot's
position in the odom frame will drift over time, but is accurate in the short term and should be
continuous. The odom frame is therefore the best frame for executing local motion plans. The map
frame, like the odom frame, is a world-fixed coordinate frame, and while it contains the most
globally accurate position estimate for your robot, it is subject to discrete jumps, e.g., due to
the fusion of GPS data. Here is how to use the following settings:
1. Set the map_frame, odom_frame, and base_link frames to the appropriate frame names for your system.
* If your system does not have a map_frame, just remove it, and make sure "world_frame" is set
to the value of odom_frame.
2. If you are fusing continuous position data such as wheel encoder odometry, visual odometry, or IMU data,
set "world_frame" to your odom_frame value. This is the default behavior for robot_localization's state
estimation nodes.
3. If you are fusing global absolute position data that is subject to discrete jumps (e.g., GPS or position
3b. MAKE SURE something else is generating the odom->base_link transform. Note that this can even be
another instance of robot_localization! However, that instance should *not* fuse the global data. -->
<!-- Defaults to "map" if unspecified -->
<param name="map_frame" value="map"/>
<!-- Defaults to "odom" if unspecified -->
<param name="odom_frame" value="odom"/>
<!-- Defaults to "base_link" if unspecified -->
<!-- Defaults to the value of "odom_frame" if unspecified -->
<param name="world_frame" value="map"/>

<!-- Use this parameter to provide an offset to the transform generated by ekf_localization_node. This
can be used for future dating the transform, which is required for interaction with some other
packages. Defaults to 0.0 if unspecified. -->
<param name="transform_time_offset" value="0.0"/>

<!-- The filter accepts an arbitrary number of inputs from each input message type (Odometry, PoseStamped,
TwistStamped, Imu). To add a new one, simply append the next number in the sequence to its base name,
e.g., odom0, odom1, twist0, twist1, imu0, imu1, imu2, etc. The value should be the topic name. These
parameters obviously have no default values, and must be specified. -->
<param name="odom0" value="/VehicleTach"/>
<param name="imu0" value="imu/data_filtered"/>
<!--      <param name="odom1" value="/odometry/gps" /> -->
<!--      <param name="odom2" value="/VirtYaw" /> -->
<!--<param name="pose0" value="/poseupdate" /> -->

<!-- Each sensor reading updates some or all of the filter's state. These options give you greater control over
which values from each measurement are fed to the filter. For example, if you have an odometry message as input,
but only want to use its Z position value, then set the entire vector to false, except for the third entry.
The order of the values is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Note that not some
message types lack certain variables. For example, a TwistWithCovarianceStamped message has no pose information, so
the first six values would be meaningless in that case. Each vector defaults to all false if unspecified, effectively
making this parameter required for each sensor. -->

<rosparam param="odom0_config">[false, false, false,
false, false, false,
true,  true, false,
false, false, false,
false, false, false]</rosparam>

<rosparam param="imu0_config">[false, false, false,
true,  true,  true,
false, false, false,
false,  false,  false,
false,  false,  false]</rosparam>

<!--      <rosparam param="odom1_config">[true,  true, false,
false, false, false,
false,  false, false,
true, true, false,
false, false, false]</rosparam> -->

<!--      <rosparam param="odom2_config">[false,  false, false,
false, false, false,
false,  false, false,
false, false, true,
false, false, false]</rosparam> -->

<rosparam param="pose0_config">[true,  true, false,
false, false, false,
false,  false, false,
false, false, false,
false, false, false]</rosparam>

<!-- The best practice for including new sensors in robot_localization's state estimation nodes is to pass in velocity
measurements and let the nodes integrate them. However, this isn't always feasible, and so the state estimation
nodes support fusion of absolute measurements. If you have more than one sensor providing absolute measurements,
however, you may run into problems if your covariances are not large enough, as the sensors will inevitably
diverge from one another, causing the filter to jump back and forth rapidly. To combat this situation, you can
either increase the covariances for the variables in question, or you can simply set the sensor's differential
parameter to true. When differential mode is enabled, all absolute pose data is converted to velocity data by
differentiating the absolute pose measurements. These velocities are then integrated as usual. NOTE: this only
applies to sensors that provide absolute measurements, so setting differential to true for twit measurements has
no effect.

Users should take care when setting this to true for orientation variables: if you have only one source of
absolute orientation data, you should not set the differential parameter to true. This is due to the fact that
integration of velocities leads to slowly increasing error in the absolute (pose) variable. For position variables,
this is acceptable. For orientation variables, it can lead to trouble. Users should make sure that all orientation
variables have at least one source of absolute measurement. -->
<param name="odom0_differential" value="false"/>
<param name="imu0_differential" value="false"/>
<!--      <param name="odom1_differential" value="true" /> -->
<param name="odom2_differential" value="false" />
<param name="pose0_differential" value="false"/>

<!-- When the node starts, if this parameter is true, then the first measurement is treated as a "zero point" for all
future measurements. While you can achieve the same effect with the differential paremeter, the key difference is
that the relative parameter doesn't cause the measurement to be converted to a velocity before integrating it. If
you simply want your measurements to start at 0 for a given sensor, set this to true. -->
<param name="odom0_relative" value="false"/>
<param name="imu0_relative" value="true"/>
<!--      <param name="odom1_relative" value="false"/> -->
<param name="odom2_relative" value="false"/>
<param name="pose0_relative" value="false"/>

<!-- If we're including accelerations in our state estimate, then we'll probably want to remove any acceleration that
is due to gravity for each IMU. If you don't want to, then set this to false. Defaults to false if unspecified. -->
<param name="imu0_remove_gravitational_acceleration" value="false"/>

<!-- If you're having trouble, try setting this to true, and then echo the /diagnostics_agg topic to see
if the node is unhappy with any settings or data. -->
<param name="print_diagnostics" value="true"/>

<!-- ======== ADVANCED PARAMETERS ======== -->

<!-- Most users will be able to remove these parameters from the launch file without any consequences. We recommend
that users do not set values for these parameters without having a thorough understanding of
the parameters do. -->

<!-- By default, the subscription queue size for each message type is 1. If you wish to increase that so as not
miss any messages (even if your frequency is set to a relatively small value), increase these. -->
<param name="odom0_queue_size" value="2"/>
<!--      <param name="odom1_queue_size" value="2"/> -->
<!--<param name="odom2_queue_size" value="2"/>-->
<param name="imu0_queue_size" value="10"/>

<!-- If your data is subject to outliers, use these threshold settings, expressed as Mahalanobis distances, to control
how far away from the current vehicle state a sensor measurement is permitted to be. Each defaults to
numeric_limits<double>::max() if unspecified. -->
<param name="odom0_pose_rejection_threshold" value="5"/>
<param name="odom0_twist_rejection_threshold" value="1"/>
<!--      <param name="odom1_pose_rejection_threshold" value="5"/>
<param name="odom1_twist_rejection_threshold" value="1"/> -->
<!--      <param name="odom2_pose_rejection_threshold" value="5"/>
<param name="odom2_twist_rejection_threshold" value="1"/>-->
<param name="imu0_pose_rejection_threshold" value="0.3"/>
<param name="imu0_twist_rejection_threshold" value="0.1"/>
<param name="imu0_linear_acceleration_rejection_threshold" value="0.1"/>

<!-- Debug settings. Not for the faint of heart. Outputs a ludicrous amount of information to the file
specified by debug_out_file. I hope you like matrices! Defaults to false if unspecified. -->
<param name="debug"           value="false"/>
<!-- Defaults to "robot_localization_debug.txt" if unspecified. -->
<param name="debug_out_file"  value="debug_ekf_localization.txt"/>

<!-- The process noise covariance matrix can be difficult to tune, and can vary for each application, so it
is exposed as a configuration parameter. The values are ordered as x, y, z, roll, pitch, yaw, vx, vy, vz,
vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if unspecified. -->
<rosparam param="process_noise_covariance">[0.05, 0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0.05, 0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0.06, 0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0.03, 0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0.06, 0,     0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0.025, 0,     0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0.025, 0,    0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0.04, 0,    0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0.01, 0,    0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0.01, 0,    0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0.02, 0,    0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0.01, 0,    0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0.01, 0,
0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0.015]</rosparam>

<!-- This represents the initial value for the state estimate error covariance matrix. Setting a diagonal value (a
variance) to a large value will result in early measurements for that variable being accepted quickly. Users should
take care not to use large values for variables that will not be measured directly. The values are ordered as x, y,
z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if unspecified. -->
<rosparam param="initial_estimate_covariance">[1e-9, 0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    1e-9, 0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    1e-9, 0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    1e-9, 0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    1e-9, 0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    1e-9, 0,    0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    1e-9, 0,    0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    1e-9, 0,    0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    1e-9, 0,     0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    1e-9,  0,     0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     1e-9,  0,     0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     1e-9,  0,    0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     1e-9, 0,    0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    1e-9, 0,
0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    1e-9]</rosparam>

<remap from="odometry/filtered" to="odometry/filtered_discont"/>

</node>

</launch>