Add getters for joint velocity, effort, and position limits#3272
Add getters for joint velocity, effort, and position limits#3272arjo129 merged 9 commits intogazebosim:mainfrom
Conversation
There was a problem hiding this comment.
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 asstd::optional<std::vector<gz::math::Vector2d>> - Implementation reads from
components::JointAxisandcomponents::JointAxis2components and convertsMaxVelocity()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.
arjo129
left a comment
There was a problem hiding this comment.
Thanks for the iteration, one last small knit. Lets put Max somewhere in the function name.
|
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. |
|
I’ve applied the requested changes (API rename to MaxVelocityLimits, updated Python bindings and fix line length). |
|
@arjo129 I’m seeing multiple CI failures related to Joint_TEST. Could you please advise if you’d like any changes from my side? |
|
Can you fix the style complaints? I'm guessing the issues arise from bazel as those are the runners that are failing to compile. |
|
Fixed style issues and added missing JointAxis include in Joint_TEST. CI is re-running. |
|
Hi @arjo129, just a quick reminder to check this out when you get a chance. Thanks! |
5716d99 to
a12cda4
Compare
arjo129
left a comment
There was a problem hiding this comment.
Thanks for the iteration
a12cda4 to
dd97296
Compare
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>
dd97296 to
7ddf729
Compare
|
Hi @arjo129, I’ve added effort and position limit getters following the |
arjo129
left a comment
There was a problem hiding this comment.
Thanks for the iteration on this PR.
|
Hi @arjo129, just a quick reminder to check this out when you get a chance. Thanks! |
🎉 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