Skip to content

New/fixing derivs benchmarks#110

Open
DVolpi256 wants to merge 192 commits into
mainfrom
new/fixing_derivs_benchmarks
Open

New/fixing derivs benchmarks#110
DVolpi256 wants to merge 192 commits into
mainfrom
new/fixing_derivs_benchmarks

Conversation

@DVolpi256

Copy link
Copy Markdown
Contributor

Added benchmarking unit tests for firstOrderInverseDynamicsDerivatives

DVolpi256 and others added 30 commits October 23, 2025 13:28
Has temporary variables for the backward pass as well. Comments are made for new functions that need to be implemented.
… two unit test files and fixed the

 resulting type issues.
Need Casadi to add additional terms
Merging to add support for Ubuntu 24 instead of 18
… 456 of ClusterTreeDyamics.cpp. The error pertains to a segmentation fault that I believe is related to the usage of the Psi_dot_ term.
…h a finite difference for fixed-base robots.
…finite difference and the other does a complex step. They work well for the double pendulum case. The three link and four link serial chains and Mini Cheetah have larger errors.
… Cheetah. Examining how to get the complex step working and whether testRigidBodyDynamicsAlgosDerivatives is now broken.
- Reverted src/Dynamics/ClusterTreeDynamics.cpp to e1bf655
- Reverted include/grbda/Utils/OrientationTools.h to e1bf655
- Reverted src/Dynamics/ClusterJoints/FreeJoint.cpp to e1bf655
- Reverted src/Robots/MiniCheetah.cpp to e1bf655
- Reverted UnitTests/testHelpers.hpp to e1bf655
- Modified UnitTests/testInverseDynamicsDerivativesSimple.cpp:
  - Updated conf_add to use [pos(3), quat(4)] ordering
  - Use h=1e-6 for floating base (instead of 1e-8)
  - Use tolerance 1e-5 for floating base tests
- Joint.h remains with [pos(3), quat(4)] ordering (e1bf655 baseline)

Results:
- testInverseDynamicsDerivativesSimple: 4/4 PASSED (including MiniCheetahQuaternion)
- testRigidBodyDynamicsAlgosDerivatives: 14/14 PASSED
DVolpi256 and others added 8 commits June 15, 2026 12:36
enableIDDerivativesProfiling/getIDDerivativesProfilingData/resetIDDerivativesProfiling
were removed from ClusterTreeModel/ClusterTreeDynamics on this branch.
Restore when the profiling infrastructure is re-added.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
clang is not an official dependency and is not installed. gcc supports
the same -O3 -march=native flags and works identically for CasADi's
shell JIT backend.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uteTriple

- benchmarkIDDerivatives: remove enableIDDerivativesProfiling/printIDDerivativesProfiling calls
- benchmarkParallelChainDepth: replace profiling block with zero-initialized fields
- benchmarkIDDerivativesScaling: replace dangling t6 reference and triple_results
  CSV export with disabled stubs
- benchmarkComplexJointChains: replace dangling t6/t12 comparison output with
  disabled stubs

All four issues stem from RevoluteTriple sections disabled in a prior commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… output

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
TeleopArm uses RevoluteTripleWithRotor which throws in getSdotqd_q,
causing an abort when firstOrderInverseDynamicsDerivatives is called.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds back the thread_local profiling accumulators and four free functions
(enableIDDerivativesProfiling, getIDDerivativesProfilingData,
resetIDDerivativesProfiling, printIDDerivativesProfiling) to
ClusterTreeModel.h and ClusterTreeDynamics.cpp.

Re-instruments firstOrderInverseDynamicsDerivatives with if(prof_enabled)
chrono timestamps at the same six phase boundaries as before:
  fwd_kin, fwd_casadi, fwd_other, bwd_casadi, bwd_other, bwd_prop.
Zero overhead when profiling is disabled.

Restores benchmarkIDDerivativesBreakdown.cpp from fixing_derivs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Now that RevoluteTripleWithRotor is backed by Generic<Scalar>, the
derivative methods work correctly. Restores:
- RevoluteTripleChain<3/6/9> in benchmarkIDDerivativesComparison
- TeleopArm in benchmarkIDDerivativesComparison
- Full Test 4 (t3..t99) in benchmarkIDDerivativesScaling, including
  summary t6 output and triple_results CSV export
- Full Test 3 (t3..t12) in benchmarkComplexJointChains, including
  t6/t12 comparison output and per-cluster timing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread src/Dynamics/ClusterJoints/GenericJoint.cpp Outdated
Comment thread include/grbda/Dynamics/ClusterJoints/RevoluteTripleWithRotorJoint.h
Comment thread src/Dynamics/ClusterJoints/RevoluteTripleWithRotorJoint.cpp
Comment thread UnitTests/benchmarkIDDerivatives.cpp Outdated
Comment thread UnitTests/benchmarkIDDerivatives.cpp Outdated
Comment thread UnitTests/benchmarkIDDerivatives.cpp Outdated
Comment thread UnitTests/benchmarkComplexJointChains.cpp Outdated
<< std::setw(10) << r.fwd_other_us
<< std::setw(10) << r.bwd_casadi_us
<< std::setw(10) << r.bwd_other_us
<< std::setw(10) << r.bwd_prop_us

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanity check: can you confirm that the forward part of the graph is grouping the kin and other?
And the backward (noncasadi part) of the graph is ground prop and other?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some clarifying documentation. Good catch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean specifically w.r.t. the graphs you create. Can you confirm that the FWD other captures all non-casadi operations (e.g., kin and other).

Same for the backward results. Can you confirm that the "bwd other" as graphed also contains the bwd_prop?

Image


printResults(results);

return 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to run this a final time once ready to get the stats for the world frame comparisson.

Comment thread UnitTests/benchmarkMiniCheetahErrorMatrix.cpp Outdated
Comment thread UnitTests/benchmarkSerialChainErrorMatrix.cpp Outdated
@pwensing pwensing force-pushed the new/fixing_derivs_benchmarks branch from 0c55440 to e332462 Compare June 18, 2026 19:49
@DVolpi256 DVolpi256 changed the base branch from new/fixing_derivs_no_benchmarks to main June 18, 2026 19:54
@pwensing pwensing force-pushed the new/fixing_derivs_benchmarks branch 2 times, most recently from 301a490 to b1941ce Compare June 18, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants