# 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_covariaceandlinear_acceleration_covariance.The right of the picture is odom_pose_covarianceand 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,yand 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 xand 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_localizationparams 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_lwill 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.
• Q3So i'm confused about this param meaning.
• Q4when i see The differential and relative Parameters,i have one odom and one imu .So which sensor i should enable differential,imu or odom ?
• Q5Suppose 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 ...
edit retag close merge delete

Sort by » oldest newest most voted

It would probably be easier to just post your configuration files from r_l, but I think I have the gist of what you're saying. Also, as some of these questions are unrelated, it might be better in the future to ask multiple questions. Regardless, here goes:

If your sensor configuration is set to only fuse X velocity, Y velocity, yaw, yaw velocity, and X acceleration, then the covariance matrix values for the other values don't matter (i.e., you can set them to anything). The filter will only use the state and covariance data from the variables you decide to fuse.

You are not fusing X, Y, and yaw from the wheel encoders, so their covariance values don't matter. In general, though, you would usually see static covariances for the velocity data that accumulates in the pose data.

The _differential setting only applies to pose variables. It will differentiate pose measurements and generate velocities from them, then fuse those values. You need to set the pose variables to true in the sensor configuration in that case. The _differential parameter is meaningless for twist data.

The use case for the _differential parameter is pretty small: if you have two pose inputs that measure the same variable, but they diverge from each other, you can use the _differential parameter to force one (or both) of them to be treated as a velocity, which will keep the filter's pose output from oscillating. In your configuration above, you are fusing only one pose variable (yaw), with the rest being velocities and accelerations, so you're all set.

Again, this won't apply to you, but in general, the _relative and _differential parameters are mutually exclusive. In fact, if you set both to true, the relative parameter gets ignored.

It's up to you, really. Ideally, you would have some principled means of determining the covariance data for your sensors, and then just set the initial_estimate_covariance to be larger than at least one of them. This is just to aid in accepting the initial measurements from your sensors: if the EKF's initial yaw velocity variance is 0.00001, and the first IMU measurement has a yaw velocity variance of 0.01, the filter isn't going to trust the measurement very much, and so it will be slow to converge. If both of your sensors have relatively high frequencies, it won't really matter whether the initial variance is higher than only one of them, since you're bound to get a measurement very quickly.

The number of measurements in the update cycle is irrelevant. The filter will look at the delta between the last measurement time stamp and the current one, do a predict across that time step, then correct for the new measurement, and update the last measurement time stamp. If there is another measurement in the ...

more

@tom,thanks very very much!!! To Q4, do you mean for odom(X',Y',Yaw') and imu(Yaw,Yaw',X'')configs,i should set both them _differentialare false,because as you say,i have only one input(imu) for pose(yaw) and _differential is meaningless for twist data?

( 2017-01-04 20:48:08 -0600 )edit

To Q6, you say i should have some principled means of determining the covariance data for my sensors.Did you know whether exist some knowledge or guidance on how to set odom and imu covariance in somewhere?How you did your odom and imu?

( 2017-01-04 21:00:19 -0600 )edit

BTW,when i have one odom and one imu, in EKF update cycle, does it means there will be one predict step(Kinematic model) and two correct steps,one for odom ,and the other for imu?

( 2017-01-04 21:08:49 -0600 )edit

( 2017-01-13 04:25:39 -0600 )edit

( 2017-01-17 05:48:43 -0600 )edit

Thanks very very much !!! I learned a lot of things~~~

( 2017-01-18 03:17:39 -0600 )edit