ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange

# What should be considered when estimating the covariance matrix of an optical flow sensor?

I want to use data from a px4flow optical flow sensor using ekf_localization_node from robot_localization for odometry.

This requires a node to convert the px_comm/OpticalFlow messages to geometry_msgs/TwistWithCovarianceStamped. The covariance matrix values are unknown, but I understand that they can be estimated using the sample mean covariance.

I can get samples by mounting the sensor to a robot and moving it around, but it looks like how the robot moves while collecting samples will greatly effect the scale of the matrix.

If I collect samples while the robot moves at a constant speed, will all samples be close to the mean? Will the values in the covariance matrix then be very small? If the robot moved equal distances in all directions and back to it's starting position will the mean for each variable be zero? Then won't the values in the resulting covariance matrix be very large? Which matrix will give more accurate odometry?

Taking a step back, is the true covariance matrix constant? Would the filtered odometry be more accurate if I kept a lookup table of covariance matrices for each expected base velocity?

What's a typical workflow for determining covariance matrix values?

edit retag close merge delete

Sort by ยป oldest newest most voted

If I collect samples while the robot moves at a constant speed, will all samples be close to the mean?

It depends on how noisy the sensor is, but that's exactly what you're trying to determine.

Will the values in the covariance matrix then be very small?

Maybe! If so, that's good news for you.

If the robot moved equal distances in all directions and back to it's starting position will the mean for each variable be zero?

When the direction of the robot changes (e.g., forward-to-backward, or forward-to-left), I think you'll need to "reset" your collection, as you'll have a new mean. For example, if you drive forward and you get a mean of N m/s, then drive backward with the same velocity, your new mean should be around -N m/s. Unless the sensor is better in one direction than another, though, you may not need to do this.

Taking a step back, is the true covariance matrix constant?

Again, that depends on the sensor. I would expect the covariance to be in some way proportional to the velocity in this case, so that the faster you go, the greater the error in your measurement, but don't take my word for it.

What's a typical workflow for determining covariance matrix values?

I can't speak to that, really, but I can speak to the trade-off between under- and over-estimating the covariance. If you make it too low, you're going to trust those measurements more than you should, and the filter output will more rapidly converge, but it will potentially be less accurate, and the velocity output may appear to be as noisy as the input. If you over-estimate, it will take longer to converge, but the velocity output will be "smoother".

more