Skip to content

Commit 02b2faa

Browse files
committed
--properly handle transforming markerpoints assigned to a baselink
1 parent c72165a commit 02b2faa

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

src/esp/physics/ArticulatedObject.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,19 +555,25 @@ class ArticulatedObject : public esp::physics::PhysicsObjectBase {
555555
for (const auto& linkEntry : taskEntry.second) {
556556
const std::string linkName = linkEntry.first;
557557
int linkId = getLinkIdFromName(linkName);
558-
auto linkIter = links_.find(linkId);
559-
ESP_CHECK(
560-
linkIter != links_.end(),
561-
"ArticulatedObject::getMarkerPointsGlobal - no link found with "
562-
"linkId ="
563-
<< linkId);
558+
// locally access the unique pointer's payload
559+
const esp::physics::ArticulatedLink* aoLink;
560+
if (linkId == -1) {
561+
aoLink = baseLink_.get();
562+
} else {
563+
auto linkIter = links_.find(linkId);
564+
ESP_CHECK(
565+
linkIter != links_.end(),
566+
"ArticulatedObject::getMarkerPointsGlobal - no link found with "
567+
"linkId ="
568+
<< linkId);
569+
aoLink = linkIter->second.get();
570+
}
564571
std::unordered_map<std::string, std::vector<Mn::Vector3>> perLinkMap;
565572
// for each set in link
566573
for (const auto& markersEntry : linkEntry.second) {
567574
const std::string markersName = markersEntry.first;
568575
perLinkMap[markersName] =
569-
linkIter->second->transformLocalPointsToWorld(markersEntry.second,
570-
linkId);
576+
aoLink->transformLocalPointsToWorld(markersEntry.second, linkId);
571577
}
572578
perTaskMap[linkName] = perLinkMap;
573579
}

0 commit comments

Comments
 (0)