Skip to content

Template refactor code cleanup#90

Merged
SaltyJoss merged 103 commits into
Devfrom
Template_refactor_code_cleanup
May 31, 2026
Merged

Template refactor code cleanup#90
SaltyJoss merged 103 commits into
Devfrom
Template_refactor_code_cleanup

Conversation

@SaltyJoss
Copy link
Copy Markdown
Owner

This pull request introduces significant enhancements to the integration subsystem, especially by adding support for automatic differentiation (AutoDiff) integration methods and refactoring the integration services for better flexibility and extensibility. It also includes some build system improvements and minor code cleanups.

Integration system enhancements:

  • Introduced new DifferentiableIntegrator class and the eAutoDiffIntegrationMethod enum, enabling support for AutoDiff-based integration methods such as AD_ImplicitEuler, AD_ImplicitMidpoint, AD_GLRK2, and AD_GLRK3. The implementation includes a new AutoDiffStep.inl file with the corresponding step logic. [1] [2]
  • Refactored the IntegrationService class to use a templated StepOut_T<Scalar> struct, improving support for different scalar types and preparing the codebase for both standard and AutoDiff integration. The adaptive step logic and method selection have been modularized.

Build system and configuration improvements:

  • Updated the CMake configuration to enforce consistent MSVC runtime library usage and set gtest_force_shared_crt to ensure GoogleTest uses the shared CRT, improving Windows build reliability. [1] [2]
  • Added /bigobj compiler flag for MSVC builds of DSFE_Core to support larger object files.
  • Changed the core library linkage from PxMLib to MathLib, reflecting dependency updates.

API and enum extensions:

  • Extended the integration method enums in both ProgramData.h and IntegrationMethods.h to include the new AutoDiff integration methods, making them selectable throughout the application. [1] [2]

Code cleanup and minor fixes:

  • Standardized the use of double instead of float suffixes in telemetry data structures, and replaced std::max with mathlib::max for consistency. [1] [2] [3]
  • Removed an unused source file (SpatialDynamics.cpp) from the core sources.
  • Updated includes to use the new MathLib.h header and cleaned up legacy includes. [1] [2]

Other changes:

  • Removed the addition of the DSFE_Unit_Tests subdirectory

SaltyJoss added 30 commits May 16, 2026 10:28
…inematics` using the Scalar typename

* Each header includes the corresponding .inl file holding the templated methods, thus improving code readability and scalability
…grator` class that contains Scalar typenames

 * Fixed smaller logic bugs in implicit euler and midpoint
…bers, using Scalar typename alongsideinlined oeprators.
…ce risk of uninitialised arrays (means reduced overflow risk)
…sts`, separating each subset of tests into its own .exe
… RK2 harmonic oscillator state and sensitivity tests (rather than a much smaller 1e-5), separating state, sensitivity, and energy tolerances
…nalytical and fdm Jacobians, aswell as exploring the cross-variable propogation of coupled non-linear systems
 * ALL TESTS PASS, given they are basic, but my logic is good
 * Though my brain is frazzled by the abstraction, i am going to try get the implicit testing done relatiove to the dual numbers
 * This is going to change, however, I want something that fits with the current templating.
SaltyJoss added 23 commits May 25, 2026 11:13
…d result definitions in `step_impl`, need to furhter explore BETTER methods

 * This is why we have a logger... looks cool and helps generally but is a godsend when debugging!
TODO
 * Once confirmed this is fully working I am going to change the logic to have a template scratch cache owned by trhe executation context
 * Leaving this here because I am going bowling

TODO
 * Reimplement friction model
 * Improve friction model using LPV??
 * Will actual refine later down the line, do not really understand some of the better models, so I need to research and make sure my understanding matches what I am implementing!
 * Also I am soon going to be working on getting BASIC particle dynamics (iteractions implemented) --> This is a big goal
…r until I have developed my understanding further, this is in addition to sorting some other aspects of my core implementation out.

 * I am so fed up of the current debugging (that has lasted for a week) and since this is a personal project I can sort of just let it be for now.
 * I am leaving the current code in, just removing any enablers (i.e. switches) to turn it to AD... I am going to correct and fix this once I am confident in my underwstanding.
…ity implementation and execution

 * There are way too many changes to log (bad VC I know)
 * I decided to go abck through and see if any of the problems were missing params, or bad logic rather than purely mathematical
 * I am no renabling commented out coriolis and friction in dynamics
…n `spatial_jacobian`

 * I am almost certain remaining errros reside in my clearning, resizing, and calling of `DynamicsScratch` and `DynamicsResults`
 * I am now going to merge this with ANOTHER branch (it will be named `Dev/template_refactor_code_cleanup`, in order to focus on correcting template syntax and general code pipeline, I have found that I am struggling to mentally visualise some parts of my code, and I think this is down to rapid development. The resolution I have is to spend some time basically house cleaning (which for me means correcting and cleaning code), aswell as starting the process of prepping DSFE for not just ROBOT SYSTEMs, this may mean a bigger refactor of how I step in time, with a more general method (maybe, or that I actually just have many steppers for each sub project, robotsystems being one, particledynamics being another, stellardynamics being another)
… header and into the DualNumber header, updating relevant methods with new fmod
…(leading to O(N^2)) in `automaticDifferentitationJacobian`
… x_real var in `newton_raphson` after ten iterations
…int rather than constant across all joints.
…move results window, just have it inhouse again, but safely).
… the non-templated VecX (VecX_T<double> def) rather than ambiguous templating of vector type

 * And just like that it works, there are many smaller issues I have noted to fix, but again I am really on the edge of my understanding here.
 * Next up for a change of pace is going to be the particle dynamics, but first that means making a functional state-driven workspace system in the GUI -> I am planning on  really orientating this towards a visual proof, then going back and rebuilding the CLI batch to match newer logic -> Since I am no longer being graded on this (for now) it allows me to enjoy the process in my own way! :)
@SaltyJoss SaltyJoss self-assigned this May 31, 2026
@SaltyJoss SaltyJoss added documentation Improvements or additions to documentation feature New feature or request fixes fixing existing issues refactor labels May 31, 2026
@SaltyJoss SaltyJoss merged commit 9c7ac84 into Dev May 31, 2026
2 checks passed
@SaltyJoss SaltyJoss deleted the Template_refactor_code_cleanup branch June 2, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature New feature or request fixes fixing existing issues refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant