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

Added example code for initialization of sf.Rot3 using a quaternion #315

Closed VineetTambe closed 1 year ago

VineetTambe commented 1 year ago

Added initialisation of a sf.Rot3 Lie Group using sf.Quaternion - symbolic as well as numeric - to the geometry_tutorial python notebook.

aaron-skydio commented 1 year ago

The only change showing up here is removing the whole file?

VineetTambe commented 1 year ago

Sorry about that. Forgot to copy the file over after forking the repo. Should be reflecting the same file with just the quaternion part added!

Please let me know if there are any more changes.

aaron-skydio commented 1 year ago

Could you merge these into one cell? You can have multiple calls to display() in the cell, e.g. to show the quaternion and the Rot3. And I think we probably don't need the numeric example

VineetTambe commented 1 year ago

Got it!

VineetTambe commented 1 year ago

Done!

aaron-skydio commented 1 year ago

I'll fix the lint failures, just needs make format

VineetTambe commented 1 year ago

Thanks! For future reference - can you tell me how to fix those issues? And what exactly is happening? Does running auto-format in pycharm/vscode suffice?

aaron-skydio commented 1 year ago

Sure, as far as what's happened, all that's failed is one of the tests which checks that the formatting matches what we get from the autoformatter. If you have a from-source install of symforce, it's symforce_linter_test.

If you've built symforce from source as described here, you can just run make format in the root directory of the SymForce repo to autoformat everything. You technically shouldn't need the entire build to have run, all you actually need is the pinned versions of black and clang-format from dev_requirements.txt to be installed.

Yeah pycharm/vscode autoformat works (personally I use vscode autoformat), primarily just need to make sure

1) it's set to black 2) it's picked up the black config from our pyproject.toml (that's just for the line length) 3) you have the right version of black installed, including the jupyter plugin (currently black[jupyter]==21.12b0 which you can see here)