Skip to content

Commit

Permalink
[DataFusionBase] fix fusion when a fused percept is created directly …
Browse files Browse the repository at this point in the history
…in hand
  • Loading branch information
sarthou committed Jun 18, 2024
1 parent 170ef35 commit f9dcf01
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Perception/DataFusion/DataFusionBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ namespace owds {

auto fused_percept_it = fusioned_percepts.find(pair.first);
if(fused_percept_it == fusioned_percepts.end())
{
fused_percept_it = fusioned_percepts.emplace(pair.first, new Percept<Object>(pair.second.front())).first;
fused_percept_it->second->removeFromHand();
}

Percept<Object>* percept = fused_percept_it->second;
std::string percept_id = pair.first;

Hand* hand = nullptr;
Pose pose_in_hand;
Pose pose_in_map;
bool located_in_map = false;
int nb_frame_unseen = 1000;

// We try to find if the percept should be in hand
Expand All @@ -41,6 +45,7 @@ namespace owds {
{
// We take the pose of the most recently perceived percept
pose_in_map = obj.pose();
located_in_map = true;
nb_frame_unseen = obj.getNbFrameUnseen();
}
}
Expand Down Expand Up @@ -74,7 +79,12 @@ namespace owds {
if(percept->isInHand())
{
Hand* hand = percept->getHandIn();
auto pose_tmp = percept->pose();
hand->removePerceptFromHand(percept->id());
if(located_in_map)
percept->updatePose(pose_in_map);
else
percept->updatePose(pose_tmp);
}

percept->setNbFrameUnseen(nb_frame_unseen);
Expand Down

0 comments on commit f9dcf01

Please sign in to comment.