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

Feature/backwards eigen bounds #219

Merged
merged 5 commits into from
Oct 16, 2023
Merged

Conversation

ewfuentes
Copy link
Owner

No description provided.

":test_helpers",
"@com_google_googletest//:gtest_main",
]
)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove the planner changes from this PR?

const double lower_eigen_value_information, // min ev of \Omega_t
const double upper_eigen_value_dynamics, // max ev of G_t^{-1} G_t^{-T}
const double upper_eigen_value_measurement, // max ev of M_t
const double lower_eigen_value_process_noise // min ev of R_t
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you have a bunch of parameters that are the same time, it becomes very easy to accidentally pass the wrong argument into the incorrect location. Consider instead:

struct StepLowerEigenBoundInputs {
  double lower_eigen_value_information;
  double upper_eigen_value_dynamics;
  double upper_eigen_value_measurement;
  double lower_eigen_value_process_noise;
};

double step_lower_eigen_bound(const StepLowerEigenBoundInputs &in) { ... }

Then at the call site:

step_lower_eigen_bound({
  .lower_eigen_value_information = ...,
  .upper_eigen_value_dynamics = ...,
  .upper_eigen_value_measurement = ...,
  .lower_eigen_value_process_noise = ...,
});

// G_t^{-1}
const Eigen::Matrix3d inv_dynamics_jac_wrt_state = old_robot_from_new_robot.Adj();
// max_eigen_value(G_t^{-1} G_t^{-T})
const double dynamics_upper_eigen_value_bound = (inv_dynamics_jac_wrt_state * inv_dynamics_jac_wrt_state.transpose()).eigenvalues().real().maxCoeff();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't actually a bound is it? it's the true max eigenvalue.

Comment on lines 63 to 64
std::cout << "inv_dynamics_jac_wrt_state: " << std::endl << inv_dynamics_jac_wrt_state << std::endl;
std::cout << "dynamics_upper_eigen_value_bound: " << dynamics_upper_eigen_value_bound << std::endl;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omit when done debugging.

std::cout << "inv_dynamics_jac_wrt_state: " << std::endl << inv_dynamics_jac_wrt_state << std::endl;
std::cout << "dynamics_upper_eigen_value_bound: " << dynamics_upper_eigen_value_bound << std::endl;
// R_t
const Eigen::Matrix3d process_noise = compute_process_noise(ekf_config, DT_S, old_robot_from_new_robot.arclength());
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should return an Eigen::DiagonalMatrix so that the line below is always true.

Comment on lines 83 to 84
// scattering_transform = (scattering_transform * process_transform).value();
// scattering_transform = (scattering_transform * measurement_transform).value();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omit.

const double lower_eigen_value_process_noise // min ev of R_t
);

double compute_backwards_edge_belief_transform(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably call this function something else.

);
std::cout << "information_lower_bound: " << information_lower_bound << std::endl;
}
return information_lower_bound;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will work. If for some reason we run into computational issues, it might be interesting to compute the aggregate transform per edge and perform the backwards update in one shot.

Comment on lines 10 to 13
constexpr double start_info_eigen_value = 1.0;
constexpr double ub_dynamics_eigen_value = 1.0;
constexpr double ub_measurement_eigen_value = 0.0;
constexpr double lower_process_noise_eigen_value = 1.0;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making your test values something other than 0.0 or 1.0, unless you are specifically testing behavior at those values. Adding 0.0 or multiplying by 1.0 are additive and multiplicative identities, so bugs tend to sneak through if you fail to add/multiply something or if you mistakenly do so.

constexpr double start_info_eigen_value = 1.0;
constexpr double ub_dynamics_eigen_value = 1.0;
constexpr double ub_measurement_eigen_value = 1.0;
constexpr double lower_process_noise_eigen_value = 1.0;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

@ewfuentes
Copy link
Owner Author

Removing ethans_super_cool_planner and the associated test will make CI happy. Run clang-format-15 -i **/*.cc **/*.hh fix run the linter. You may need to do it inside the docker container if you don't have it installed on your local machine. You may also need to set globstar (shopt -s globstar).

@efahnestock efahnestock force-pushed the feature/backwards_eigen_bounds branch from d45bb53 to 4e3ab8a Compare October 16, 2023 02:11
@efahnestock
Copy link
Collaborator

changes should address comments! let me know what's next for this

@ewfuentes
Copy link
Owner Author

Looks good!

@ewfuentes ewfuentes merged commit a1007fa into main Oct 16, 2023
3 checks passed
@ewfuentes ewfuentes deleted the feature/backwards_eigen_bounds branch October 16, 2023 14: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