symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.41k stars 145 forks source link

Reduce surface area of keys_to_func and keys_to_optimize #291

Closed chao-qu-skydio closed 1 year ago

chao-qu-skydio commented 1 year ago

Currently, all functions related to Factor creation take keys_to_func and keys_to_optimize, down to the very last constructor.

However, many intermediate functions really don’t care about these two vectors. All they care about is how to do the dispatch given the input type to a callable.

So I refactored some of these functions and let them return the function to the Factor constructor rather than directly return a Factor. This would make future refactoring much easier to do.

chao-qu-skydio commented 1 year ago

Oh I probably messed up the PR by basing on the previous branch. But the idea should remain valid. And I can fix the PR later.

chao-qu-skydio commented 1 year ago

This branch is messed up. Closing for now.