Skip to content

Add joint effort and velocity limits handling - #1292

Merged
traversaro merged 12 commits into
gbionics:masterfrom
flferretti:effort_limit
Feb 10, 2026
Merged

Add joint effort and velocity limits handling#1292
traversaro merged 12 commits into
gbionics:masterfrom
flferretti:effort_limit

Conversation

@flferretti

Copy link
Copy Markdown
Member

This PR adds handling for joint effort and velocity limits. This has been propagated to model exporter and to the bindings.

Fixes #955
Fixes #958

C.C. @rob-mau

@flferretti

Copy link
Copy Markdown
Member Author

The problem stated in #955 is fixed:

twoLinks.urdf

<robot name="twoLinks">
    <link name="link1">
        <inertial>
            <mass value="1" />
            <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01" />
        </inertial>
    </link>
    <joint name="joint_1_2" type="revolute">
        <origin xyz="1 0 0" rpy="0 -0 0" />
        <axis xyz="0 0 1" />
        <parent link="link1" />
        <child link="link2" />
        <limit effort="1.56666666667" lower="-0.698131700798" upper="0.698131700798" velocity="21.2930168743"/>
    </joint>
    <link name="link2">
        <inertial>
            <mass value="1" />
            <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01" />
            <origin xyz="1 0 0" rpy="0 -0 0" />
        </inertial>
    </link>
</robot>

twoLinksModified.urdf

<?xml version="1.0"?>
<robot name="iDynTreeURDFModelExportModelName">
  <link name="link1">
    <inertial>
      <mass value="1"/>
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
    </inertial>
  </link>
  <joint name="joint_1_2" type="revolute">
    <origin xyz="1 0 0" rpy="0 -0 0"/>
    <axis xyz="0 0 1"/>
    <parent link="link1"/>
    <child link="link2"/>
    <limit lower="-0.698131700798" upper="0.698131700798" effort="1.56666666667" velocity="21.2930168743"/>
  </joint>
  <link name="link2">
    <inertial>
      <mass value="1"/>
      <origin xyz="1 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.010000000000000009" iyz="0" izz="0.010000000000000009"/>
    </inertial>
  </link>
</robot>

% check_urdf twoLinksModified.urdf

robot name is: iDynTreeURDFModelExportModelName
---------- Successfully Parsed XML ---------------
root Link: link1 has 1 child(ren)
    child(1):  link2

@traversaro

Copy link
Copy Markdown
Contributor

The problem stated in #955 is fixed:
twoLinks.urdf

twoLinksModified.urdf

<?xml version="1.0"?>
<robot name="iDynTreeURDFModelExportModelName">
  <link name="link1">
    <inertial>
      <mass value="1"/>
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
    </inertial>
  </link>
  <joint name="joint_1_2" type="revolute">
    <origin xyz="1 0 0" rpy="0 -0 0"/>
    <axis xyz="0 0 1"/>
    <parent link="link1"/>
    <child link="link2"/>
    <limit lower="-0.698131700798" upper="0.698131700798" effort="1.56666666667" velocity="21.2930168743"/>
  </joint>
  <link name="link2">
    <inertial>
      <mass value="1"/>
      <origin xyz="1 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.010000000000000009" iyz="0" izz="0.010000000000000009"/>
    </inertial>
  </link>
</robot>
% check_urdf twoLinksModified.urdf

robot name is: iDynTreeURDFModelExportModelName
---------- Successfully Parsed XML ---------------
root Link: link1 has 1 child(ren)
    child(1):  link2

Great, there is anything else to move this out of Draft?

@flferretti

Copy link
Copy Markdown
Member Author

The problem stated in #955 is fixed:
twoLinks.urdf
twoLinksModified.urdf

<?xml version="1.0"?>
<robot name="iDynTreeURDFModelExportModelName">
  <link name="link1">
    <inertial>
      <mass value="1"/>
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
    </inertial>
  </link>
  <joint name="joint_1_2" type="revolute">
    <origin xyz="1 0 0" rpy="0 -0 0"/>
    <axis xyz="0 0 1"/>
    <parent link="link1"/>
    <child link="link2"/>
    <limit lower="-0.698131700798" upper="0.698131700798" effort="1.56666666667" velocity="21.2930168743"/>
  </joint>
  <link name="link2">
    <inertial>
      <mass value="1"/>
      <origin xyz="1 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.010000000000000009" iyz="0" izz="0.010000000000000009"/>
    </inertial>
  </link>
</robot>
% check_urdf twoLinksModified.urdf

robot name is: iDynTreeURDFModelExportModelName
---------- Successfully Parsed XML ---------------
root Link: link1 has 1 child(ren)
    child(1):  link2

Great, there is anything else to move this out of Draft?

I'm adding the tests and verifying why the CI is failing

@flferretti

flferretti commented Feb 6, 2026

Copy link
Copy Markdown
Member Author

The CI failure was due to a missing constructor.

I've seen that there are no tests for the position limits. If you want I can add the tests also for that

@traversaro

Copy link
Copy Markdown
Contributor

I've seen that there are no tests for the position limits. If you want I can the tests also for that

Sure!

@flferretti
flferretti marked this pull request as ready for review February 6, 2026 15:12
@traversaro

Copy link
Copy Markdown
Contributor

Tests are failing.

@traversaro

Copy link
Copy Markdown
Contributor

Should we also modify the URDF parser (and not only the exporter) to parse this values?

@flferretti

flferretti commented Feb 10, 2026

Copy link
Copy Markdown
Member Author

Should we also modify the URDF parser (and not only the exporter) to parse this values?

This should be already available (

found = attributes.find("effort");
if (found != attributes.end())
{
double value = 0;
if (stringToDoubleWithClassicLocale(found->second->value(), value))
{
m_limits->effort = value;
}
}
found = attributes.find("velocity");
if (found != attributes.end())
{
double value = 0;
if (stringToDoubleWithClassicLocale(found->second->value(), value))
{
m_limits->velocity = value;
}
}
). In 286995b I added a couple of tests to verify the functionality

@traversaro

Copy link
Copy Markdown
Contributor

My bad, I had missed it!

@traversaro
traversaro merged commit ae2e715 into gbionics:master Feb 10, 2026
15 checks passed
@traversaro

Copy link
Copy Markdown
Contributor

This PR changes the ABI, so we need to bump the major version before the release. Do you want to also work on mesh-iit/creo2urdf#155 (comment) that would also break the ABI (due to the settings objects being plain structures and not pimpled-classes with setters and getters) so we can bump the major version only once?

@traversaro

Copy link
Copy Markdown
Contributor

Ah my bad, I did not noticed that the commit history was curated, and I squashed and merged.

@flferretti

Copy link
Copy Markdown
Member Author

This PR changes the ABI, so we need to bump the major version before the release. Do you want to also work on icub-tech-iit/creo2urdf#155 (comment) that would also break the ABI (due to the settings objects being plain structures and not pimpled-classes with setters and getters) so we can bump the major version only once?

Yes sure!

@flferretti

Copy link
Copy Markdown
Member Author

Ah my bad, I did not noticed that the commit history was curated, and I squashed and merged.

no worries :)

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.

Read velocity and effort limits from URDF files URDF export code exports malformed URDF models with limit tags but no velocity or effort attributes

2 participants