Skip to content

Commit 439c619

Browse files
committed
Revert "Fix RobotState::getRigidlyConnectedParentLinkModel() (moveit#2985)"
This reverts commit 1f23344.
1 parent 0af5e0f commit 439c619

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

moveit_core/robot_state/src/robot_state.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -909,11 +909,26 @@ void RobotState::updateStateWithLinkAt(const LinkModel* link, const Eigen::Isome
909909

910910
const LinkModel* RobotState::getRigidlyConnectedParentLinkModel(const std::string& frame) const
911911
{
912-
bool found;
913912
const LinkModel* link{ nullptr };
914-
getFrameInfo(frame, link, found);
915-
if (!found)
916-
RCLCPP_ERROR(getLogger(), "Unable to find link for frame '%s'", frame.c_str());
913+
914+
size_t idx = 0;
915+
if ((idx = frame.find('/')) != std::string::npos)
916+
{ // resolve sub frame
917+
std::string object{ frame.substr(0, idx) };
918+
if (!hasAttachedBody(object))
919+
return nullptr;
920+
auto body{ getAttachedBody(object) };
921+
if (!body->hasSubframeTransform(frame))
922+
return nullptr;
923+
link = body->getAttachedLink();
924+
}
925+
else if (hasAttachedBody(frame))
926+
{
927+
link = getAttachedBody(frame)->getAttachedLink();
928+
}
929+
else if (getRobotModel()->hasLinkModel(frame))
930+
link = getLinkModel(frame);
931+
917932
return getRobotModel()->getRigidlyConnectedParentLinkModel(link);
918933
}
919934

0 commit comments

Comments
 (0)