# 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?