Skip to content

Add getters for joint velocity, effort, and position limits#3272

Merged
arjo129 merged 9 commits intogazebosim:mainfrom
naitikpahwa18:joint-velocity-limits-2664
Feb 8, 2026
Merged

Add getters for joint velocity, effort, and position limits#3272
arjo129 merged 9 commits intogazebosim:mainfrom
naitikpahwa18:joint-velocity-limits-2664

Conversation

@naitikpahwa18
Copy link
Copy Markdown
Contributor

@naitikpahwa18 naitikpahwa18 commented Jan 19, 2026

🎉 New feature

Closes #2664

Summary

This PR adds getter APIs for retrieving joint velocity, effort, and position limits.

gz::sim::Joint already provides setter methods for velocity limits, but
no corresponding getter. This change adds Joint::VelocityLimits(), which
reads the limit from the existing components::JointAxis state
(sdf::JointAxis::MaxVelocity), including support for multi-axis joints.

In addition, this PR also introduces getter methods for effort and position
limits for completeness and API symmetry with the existing setters.

Test it

ctest -R Joint_TEST

Checklist

  • Signed all commits for DCO
  • Added tests

Copilot AI review requested due to automatic review settings January 19, 2026 09:34
Copy link
Copy Markdown
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 a getter method VelocityLimits() to the gz::sim::Joint class to retrieve joint velocity limits from existing component state, complementing the existing SetVelocityLimits() setter method.

Changes:

  • Added Joint::VelocityLimits() public API method that returns velocity limits as std::optional<std::vector<gz::math::Vector2d>>
  • Implementation reads from components::JointAxis and components::JointAxis2 components and converts MaxVelocity() values into symmetric limit ranges
  • Added unit test covering multi-axis joint case

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
include/gz/sim/Joint.hh Added public API declaration with comprehensive documentation for VelocityLimits() getter method
src/Joint.cc Implemented VelocityLimits() method that reads from JointAxis components and constructs symmetric velocity limits
src/Joint_TEST.cc Added VelocityLimitsMultiAxis test case to verify multi-axis joint limit retrieval

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Joint_TEST.cc Outdated
Copy link
Copy Markdown
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

Thanks for iterating and re-opening a new PR. I think we should change this to just return a std::vector<double>. In the future if SDF supports asymetric max and min values we can add a function for retrieving min velocity.

Comment thread include/gz/sim/Joint.hh Outdated
@github-project-automation github-project-automation Bot moved this from Inbox to In review in Core development Jan 20, 2026
Copy link
Copy Markdown
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

Thanks for the iteration, one last small knit. Lets put Max somewhere in the function name.

Comment thread include/gz/sim/Joint.hh Outdated
Comment thread include/gz/sim/Joint.hh Outdated
@arjo129
Copy link
Copy Markdown
Contributor

arjo129 commented Jan 20, 2026

CI is complaining about line length, also would be worth updating the python bindings here: https://github.com/gazebosim/gz-sim/blob/gz-sim10/python/src/gz/sim/Joint.cc

If you cant update the python bindings open a ticket on the issue tracker so we remember to do it at some point.

@naitikpahwa18
Copy link
Copy Markdown
Contributor Author

I’ve applied the requested changes (API rename to MaxVelocityLimits, updated Python bindings and fix line length).

@naitikpahwa18
Copy link
Copy Markdown
Contributor Author

@arjo129 I’m seeing multiple CI failures related to Joint_TEST. Could you please advise if you’d like any changes from my side?

@arjo129
Copy link
Copy Markdown
Contributor

arjo129 commented Jan 21, 2026

Can you fix the style complaints?
https://github.com/gazebosim/gz-sim/actions/runs/21163230348/job/60866147875#step:5:1

I'm guessing the issues arise from bazel as those are the runners that are failing to compile.

@naitikpahwa18
Copy link
Copy Markdown
Contributor Author

Fixed style issues and added missing JointAxis include in Joint_TEST. CI is re-running.

@naitikpahwa18 naitikpahwa18 requested a review from arjo129 January 21, 2026 21:47
@naitikpahwa18
Copy link
Copy Markdown
Contributor Author

Hi @arjo129, just a quick reminder to check this out when you get a chance. Thanks!

@naitikpahwa18 naitikpahwa18 force-pushed the joint-velocity-limits-2664 branch from 5716d99 to a12cda4 Compare January 27, 2026 22:54
Copy link
Copy Markdown
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

Thanks for the iteration

@naitikpahwa18 naitikpahwa18 force-pushed the joint-velocity-limits-2664 branch from a12cda4 to dd97296 Compare January 31, 2026 20:45
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
Signed-off-by: Naitik Pahwa <naitikpahwa18@users.noreply.github.com>
@naitikpahwa18 naitikpahwa18 force-pushed the joint-velocity-limits-2664 branch from dd97296 to 7ddf729 Compare January 31, 2026 20:46
@naitikpahwa18
Copy link
Copy Markdown
Contributor Author

Hi @arjo129, I’ve added effort and position limit getters following the MaxVelocityLimits pattern, with unit tests included. This should complete the current issue. Let me know if any changes are needed.

@naitikpahwa18 naitikpahwa18 requested a review from arjo129 February 1, 2026 08:39
Copy link
Copy Markdown
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

Thanks for the iteration on this PR.

@arjo129 arjo129 self-requested a review February 2, 2026 05:16
@naitikpahwa18 naitikpahwa18 changed the title Add Joint::VelocityLimits getter Add getters for joint velocity, effort, and position limits Feb 5, 2026
@naitikpahwa18
Copy link
Copy Markdown
Contributor Author

Hi @arjo129, just a quick reminder to check this out when you get a chance. Thanks!

@arjo129 arjo129 merged commit f986646 into gazebosim:main Feb 8, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Core development Feb 8, 2026
@naitikpahwa18 naitikpahwa18 deleted the joint-velocity-limits-2664 branch February 11, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants