Skip to content

Conversation

solangegbv
Copy link
Collaborator

Add plot backup, full-JAX PCS planar + Gaussian quadrature integration scheme

the planar_pcs_num.py file.
Correct a description of function in the planar_pcs.py file.
callable from other files for comparison purposes with the users choice parameters :
- option of saving or not the results, figures, videos
- option of plotting/printing or not the results, figures
- option on the type of derivation to use : symbolic, numeric
- option on the type of integration and parameter of integration to use : gauss, trapezoid
- option on the type of jacobian to use : explicit or autodifferentiation

Added the ability to save simulation results in pickle files (.pkl) for later comparison

Set up an explicit Jacobian in SE3 to compute B and G
- SE(3) Lie algebra operators
- convert SE(2) to SE(3) to use operators for the planar case
Implementation of a Gauss-Kronrad quadrature integration using the quadax library
Function documentation

# Triangular mask for partial sum: (N, N)
# mask[i, j] = 1 if j >= i and j <= idx
mask = (jnp.arange(N)[:, None] <= jnp.arange(N)[None, :]) & (jnp.arange(N)[None, :] <= idx)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this is the case, but when you use jnp.arange(N) and N changes (because you maybe call this function with matrices M of different dimensionalities), then this will trigger a re-compile which can slow down things a lot.

Please use the jax.log_compiles context manger (https://docs.jax.dev/en/latest/_autosummary/jax.log_compiles.html) or the JAX_LOG_COMPILES=1 (https://docs.jax.dev/en/latest/config_options.html) environment variable to check for recompiles during evaluation.

get rid of jnp.array when possible, benchmark and tests on eps.
Autodiff: for loop calculation corrected
Explicit: implementation of explicit calculation using Lie algebra
Various tests
kinetic energy depends only on B and does not need to calculate other dynamic matrices
Correction of documentations
Corrected documentation
Removal of unnecessary imports
Ready to merge
Copy link
Contributor

@mstoelzle mstoelzle left a comment

Choose a reason for hiding this comment

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

Almost looks good and definitely going into the right direction! I will have a closer look towards the end of the week.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please make it (also) compatible with an automated test execution (i.e., by the pytest package)?

I think the GUI-based validation is very nice and you can keep it in a part that is isolated in a if __name__ == "__main__": condition (i.e., it is only executed if the test file is called from the command line). The automated tests would live in separate functions that are directly called by pytest.

@mstoelzle mstoelzle merged commit b7944dc into main Jul 21, 2025
24 checks passed
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