Skip to content

Conversation

cedricpradalier
Copy link
Contributor

This PR is a proposal of a set of tools that will help creating optimisation problems with Ceres and splines of Sophus objects, dealing with all the special cases of knot selection at the beginning and at the end of the knot vector, as well as the derivative

A functor can be optimized on the spline knots with a code as simple as:
`std::shared_ptr spline(new Splined(control_poses, -1.0, dt)));
ceres::Problem problem;

auto parametrization = new Sophus::Manifold<LieGroup_>;
for (auto v : spline->parent_Ts_control_point()) {
  problem.AddParameterBlock(v.data(), LieGroupd::num_parameters, parametrization);
}

for (size_t i = 0; i < group_vec.size(); ++i) {
    double t = i;
    std::shared_ptr<Functor> functor(new Functor(group_vec[i]));
    SES::template addResidualFunction0<Functor,DoF>(problem,t,spline,functor);
  }

`
addResidualFunctions are provided for functor taking one or two points on the spline, or its first and second derivative, as well as functor depending on one or two other objects (for instance extrinsic or intrinsic calibrations).

Adding the KnotAndU class is critical to this code to easily recover the knots and u value corresponding to a specific time stamp.

I hope that can be useful. I find that these structures are strongly simplifying my writing.

completely wrong for functor applied on two points on the spline because
the previous code was not guaranteeing that unique parameter blocks were
passed to the autodiff function.
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.

1 participant