Commit 766b5ef
Split solver/momentum_ik.cpp into separate autograd files (#1082)
Summary:
Pull Request resolved: #1082
This diff refactors `arvr/libraries/pymomentum/solver/momentum_ik.cpp` (originally 1505 LOC) by extracting the autograd function definitions into a separate `momentum_ik_autograd.cpp` / `.h` pair.
**Changes:**
- Created `momentum_ik_autograd.h` (265 LOC) containing:
- `TensorMppcaModel` struct
- `extractMppcaModel()` function declaration
- `createIKProblem<T>()` template function declaration
- `IKSolveFunction<T>`, `GradientFunction<T>`, `ResidualFunction<T>`, `SequenceIKSolveFunction<T>` class declarations
- `IKProblemAutogradFunction<T, IKFunction>` struct declaration
- Created `momentum_ik_autograd.cpp` (1002 LOC) containing implementations of all the above
- Simplified `momentum_ik.cpp` (now 539 LOC) to contain only:
- `applyIKProblemAutogradFunction` helper (in anonymous namespace)
- Public pybind11 registration functions: `solveBodyIKProblem`, `computeGradient`, `computeResidual`, `computeJacobian`, `solveBodySequenceIKProblem`, `transformPose`
This resolves the issue of a single file mixing autograd function definitions with pybind11 binding registration, making the code more maintainable and reducing `momentum_ik.cpp` well below the 1500 LOC target.
Reviewed By: cdtwigg
Differential Revision: D95089972
fbshipit-source-id: 578014cbcbca6908a1ffc44fa5edffd147dffc221 parent 3030ecf commit 766b5ef
File tree
4 files changed
+1271
-968
lines changed- pymomentum
- cmake
- solver
4 files changed
+1271
-968
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
0 commit comments