Skip to content

Calc hessian of potential energy - #2

Draft
sadraddini wants to merge 4 commits into
masterfrom
ss.calc_hessian_of_potential_energy
Draft

Calc hessian of potential energy#2
sadraddini wants to merge 4 commits into
masterfrom
ss.calc_hessian_of_potential_energy

Conversation

@sadraddini

Copy link
Copy Markdown
Owner

No description provided.

@sadraddini

Copy link
Copy Markdown
Owner Author

@copilot please write a unit test with higher degrees of freedom (feel free to make, for example, N dof chain of pendulums) and use my method, as well as a version that uses AutoDiff for the plant. Compare the times of two methods

…with AutoDiff

Agent-Logs-Url: https://github.com/sadraddini/drake/sessions/83ff32df-c1a9-4f27-8309-dea7b6d8260e

Co-authored-by: sadraddini <26656757+sadraddini@users.noreply.github.com>

Copilot AI commented May 12, 2026

Copy link
Copy Markdown

@copilot please write a unit test with higher degrees of freedom (feel free to make, for example, N dof chain of pendulums) and use my method, as well as a version that uses AutoDiff for the plant. Co...

Added a NDOFPendulumHessianTest in commit 0bb91a7 that builds a 10-DOF chain of planar pendulums (z-axis revolute joints, gravity in x-direction) and compares both methods:

Method 1 — CalcHessianOfPotentialEnergy: the bias-acceleration-based analytical method.

Method 2 — AutoDiff: converts the plant to MultibodyPlant<AutoDiffXd>, sets positions as AutoDiff variables with identity gradient (math::InitializeAutoDiff(q)), calls CalcGravityGeneralizedForces, and extracts the Hessian via H = -d(τ_g)/dq (since τ_g = −∂V/∂q).

Both are timed over 50 repetitions and results are printed. The test asserts agreement to 1e-10 tolerance.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • bcr.bazel.build
    • Triggering command: /home/REDACTED/.cache/bazel/_bazel_REDACTED/install/5229af5fe4e43869fa475e361effe116/embedded_tools/jdk/bin/java bazel(drake) --add-opens=java.base/java.lang=ALL-UNNAMED -Xverify:none -Djava.util.logging.config.file=/home/REDACTED/.cache/bazel/_bazel_REDACTED/f37532999aab6276dee5ba1689fb337f/javalog.properties -Dcom.google.devtools.build.lib.util.LogHandlerQuerier.class=com.google.devtools.build.lib.util.SimpleLogHandler$HandlerQuerier -XX:-MaxFDLimit -Djava.lang.Thread.allowVirtualThreads=true -XX:OnOutOfMemoryError=touch /home/REDACTED/.cache/bazel/_bazel_REDACTED/f37532999aab6276dee5ba1689fb337f/blaze_oomed -Djava.library.path=/home/REDACTED/.cache/bazel/_bazel_REDACTED/install/5229af5fe4e43869fa475e361effe116/embedded_tools/jdk/lib:/home/REDACTED/.cache/bazel/_bazel_REDACTED/install/5229af5fe4e43869fa475e361effe116/embedded_tools/jdk/lib/server:/home/REDACTED/.cache/ (dns block)
  • bcr.cloudflaremirrors.com
    • Triggering command: /usr/bin/curl curl -s --max-time 10 REDACTED (dns block)
    • Triggering command: /usr/bin/curl curl -v --max-time 15 REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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