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

Support residual evaluation from ceres::Problem #50

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

B1ueber2y
Copy link
Member

@B1ueber2y B1ueber2y commented Jun 28, 2024

Follow up for #49. We can evaluate residuals either with EvaluateOptions or a list of residual ids.

Example:

import pyceres
import numpy as np

x1 = np.zeros(3)
x2 = np.ones(3)
x1_prior = np.arange(3)
covar = np.eye(3)
prob = pyceres.Problem()
loss = pyceres.TrivialLoss()
rid1 = prob.add_residual_block(pyceres.factors.NormalPrior(x1_prior, covar), loss, [x1])
rid2 = prob.add_residual_block(pyceres.factors.NormalError(covar), loss, [x1, x2])
print(prob.evaluate_residuals())
# Output:
# [0.0, -1.0, -2.0, -1.0, -1.0, -1.0]
print(prob.evaluate_residuals([rid2]))
# Output:
# [-1.0, -1.0, -1.0]

@B1ueber2y B1ueber2y requested a review from sarlinpe June 28, 2024 15:23
@sarlinpe sarlinpe merged commit f56d0fb into cvg:main Jun 28, 2024
6 checks passed
@B1ueber2y B1ueber2y deleted the features/residual_ordering branch June 30, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants