-
Notifications
You must be signed in to change notification settings - Fork 340
Add velocity limits component (#2664) #2818
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
base: gz-sim8
Are you sure you want to change the base?
Add velocity limits component (#2664) #2818
Conversation
Signed-off-by: Mohamed Zaghloul <[email protected]>
.vscode/settings.json
Outdated
@@ -0,0 +1,5 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this file
@@ -0,0 +1,55 @@ | |||
/* | |||
* Copyright (C) 2021 Open Source Robotics Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Copyright (C) 2021 Open Source Robotics Foundation | |
* Copyright (C) 2025 Open Source Robotics Foundation |
43c0fdd
to
984b20d
Compare
Hi @ahcorde, Thanks for the review! I’ve made the changes as suggested. I need some help with integrating joint velocity limits into the physics system. I’ve created the Looking forward to your feedback! Thanks! |
20bc4be
to
d979e3e
Compare
Signed-off-by: Mohamed Zaghloul <[email protected]>
e427306
to
03a0d8a
Compare
Signed-off-by: Mohamed Zaghloul <[email protected]>
03a0d8a
to
61f6477
Compare
src/Joint.cc
Outdated
const EntityComponentManager &_ecm) const | ||
{ | ||
return _ecm.ComponentData<components::JointVelocityLimits>( | ||
this->dataPtr->id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just get this information from the JointAxis
component, e.g.
auto jointAxis = _ecm.Component<components::JointAxis>(this->dataPtr->id);
if (jointAxis)
{
return jointAxis->Data().MaxVelocity();
}
For joint velocity, there is no lower or upper limit, but only just one velocity limit field
…omponent Signed-off-by: Mohamed Zaghloul <[email protected]>
…oul/gz-sim into add-joint-limit-methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iche033 can you review it one more time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a comment on the return type of the VelocityLimits
function
} | ||
|
||
////////////////////////////////////////////////// | ||
std::optional<gz::math::Vector2d> Joint::VelocityLimits( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a compile error here. The declaration in the header is std::optional<std::vector<gz::math::Vector2d>
but it is std::optional<gz::math::Vector2d>
here.
I think it should be std::optional<std::vector<gz::math::Vector2d>
so that it is consistent with the JointVelocityLimitsCmd
component.
On the other hand, the function returns jointAxis->Data().MaxVelocity()
which is just a double
. So we'll need to change it to return a vector of gz::math::Vector2d
, something like (untested):
return {gz::math::Vector2d(-jointAxis->Data().MaxVelocity(),
jointAxis->Data().MaxVelocity())};
Hi @mo-zaghloul, any progress on this? |
🎉 New feature
Closes #2664
Summary
This PR introduces the
JointVelocityLimits
component and starts integrating it into theJoint
class and physics system. However, I need guidance on completing the physics implementation.Changes in this PR
JointVelocityLimits.hh
component to store joint velocity limits.Joint.cc
.Physics.cc
(incomplete, need guidance).Test it
The component has been added, but since the physics integration is incomplete, full testing isn't possible yet. Once I receive guidance on the correct approach, I will add appropriate tests.
Guidance Needed
I am currently stuck on integrating velocity limits correctly into the physics system. Specifically, I would appreciate guidance on:
Checklist
JointVelocityLimits
codecheck
passed (See contributing)