cvg / pyceres

Factor graphs with Ceres in Python
Apache License 2.0
247 stars 34 forks source link

writing own costFunction #20

Closed linqingfan closed 1 year ago

linqingfan commented 1 year ago

Hi, Is there a way to create own class of costFunction? I tried but it seems there is no set_num_residuals member function. May I know if it is possible?

sarlinpe commented 1 year ago

You can create new kind of cost function by adding its C++ implementation to _pyceres/factors/ (look at pose_graph.cc as an example) and binding it in bindings.cc. We don't provide any way to write cost functions in Python.