# setting covariance and params for robot_localization

Hello everyone ,

This link odom and imu covariances, is my odom0 and imu0 config,odom_pose_covariace, odom_twist_covariance, imu_orientation_covariace, imu_angular_velocity_covariance and imu_linear_acceleration_covariace picture(sorry ,i can't upload this picture).The left-up of the picture is odom0_config and Imu0_config,according to robot_localization_Fusing Unmeasured Variables,I use odom: `X˙,Y˙and yaw˙`

and imu: `yaw,yaw˙and X¨`

to fuse . The left-down of the picture is imu `orientation_covariance`

,`angular_velocity_covariace`

and`linear_acceleration_covariance`

.The right of the picture is `odom_pose_covariance`

and `odom_twist_covariance`

. Althrough i see some similar questions like these,i still have some confusions :

`Q1`

As we all know ,to 2d differential robot, odom output data:`Z, vy(linear_y),vz(linear_z),wx(angular_x) and wy(angular_y)`

are all zero ,so when we setting the covariance for`Z,roll,pitch,vy(linear_y),vz(linear_z),wx(angular_x) and wy(angular_y)`

,should we set them a very very small value like 1e-6 ,or should we set them zero?`Q2`

In the odom covariance for`x`

,`y`

and`yaw`

,i set them are 0.01,0.01 and 0.1(actually,i have no experiance about how to set them).And then ,i think odom twist is more accurate than pose ,so i set odom_twist_covariance for`X˙`

and`yaw˙`

is smaller than`x`

and`yaw`

. Covariance for`X˙`

is 0.001,and for`yaw˙`

is 0.01.This practice is reasonable ？？

In addition to the above questions，i have some questions about `robot_localization`

params setting .

- I see the ~[sensor]_differential , ~[sensor]_relative ：
- -
**The first kind of understaning**： i think if one source is enabled differential ,`r_l`

will differentiate the variables which be used to fuse.For example,If we set odom0_config is`X˙,Y˙and yaw˙`

and set`odom0_differential:true`

,does it mean that :`r_l`

will convert`X˙,Y˙and yaw˙`

to`X¨,Y¨,yaw''`

to following calculation. **The second kind of understaning:**if one source is enabled differential ,`r_l`

will differentiate the only pose variables`X,Y,Z,roll,pitch,yaw`

.But if when we set odom0_config is`X˙,Y˙and yaw˙`

and set`odom0_differential:true`

,there is none of pose variables such as`X,Y,Z,roll,pitch,yaw`

.`Q3`

So i'm confused about this param meaning.`Q4`

when i see The differential and relative Parameters,i have one odom and one imu .So which sensor i should`enable differential`

,imu or odom ?`Q5`

Suppose we set`odom_differential:true`

,and`imu_differential:false`

,does it mean that we must also set`odom_relative:false`

and`imu_relative:true`

? For the same sensor,we cannot set its differential and relative the same ,such as : false-false or true-true,because the differential and relative param are opposite meaning? Am i right?`Q6`

AS @Tom Moore saied in this question, if you are measuring a variable, make the diagonal value in`initial_estimate_covariance`

**larger**than that measurement's covariance.In my case (one odom and one imu),the diagonal value in`initial_estimate_covariance`

should be**larger**than odom or imu ,or both of them ? In other words，odom belong to measurement or not ? In ...