-
Notifications
You must be signed in to change notification settings - Fork 126
Fix Ceres 2.0.0 API support #273
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
Fix Ceres 2.0.0 API support #273
Conversation
Ceres added this argument in ceres-solver/ceres-solver@e7a3035 we need to pass it else template substitution fails.
Upstream commit made me assume kGlobalSize, but that threw at runtime when the tests ran. This seems to work, also put a using statement there to make roslint happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember that far back as to why exactly I needed to use the internal API. I'll review the code and Ceres public API to see if there is a cleaner work-around.
Pinging @svwilliams for visibility This issue came up during the porting effort. I will be including this change in the PRs I'm making to port/fix the tests for fuse_core. I don't know if AutoDiffCostFunction might be what you're looking for? But I don't have enough context to understand if that function is doing what you need it to be doing |
I'll take a look at this tomorrow and see if I can remember exactly what is going on. |
@methylDragon I've reviewed the AutoDiffLocalParameterization and its history. Here' is what is going on: However, the fuse project needed to add some additional capabilities to the LocalParameterization class. So fuse derived the fuse_core::LocalParameterization from the ceres::LocalParameterization base class. All custom fuse LocalParameterization classes must derive from the fuse_core::LocalParameterization base class instead of the ceres::LocalParameterization base class. Because of this, the Ceres Solver helper classes, like ceres::AutoDiffLocalParameterization, cannot be used directly in fuse. Basically we run into the diamond inheritance problem. To fix that issue, I reimplemented the features of the ceres::AutoDiffLocalParameterization helper class inside a fuse_core::AutoDiffLocalParameterization helper class. This creates some code duplication between the ceres and fuse_core versions. And more importantly, reimplementing the functionality inside of fuse required the use of the internal Ceres Solver API. I'm not actually using the fuse_core::AutoDiffLocalParameterization within the fuse project (other than inside some unit tests), but it is provided as a convenience for others if they wish to implement their own LocalParameterization classes. So even though it is not really used, I'd rather not removed it. I'll merge this PR now. And if this is sufficient for the ROS2 port to move forward, I likely just continue to ignore my use of the internal API. 🙂 And it looks like Ceres Solver 2.2 will be making drastic changes to the LocalParameterization system. Replacing the LocalParameterization class with a Manifold class. The Manifold version appears to included the added functionality that fuse_core added to ceres::LocalParameterization class. So I might be able to drop all of the fuse_core::LocalParameterization classes in the future, which would solve my internal API usage issues. |
* Pass kNumResiduals to the internal AutoDiff function. Ceres added this argument in ceres-solver/ceres-solver@e7a3035 we need to pass it else template substitution fails. * Pass kLocalSize instead of kGlobalSize Upstream commit made me assume kGlobalSize, but that threw at runtime when the tests ran. This seems to work, also put a using statement there to make roslint happy. Co-authored-by: Ivor Wanders <[email protected]>
This fixes the following compilation error when building with Ceres Solver 2.0.0 or newer:
The
internal::AutoDifferentiate
API was changed in ceres-solver/ceres-solver@e7a3035, first released in 2.0.0It's actually an
internal
API, so technically we shouldn't be using it. Either way, this fixes the compilation error.@iwanders found and fixed this. He's also pointed out that this code is only used in unit tests, but I believe that's indeed intended, since it looks like
fuse_core::AutoDiffLocalParameterization
is used to compute the expected values to compared the actual ones against them, as it's done infuse/fuse_variables/test/test_orientation_2d_stamped.cpp
Line 170 in 3825e48