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

Update documentation of JointModel.shortname in python bindings #1892

Merged
merged 1 commit into from Mar 15, 2023

Conversation

Danfoa
Copy link
Contributor

@Danfoa Danfoa commented Mar 14, 2023

Following the discussion of issue #802, this PR presents an update to the documentation of the shortname function for the python class JointModel exposed by Boost.python.

This function is the only way to determine the joint type in python and was previously left undocumented.

The new function documentation describes the following possible cases:

            - JointModelR[*]: Revolute Joint, with rotation axis [*] ∈ [X,Y,Z]
            - JointModelRevoluteUnaligned: Revolute Joint, with rotation axis not aligned with X, Y, nor Z
            - JointModelRUB[*]: Unbounded revolute Joint (without position limits), with rotation axis [*] ∈ [X,Y,Z]
            - JointModelRevoluteUnboundedUnaligned: Unbounded revolute Joint, with rotation axis not aligned with X, Y, nor Z
            - JointModelP[*]: Prismatic Joint, with rotation axis [*] ∈ [X,Y,Z]
            - JointModelPlanar: Planar joint
            - JointModelPrismaticUnaligned: Prismatic joint, with translation axis not aligned with X, Y, nor Z
            - JointModelSphericalZYX: Spherical joint (3D rotation)
            - JointModelTranslation: Translation joint (3D translation)
            - JointModelFreeFlyer: Joint enabling 3D rotation and translations.

If there are any other possible outputs of JointModel.shortname please let me know to update the docstring.

Some questions emerge after understanding the shortname method: After a robot is loaded in Pinocchio, all of its joints are exposed to python as JointModel class instances. However, there are also specific joint-type classes exposed to python (e.g., JointModelFreeFlyer, JointModelRUBY) which led me to think that a more elegant and pythonic way of identifying the joint type is by use of isinstanceof method (e.g., isinstanceof(joint, JointModelRUBY)). This if, the robot joints were instantiated as specific joint type classes instead of the generic JointModel.

  • Why are joints instantiated after robot load as JointModel and not as instances of the joint-type specific class?

@Danfoa Danfoa force-pushed the devel branch 2 times, most recently from 0e1cbb2 to 1d830a6 Compare March 14, 2023 17:30
jcarpent
jcarpent previously approved these changes Mar 14, 2023
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.

Nice initiative @Danfoa.
Thanks a lot. It will help others for sure.

@jcarpent
Copy link
Contributor

Some questions emerge after understanding the shortname method: After a robot is loaded in Pinocchio, all of its joints are exposed to python as JointModel class instances. However, there are also specific joint-type classes exposed to python (e.g., JointModelFreeFlyer, JointModelRUBY) which led me to think that a more elegant and pythonic way of identifying the joint type is by use of isinstanceof method (e.g., isinstanceof(joint, JointModelRUBY)). This if, the robot joints were instantiated as specific joint type classes instead of the generic JointModel.

*

This is what is done in Pinocchio 3x. SHould arrive soon.

1 similar comment
@jcarpent
Copy link
Contributor

Some questions emerge after understanding the shortname method: After a robot is loaded in Pinocchio, all of its joints are exposed to python as JointModel class instances. However, there are also specific joint-type classes exposed to python (e.g., JointModelFreeFlyer, JointModelRUBY) which led me to think that a more elegant and pythonic way of identifying the joint type is by use of isinstanceof method (e.g., isinstanceof(joint, JointModelRUBY)). This if, the robot joints were instantiated as specific joint type classes instead of the generic JointModel.

*

This is what is done in Pinocchio 3x. SHould arrive soon.

@jcarpent jcarpent merged commit 73986ed into stack-of-tasks:devel Mar 15, 2023
11 checks passed
@thanhndv212
Copy link

thanhndv212 commented May 17, 2023

Hello. I would like to ask a question here, because I encounter issues related to this PR when I try to retrieve the joint axis in python. I have used a robot with urdf model in which some revolute joints have joint axis defined as <axis xyz="0 0 -1"/> . Meanwhile it is quite clear that this revolute joint has joint axis along Z, but in pinocchio, it is classified as JointModelRevoluteUnaligned.
I have 2 questions:

  • 1st, is there a way to retrieve the joint axis, even in the case of JointModelRevoluteUnaligned such as getting the values of <axis xyz=" ..."/> in python?
  • 2nd, (more like suggestion): shouldn't the case of <axis xyz="..."/> that has value "-1 0 0", or "0 -1 0", or "0 0 -1" be also classified as JointModelR[*]?
    Thank you very much.

@jcarpent
Copy link
Contributor

The feature to retrieve the joint axis is available in the preview of Pinocchio 3x, but not yet incorporated within Pinocchio 2x.

For the second point, we will add this feature soon to account properly for negative values within Pinocchio 3x.

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.

None yet

3 participants