Skip to content

[codex] Update multibody dynamics to 0.4.2 - #1

Merged
erlendbasso merged 2 commits into
mainfrom
upgrade-multibody-dynamics-0.4
Jun 6, 2026
Merged

[codex] Update multibody dynamics to 0.4.2#1
erlendbasso merged 2 commits into
mainfrom
upgrade-multibody-dynamics-0.4

Conversation

@erlendbasso

Copy link
Copy Markdown
Owner

Summary

  • Update multibody_dynamics from 0.4.0 to 0.4.2.
  • Replace deprecated MultiBody::new(...) construction with MultiBody::from_config(...) and explicit LinkProperties.
  • Reuse ForwardDynamicsWorkspace in the simulator RHS path via forward_dynamics_ab_with_workspace(...).

Impact

This keeps the simulator on the current multibody dynamics API and avoids repeated articulated-body scratch allocation during ODE solver evaluations. The adaptive Dopri5 simulation flow remains unchanged.

A temporary local RHS benchmark, not included in this PR, measured:

allocate each call: 7.227 us/eval
reuse workspace: 6.790 us/eval
speedup: ~1.064x / ~6.0%

Validation

  • cargo check
  • cargo test
  • cargo clippy --all-targets --all-features completed with existing style warnings
  • git diff --check

erlendbasso and others added 2 commits June 5, 2026 08:51
- Bump multibody_dynamics 0.2.2 -> 0.4.0 (requires nalgebra 0.34) and
  nalgebra 0.33 -> 0.34; rename minimal_to_homogenous_configuration ->
  minimal_to_homogeneous_configuration to match the 0.4 API.
- Vendor ode_solvers 0.6.1 under vendor/ode_solvers with its nalgebra
  dependency bumped to 0.34 (no published ode_solvers release supports
  nalgebra 0.34 yet); depend on it via path. Source is unmodified.
- Replace try_inverse().unwrap() in the thruster allocation with a damped
  (Tikhonov) pseudo-inverse so the Gram matrix is always invertible (no
  mid-integration panic), with a fallback to the desired generalised force.
- Add optional thruster_force_max config: when set, allocated thruster
  commands are clamped to an actual per-thruster force limit in newtons
  (normalised by direction norm) before reconstructing the generalised
  force, modelling actuator saturation. Default off (behaviour-preserving).
- Track Cargo.lock (binary crate) for reproducible builds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@erlendbasso
erlendbasso marked this pull request as ready for review June 6, 2026 08:28
Copilot AI review requested due to automatic review settings June 6, 2026 08:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the simulator’s Rust dependency stack to match multibody_dynamics 0.4.2 (and nalgebra 0.34), adapts the simulator code to the updated multibody API, and vendors ode_solvers to bridge the nalgebra version gap while also improving runtime performance by reusing forward-dynamics scratch workspace.

Changes:

  • Bump multibody_dynamics to 0.4.2 and nalgebra to 0.34, switching the simulator to the new MultiBody::from_config(...) + LinkProperties construction.
  • Reuse ForwardDynamicsWorkspace via forward_dynamics_ab_with_workspace(...) during RHS evaluations to reduce per-step allocations.
  • Vendor ode_solvers (0.6.1) with updated dependency versions to remain compatible with nalgebra 0.34.

Reviewed changes

Copilot reviewed 4 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Cargo.toml Updates dependency versions and switches ode_solvers to a vendored path dependency.
Cargo.lock Regenerated lockfile reflecting the new dependency graph (notably multibody_dynamics/nalgebra).
src/main.rs Updates multibody construction API, adds workspace reuse for forward dynamics, and adds optional thruster force saturation in allocation.
README.md Documents why vendor/ode_solvers exists and when it can be removed.
eely_config.yml Adds commented configuration option for per-thruster force limiting.
.gitignore Stops ignoring Cargo.lock and broadens .dat ignores to *.dat.
vendor/ode_solvers/** Adds vendored ode_solvers source and tests with updated dependency versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@erlendbasso
erlendbasso merged commit ac30608 into main Jun 6, 2026
1 check passed
@erlendbasso
erlendbasso deleted the upgrade-multibody-dynamics-0.4 branch June 6, 2026 08:32
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