Skip to content
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

dartsim: fdir1 expressed_in frame from SDFormat #224

Merged
merged 7 commits into from
Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion dartsim/src/SDFFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -826,8 +826,26 @@ Identity SDFFeatures::ConstructSdfCollision(
}
if (odeFriction->HasElement("fdir1"))
{
math::Vector3d fdir1 = odeFriction->Get<math::Vector3d>("fdir1");
auto frictionDirectionElem = odeFriction->GetElement("fdir1");
math::Vector3d fdir1 = frictionDirectionElem->Get<math::Vector3d>();
aspect->setFirstFrictionDirection(math::eigen3::convert(fdir1));

const std::string kExpressedIn = "ignition:expressed_in";
if (frictionDirectionElem->HasAttribute(kExpressedIn))
{
auto skeleton = bn->getSkeleton();
auto directionFrameBodyNode = skeleton->getBodyNode(
chapulina marked this conversation as resolved.
Show resolved Hide resolved
frictionDirectionElem->Get<std::string>(kExpressedIn));
if (nullptr != directionFrameBodyNode)
{
aspect->setFirstFrictionDirectionFrame(directionFrameBodyNode);
}
else
{
ignwarn << "Failed to get body node for [" << _collision.Name()
<< "], not setting friction direction frame." << std::endl;
}
}
}

const auto &surfaceBounce = _collision.Element()
Expand Down