-
Notifications
You must be signed in to change notification settings - Fork 277
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
Implements a method to get the link inertia #2218
Changes from 2 commits
4374ae7
44a8869
7151c65
5f10700
0628764
03be14f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
* | ||
*/ | ||
|
||
#include <gz/math/Inertial.hh> | ||
#include <gz/math/Matrix3.hh> | ||
#include <gz/math/Pose3.hh> | ||
#include <gz/math/Vector3.hh> | ||
|
@@ -190,6 +189,23 @@ std::optional<math::Pose3d> Link::WorldPose( | |
.value_or(sim::worldPose(this->dataPtr->id, _ecm)); | ||
} | ||
|
||
////////////////////////////////////////////////// | ||
std::optional<math::Inertiald> Link::WorldInertial( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are being included in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that's necessary. |
||
const EntityComponentManager &_ecm) const | ||
{ | ||
auto inertial = _ecm.Component<components::Inertial>(this->dataPtr->id); | ||
auto worldPose = _ecm.ComponentData<components::WorldPose>(this->dataPtr->id) | ||
.value_or(sim::worldPose(this->dataPtr->id, _ecm)); | ||
|
||
if (!inertial) | ||
return std::nullopt; | ||
|
||
const math::Pose3d &comWorldPose = | ||
worldPose * inertial->Data().Pose(); | ||
return std::make_optional( | ||
math::Inertiald(inertial->Data().MassMatrix(), comWorldPose)); | ||
} | ||
|
||
////////////////////////////////////////////////// | ||
std::optional<math::Pose3d> Link::WorldInertialPose( | ||
const EntityComponentManager &_ecm) 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.
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.
Done.