-
Notifications
You must be signed in to change notification settings - Fork 297
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
Add AddLinkForce Function to Apply Forces in Link Frame #2816
base: main
Are you sure you want to change the base?
Conversation
The CI picked up some lint issues - can you remove trailing whitespace and limit lines to 80 char? I also made some minor comments on removing empty lines. |
.gitignore
Outdated
@@ -20,3 +20,4 @@ build_* | |||
# Python cache | |||
__pycache__ | |||
*.pyc | |||
|
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.
src/Link.cc
Outdated
|
||
|
||
|
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 empty lines
src/Link.cc
Outdated
|
||
// Apply Force using AddWorldForce method | ||
this->AddWorldForce(_ecm, worldForce); | ||
|
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 empty line
src/Link.cc
Outdated
const math::Vector3d &_force, | ||
const math::Vector3d &_position) const | ||
{ | ||
|
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.
src/Link.cc
Outdated
|
||
|
||
|
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.
src/Link.cc
Outdated
// so we need to compute the force expressed in world coordinates | ||
math::Vector3d worldForce = worldPose.Rot() * _force; | ||
|
||
|
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.
src/Link.cc
Outdated
|
||
// Apply Force using AddWorldForce method | ||
this->AddWorldForce(_ecm, worldForce, _position); | ||
|
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.
/// and applied at the center of mass of the link. | ||
/// \param[in] _ecm Mutable Entity-component manager. | ||
/// \param[in] _force Force to be applied expressed in link's center of mass coordinates | ||
public: void AddLinkForce(EntityComponentManager &_ecm, |
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.
Maybe just AddForce
, which is more consistent with gazebo-classic's API. Do you have any preference on the API name, @scpeters?.
0cbdd0f
to
4e44110
Compare
Signed-off-by: Vedant87 <Vedantsr3@gmail.com>
Signed-off-by: Vedant87 <Vedantsr3@gmail.com>
Signed-off-by: Vedant87 <Vedantsr3@gmail.com>
… to 80 characters Signed-off-by: Vedant87 <Vedantsr3@gmail.com>
… to 80 characters Signed-off-by: Vedant87 <Vedantsr3@gmail.com>
4e44110
to
9660d0c
Compare
@@ -19,4 +19,4 @@ build_* | |||
|
|||
# Python cache | |||
__pycache__ | |||
*.pyc | |||
*.pyc |
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.
May I understand why this file was touched?
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 had forgotten to fetch the changes from my remote repository and merge them into my local branch, which led to merge conflicts. As a result, I had to modify this file.
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.
Can you just add a new line at the end of the file so that the ci tests pass and this does not show up. It seems you have removed the end of line marker on the file.
} | ||
|
||
////////////////////////////////////////////////// | ||
void Link::AddLinkForce(EntityComponentManager &_ecm, |
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.
Can you add a unit test for this?
You can find other tests for the link class here: https://github.com/gazebosim/gz-sim/blob/gz-sim9/src/Link_TEST.cc
Once you decide on the naming, it'll also be good to update the python API. |
🎉 New feature
Closes #2713
Summary
Function added: to apply force relative to the center of mass of the link frame, the function converts the force to a force with respect to the world coordinates. It uses the AddWorldForce method to apply force either at the center of mass of the link or at an offset from the center of mass, based on user input.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.