Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test vector transport and its inverse with dIntegrateTransport #2273

Merged
merged 7 commits into from
Jun 6, 2024

Conversation

fabinsch
Copy link
Contributor

@fabinsch fabinsch commented Jun 4, 2024

Hi, I propose adding another test for the dIntegrateTransport function to check its "inverse" by using the reverse path. I use this function for vector transport along different manifolds.

@ManifoldFR
Copy link
Member

Great contribution @fabinsch ! Can you also test for matrices ? It should still work the same

@fabinsch
Copy link
Contributor Author

fabinsch commented Jun 4, 2024

Sure, I will extend it for matrices. One point for me was to check if it actually works for a single vector (np.array), as the function doc explicitly speaks about "transporting a matrix". But as the doc string states correctly, only the row size matters and this was tested here.

In [2]: pin.dIntegrateTransport?
Docstring:
dIntegrateTransport( (Model)model, (numpy.ndarray)q, (numpy.ndarray)v, (numpy.ndarray)Jin, (ArgumentPosition)argument_position) -> numpy.ndarray :
    Takes a matrix expressed at q (+) v and uses parallel transport to express it in the tangent space at q.    This operation does the product of the matrix by the Jacobian of the integration operation, but more efficiently.Parameters:
        model: model of the kinematic tree
        q: the joint configuration vector (size model.nq)
        v: the joint velocity vector (size model.nv)
        Jin: the input matrix (row size model.nv)

@ManifoldFR
Copy link
Member

perfect!

ManifoldFR
ManifoldFR previously approved these changes Jun 4, 2024
@ManifoldFR ManifoldFR enabled auto-merge June 4, 2024 09:45
Copy link
Contributor

@jcarpent jcarpent left a comment

Choose a reason for hiding this comment

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

Does this test already exist in C++?

@jcarpent jcarpent disabled auto-merge June 4, 2024 10:21
@fabinsch
Copy link
Contributor Author

fabinsch commented Jun 4, 2024

Does this test already exist in C++?

we are currently testing this in our cpp unittests for dIntegrateTransport which is not exactly the same as my test I think.

@jcarpent
Copy link
Contributor

jcarpent commented Jun 4, 2024

Could you add it in C++ instead of Python then?

@jcarpent jcarpent force-pushed the add-py-unittest-transport branch 2 times, most recently from 49b4c89 to 30a9ad4 Compare June 5, 2024 05:03
@fabinsch fabinsch force-pushed the add-py-unittest-transport branch 2 times, most recently from cd66eec to 6e4be1e Compare June 5, 2024 16:03
@fabinsch fabinsch force-pushed the add-py-unittest-transport branch from 6e4be1e to f2db9df Compare June 5, 2024 16:31
Copy link
Collaborator

@stephane-caron stephane-caron left a comment

Choose a reason for hiding this comment

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

(Minor comment.)

unittest/python/bindings_liegroups.py Outdated Show resolved Hide resolved
@fabinsch fabinsch requested a review from stephane-caron June 6, 2024 08:27
@jcarpent jcarpent merged commit 3c4f3fd into stack-of-tasks:devel Jun 6, 2024
13 of 15 checks passed
// test reverse direction
TangentVector_t v_r = -v; // reverse path
ConfigVector_t qa_r = lg.integrate(qb, v_r);
lg.dIntegrateTransport(qa_r, v_r, tvec_at_qa, tvec_at_qa_r, ARG0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be dIntegrateTransport(qb, v_r, tvec_at_qa, ...)?

Since we check that qa is equal to qa_r below, this line amounts to integrating $v_r$ from $qa_r$, where we will end... Somewhere else than $q_a$ or $q_b$ 😅

Meanwhile this line would fully make sense to me if we start from $q_b$: then $q_b \oplus v_r$ would land on $q_{ar} = q_a$, where we take tvec_at_qa, and transport it back to $q_b$, which is why we have the equality between tvec_at_qb and tvec_at_qa_r below. (But then, tvec_at_qa_r lies in the tangent space at $q_b$, not $q_{ar}$! 😛)

@fabinsch I understand the test passed so I must have missed something. If you can double check at some point that would be 👌

Copy link
Collaborator

Choose a reason for hiding this comment

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

Meanwhile I fully agree with the Python variant.

nim65s added a commit to nim65s/robotpkg that referenced this pull request Oct 9, 2024
    ## [3.2.0] - 2024-08-27

    ### Fixed
    - Append pinocchio optional libraries into pkg-config file (stack-of-tasks/pinocchio#2322)
    - Fixed support of DAE meshes with MeshCat (stack-of-tasks/pinocchio#2331)
    - Fixed pointer casts in urdf parser (stack-of-tasks/pinocchio#2339)
    - Remove CMake CMP0167 warnings (stack-of-tasks/pinocchio#2347)
    - Fixed urdfdom in ROS packaging (stack-of-tasks/pinocchio#2341)
    - Fixed overview-urdf cpp example (stack-of-tasks/pinocchio#2384)
    - Fixed mjcf model without a base link parsing (stack-of-tasks/pinocchio#2386)
    - Fixed talos-simulation.py, simulation-contact-dynamics.py and simulation-closed-kinematic-chains.py examples (stack-of-tasks/pinocchio#2392)

    ### Added
    - Add getMotionAxis method to helical, prismatic, revolute and ubounded revolute joint (stack-of-tasks/pinocchio#2315)
    - Add initial compatiblity with coal (coal needs `-DCOAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL=ON`) (stack-of-tasks/pinocchio#2323)
    - Add compatibility with jrl-cmakemodules workspace (stack-of-tasks/pinocchio#2333)
    - Add ``collision_color`` parameter to `MeshcatVisualizer.loadViewerModel` (stack-of-tasks/pinocchio#2350)
    - Add ``BuildFromMJCF`` function to RobotWrapper (stack-of-tasks/pinocchio#2363)
    - Add more CasADi examples (stack-of-tasks/pinocchio#2388)

    ### Removed
    - Remove deprecated headers related to joint constraints (stack-of-tasks/pinocchio#2382)

    ### Changed
    - Use eigenpy to expose `GeometryObject::meshMaterial` variant (stack-of-tasks/pinocchio#2315)
    - GepettoViewer is no more the default viewer for RobotWrapper (stack-of-tasks/pinocchio#2331)
    - Modernize python code base with ruff (stack-of-tasks/pinocchio#2367)
    - Restructure CppAD and CasADi examples (stack-of-tasks/pinocchio#2388)
    - Enhance and fix CppAD benchmarks outputs (stack-of-tasks/pinocchio#2393)

    ## [3.1.0] - 2024-07-04

    ### Fixed

    - Fix `appendModel` when joints after the base are in parallel (stack-of-tasks/pinocchio#2295)
    - Fix `appendModel` build when called with template arguments different than the ones from `context` (stack-of-tasks/pinocchio#2284)
    - Fix `TransformRevoleTpl::rotation` and `TransformHelicalTpl::rotation` build (stack-of-tasks/pinocchio#2284)
    - Fix compilation issue for Boost 1.85 (stack-of-tasks/pinocchio#2255)
    - Fix python bindings of `contactInverseDynamics` (stack-of-tasks/pinocchio#2263)
    - Deactivate `BUILD_WITH_LIBPYTHON` when building with PyPy (stack-of-tasks/pinocchio#2274)
    - Fix Python bindings cross building with `hpp-fcl` (stack-of-tasks/pinocchio#2288)
    - Fix build issue on Windows when a deprecated header is included (stack-of-tasks/pinocchio#2292)
    - Fix build issue on Windows when building in Debug mode (stack-of-tasks/pinocchio#2292)
    - Fix visualization of meshes in meshcat (stack-of-tasks/pinocchio#2294)
    - Fix Anymal simulation test (stack-of-tasks/pinocchio#2299)
    - Fix contact derivatives and impulse dynamics tests (stack-of-tasks/pinocchio#2300)
    - Fix CMake compatibility with old console_bridge version (stack-of-tasks/pinocchio#2312)

    ### Added

    - Python unittest for `contactInverseDynamics` function (stack-of-tasks/pinocchio#2263)
    - Added helper functions to return operation count of CasADi functions. (stack-of-tasks/pinocchio#2275)
    - C++ and Python unittest for `dIntegrateTransport` to check vector transport and its inverse (stack-of-tasks/pinocchio#2273)
    - Add kinetic and potential energy regressors (stack-of-tasks/pinocchio#2282)

    ### Removed

    - Remove header `list.hpp` include for bindings of model and rnea (stack-of-tasks/pinocchio#2263)

Packaging Changes:
- Removed patches af, an, ap: fixed upstream
- Updated patches ag, ak
nim65s added a commit to nim65s/robotpkg that referenced this pull request Oct 11, 2024
    ## [3.2.0] - 2024-08-27

    ### Fixed
    - Append pinocchio optional libraries into pkg-config file (stack-of-tasks/pinocchio#2322)
    - Fixed support of DAE meshes with MeshCat (stack-of-tasks/pinocchio#2331)
    - Fixed pointer casts in urdf parser (stack-of-tasks/pinocchio#2339)
    - Remove CMake CMP0167 warnings (stack-of-tasks/pinocchio#2347)
    - Fixed urdfdom in ROS packaging (stack-of-tasks/pinocchio#2341)
    - Fixed overview-urdf cpp example (stack-of-tasks/pinocchio#2384)
    - Fixed mjcf model without a base link parsing (stack-of-tasks/pinocchio#2386)
    - Fixed talos-simulation.py, simulation-contact-dynamics.py and simulation-closed-kinematic-chains.py examples (stack-of-tasks/pinocchio#2392)

    ### Added
    - Add getMotionAxis method to helical, prismatic, revolute and ubounded revolute joint (stack-of-tasks/pinocchio#2315)
    - Add initial compatiblity with coal (coal needs `-DCOAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL=ON`) (stack-of-tasks/pinocchio#2323)
    - Add compatibility with jrl-cmakemodules workspace (stack-of-tasks/pinocchio#2333)
    - Add ``collision_color`` parameter to `MeshcatVisualizer.loadViewerModel` (stack-of-tasks/pinocchio#2350)
    - Add ``BuildFromMJCF`` function to RobotWrapper (stack-of-tasks/pinocchio#2363)
    - Add more CasADi examples (stack-of-tasks/pinocchio#2388)

    ### Removed
    - Remove deprecated headers related to joint constraints (stack-of-tasks/pinocchio#2382)

    ### Changed
    - Use eigenpy to expose `GeometryObject::meshMaterial` variant (stack-of-tasks/pinocchio#2315)
    - GepettoViewer is no more the default viewer for RobotWrapper (stack-of-tasks/pinocchio#2331)
    - Modernize python code base with ruff (stack-of-tasks/pinocchio#2367)
    - Restructure CppAD and CasADi examples (stack-of-tasks/pinocchio#2388)
    - Enhance and fix CppAD benchmarks outputs (stack-of-tasks/pinocchio#2393)

    ## [3.1.0] - 2024-07-04

    ### Fixed

    - Fix `appendModel` when joints after the base are in parallel (stack-of-tasks/pinocchio#2295)
    - Fix `appendModel` build when called with template arguments different than the ones from `context` (stack-of-tasks/pinocchio#2284)
    - Fix `TransformRevoleTpl::rotation` and `TransformHelicalTpl::rotation` build (stack-of-tasks/pinocchio#2284)
    - Fix compilation issue for Boost 1.85 (stack-of-tasks/pinocchio#2255)
    - Fix python bindings of `contactInverseDynamics` (stack-of-tasks/pinocchio#2263)
    - Deactivate `BUILD_WITH_LIBPYTHON` when building with PyPy (stack-of-tasks/pinocchio#2274)
    - Fix Python bindings cross building with `hpp-fcl` (stack-of-tasks/pinocchio#2288)
    - Fix build issue on Windows when a deprecated header is included (stack-of-tasks/pinocchio#2292)
    - Fix build issue on Windows when building in Debug mode (stack-of-tasks/pinocchio#2292)
    - Fix visualization of meshes in meshcat (stack-of-tasks/pinocchio#2294)
    - Fix Anymal simulation test (stack-of-tasks/pinocchio#2299)
    - Fix contact derivatives and impulse dynamics tests (stack-of-tasks/pinocchio#2300)
    - Fix CMake compatibility with old console_bridge version (stack-of-tasks/pinocchio#2312)

    ### Added

    - Python unittest for `contactInverseDynamics` function (stack-of-tasks/pinocchio#2263)
    - Added helper functions to return operation count of CasADi functions. (stack-of-tasks/pinocchio#2275)
    - C++ and Python unittest for `dIntegrateTransport` to check vector transport and its inverse (stack-of-tasks/pinocchio#2273)
    - Add kinetic and potential energy regressors (stack-of-tasks/pinocchio#2282)

    ### Removed

    - Remove header `list.hpp` include for bindings of model and rnea (stack-of-tasks/pinocchio#2263)

Packaging Changes:
- Removed patches af, an, ap: fixed upstream
- Updated patches ag, ak
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.

4 participants