symforce-org / symforce

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

API of `Codegen.with_jacobians` is confusing #303

Open aaron-skydio opened 1 year ago

aaron-skydio commented 1 year ago

It's pretty unintuitive IMO that with_jacobians defaults to all the inputs, but the first output. I'm honestly not sure why we did this - maybe because sometimes the second output is is_valid? Even when writing this I initially wrote this issue description backwards assuming it was just the first input (because the last input is often epsilon). I think it's probably more confusing to just include the first one, and we should default to all?

Example: https://colab.research.google.com/drive/1Jm3pkngrmUxxJ5wbzBlAEJI6ERhliRTk?usp=sharing

aaron-skydio commented 1 year ago

Another note here:

Also, I gave output_names which I figured would mean that those outputs get generated.