Skip to content

Fix XACRO joint alignment and precision for IKFast compatibility#1021

Open
oguzhanbzglu wants to merge 1 commit intoros-controls:masterfrom
oguzhanbzglu:fix/urdf_r6bot
Open

Fix XACRO joint alignment and precision for IKFast compatibility#1021
oguzhanbzglu wants to merge 1 commit intoros-controls:masterfrom
oguzhanbzglu:fix/urdf_r6bot

Conversation

@oguzhanbzglu
Copy link

@oguzhanbzglu oguzhanbzglu commented Jan 21, 2026

Description

This PR fixes the R6bot URDF to make it compatible with IKFast solver generation using tools like pyikfast. The original URDF contained joint misalignments and excessive decimal precision that prevented successful IKFast compilation.

Problem

When attempting to generate an IKFast solver for the R6bot using pyikfast, the process fails because it cannot find solution or try to solve (waited couple hours). The main causes were:

  1. Excessive decimal precision: Joint origin values contain too many decimal places

    • Example: xyz="0.518777 0 0.067458" (6 decimals)
    • IKFast/OpenRAVE does not handle large decimal numbers well, as they produce very large fractions and slow down or prevent solver generation
  2. Joint misalignment: Non-axis-aligned joints cause solver generation to fail

    • IKFast requires joints aligned to standard axes where possible

Changes

  • Rounded joint origin XYZ positions to 3 decimal places and replaced the joint positions
    • Before: xyz="0.518777 0 0.067458"
    • After: xyz="0.519 0 0.067"
  • Evaluated RPY expression simpler
    • Before: rpy="${pi/6+pi} 0 ${pi/3}"
    • After: rpy="${pi} 0 ${pi/2}" (or rpy="0 0 0" where applicable)
  • Realigned joints to standard axes where geometrically valid
  • Kept the original kinematic chain and joint hierarchy unchanged
  • No changes to robot geometry or motion behavior

After changes mentioned above, IKFast successfully generated solution.

This is how robot joints look:

image

@mergify
Copy link
Contributor

mergify bot commented Jan 21, 2026

@oguzhanbzglu, all pull requests must be targeted towards the master development branch.
Once merged into master, it is possible to backport to jazzy, but it must be in master
to have these changes reflected into new distributions.

@oguzhanbzglu oguzhanbzglu changed the base branch from jazzy to master January 21, 2026 17:35
@mergify
Copy link
Contributor

mergify bot commented Jan 21, 2026

This pull request is in conflict. Could you fix it @oguzhanbzglu?

@oguzhanbzglu oguzhanbzglu changed the base branch from master to jazzy January 21, 2026 17:36
@mergify
Copy link
Contributor

mergify bot commented Jan 21, 2026

@oguzhanbzglu, all pull requests must be targeted towards the master development branch.
Once merged into master, it is possible to backport to jazzy, but it must be in master
to have these changes reflected into new distributions.

@destogl destogl changed the base branch from jazzy to master January 21, 2026 18:38
@destogl destogl changed the base branch from master to jazzy January 21, 2026 18:39
@mergify
Copy link
Contributor

mergify bot commented Jan 21, 2026

@oguzhanbzglu, all pull requests must be targeted towards the master development branch.
Once merged into master, it is possible to backport to jazzy, but it must be in master
to have these changes reflected into new distributions.

<parent link="link_2"/>
<child link="link_3"/>
<origin xyz="0.685682 0 0.041861" rpy="0 ${pi} ${pi+pi/2}"/>
<origin xyz="0.686 0 -0.27" rpy="0 ${pi} ${pi+pi/2}"/>
Copy link
Member

@christophfroehlich christophfroehlich Jan 22, 2026

Choose a reason for hiding this comment

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

you change the xacro macro in line 104, but here it is OK? I don't think this is a problem. If IKfast is not capable of importing xacro, then you have to process with xacro first and pass the plain URDF.

Copy link
Author

Choose a reason for hiding this comment

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

I use this xacro and take the plain urdf from the robot_description topic to parse IKfast, but the resulting URDF isn't suitable for IKFast; I'm simplifying it.

Copy link
Member

Choose a reason for hiding this comment

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

but then for sure the ${pi} macros are evaluated, and no need to change this in the xacro

Copy link
Member

Choose a reason for hiding this comment

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

so the literal 2 in the PR description above is outdated?

Copy link
Author

@oguzhanbzglu oguzhanbzglu Jan 22, 2026

Choose a reason for hiding this comment

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

Yes, sorry that was wrong description of the rpy expression (removed).
Basically, IKFast could not find solution for rpy calculations (pi/6 or pi/3) thus, I made them simpler and worked.

Copy link
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Please rebase your changes on top of master and change the HEAD of this PR.

@mergify
Copy link
Contributor

mergify bot commented Jan 22, 2026

This pull request is in conflict. Could you fix it @oguzhanbzglu?

@oguzhanbzglu oguzhanbzglu changed the base branch from jazzy to master January 22, 2026 08:21
@oguzhanbzglu oguzhanbzglu changed the title Fix URDF joint alignment and precision for IKFast compatibility Fix XACRO joint alignment and precision for IKFast compatibility Jan 22, 2026
@oguzhanbzglu
Copy link
Author

This is how robot is positioned in zeros after changes.
Followed the example_7 tutorial and tested with send_trajectory.launch.py, everything works as expected.

image

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