Skip to content

Conversation

@Giulero
Copy link
Collaborator

@Giulero Giulero commented Jul 22, 2025

This pull request enhances the inverse kinematics solver in src/adam/casadi/inverse_kinematics.py by introducing new features and improving code clarity. The key changes include the addition of a homogeneous transformation matrix for the base, a new method to retrieve optimization variables, and functionality to add custom cost terms to the optimization problem.

New features:

  • Homogeneous transformation matrix:

    • Added self.base_homogeneous, which computes the homogeneous transformation matrix of the base using its position and quaternion. ([src/adam/casadi/inverse_kinematics.pyR64-R66](https://github.com/gbionics/adam/pull/130/files#diff-92636529c4bff705bc52b6921d13c06319f84c74610c40fc35d376e6a589d8a7R64-R66))
  • Retrieve optimization variables:

    • Introduced the get_opti_variables method, which returns a dictionary of all optimization variables, including the new homogeneous transformation matrix. ([src/adam/casadi/inverse_kinematics.pyR88-R106](https://github.com/gbionics/adam/pull/130/files#diff-92636529c4bff705bc52b6921d13c06319f84c74610c40fc35d376e6a589d8a7R88-R106))
  • Custom cost terms:

    • Added the add_cost method to allow users to add custom cost terms to the optimization problem, enhancing flexibility. ([src/adam/casadi/inverse_kinematics.pyR581-R589](https://github.com/gbionics/adam/pull/130/files#diff-92636529c4bff705bc52b6921d13c06319f84c74610c40fc35d376e6a589d8a7R581-R589))

📚 Documentation preview 📚: https://adam-docs--130.org.readthedocs.build/en/130/

@Giulero Giulero requested a review from Copilot July 22, 2025 09:58
Copy link
Contributor

Copilot AI left a comment

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 adds extensibility features to the inverse kinematics solver by introducing methods to retrieve optimization variables and add custom cost terms. The changes also include a precomputed homogeneous transformation matrix for the base.

  • Addition of get_opti_variables() method to expose optimization variables to users
  • Implementation of add_cost() method for adding custom cost terms to the optimization problem
  • Precomputation of base homogeneous transformation matrix from position and quaternion

- "base_pos": Position of the base (3D vector).
- "base_quat": Quaternion representing the base orientation (4D vector with x, y, z, w).
- "joint_var": Joint variables (1D vector with length equal to the number of joints).
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not remember how fixed joints are handled in adam, but I am not sure if this sentence is correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I am not sure about the "joint variables" name. Perhaps "joint positions" is more clear?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right! Done in 8e9caef

@GiulioRomualdi
Copy link
Collaborator

If @traversaro is fine I think we can merge it

@Giulero
Copy link
Collaborator Author

Giulero commented Sep 2, 2025

Thanks @traversaro and @GiulioRomualdi! :)

@Giulero Giulero merged commit b9c816b into main Sep 2, 2025
11 of 18 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.

4 participants