Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to throttle covariance computation #209

Conversation

efernandez
Copy link
Collaborator

This PR adds the covariance_throttle_period ROS param to the fuse_models::Odometry2DPublisher to allow throttling the covariance computation. The motivation is to reduce the CPU usage by saving time not computing the covariance on every optimization cycle, i.e. every time notifyCallback() is called.

I've profiled the fixed-lag smoother, and the two major hotspots are Ceres solver optimization and the covariance computation, taking around half of the total computational time each.

The idea here is that we could reduce the CPU usage to almost half if we don't need the covariance at the same rate as the state. For example, if we set covariance_throttle_period to 2.0s, we get approx. half the CPU usage.

By default covariance_throttle_period is 0.0, which doesn't throttle the covariance computation, so we have the current behaviour.

Note that when the covariance isn't computed, we simply used the last one computed. We don't predict/propagate it forward (see code comment for more details and justification). It's still propagated if predict_to_current_time is enabled, but doesn't only for the small dt between the optimization and publish time.

@efernandez efernandez self-assigned this Nov 25, 2020
@efernandez efernandez added the enhancement New feature or request label Nov 25, 2020
@efernandez efernandez force-pushed the throttle-covariance-computation branch from 5475307 to 7d4f77c Compare November 30, 2020 15:13
@svwilliams svwilliams merged commit 960a8ec into locusrobotics:devel Dec 1, 2020
@efernandez efernandez deleted the throttle-covariance-computation branch December 10, 2020 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants