35 ROS_INFO_STREAM(
"Pose prediction is run for scene " << pattern_name <<
" with " << percentage_of_records_for_prediction <<
" times the demonstration trajectory lengths.");
40 x.push_back(
IsmObject (pattern_name,
"MOCK"));
42 ROS_DEBUG_STREAM(
"These are best paths for unfound objects in scene" << pattern_name <<
":");
54 for (
IsmObject object : objects_in_pattern)
58 predecessors.push_back(
object);
63 std::pair<BestPathMap::iterator,bool>ret;
66 ret =
best_path_map_.insert(std::pair<IsmObject, PathWithScore>(
object,
67 new_path_with_score));
71 .at(
object.second).size();
77 ROS_DEBUG_STREAM(
"Object " <<
"(" <<
object.first <<
"," <<
object.second <<
")" <<
" already has a path");
79 double old_score = old_path_with_score.second;
80 if (old_score >= new_score)
84 ROS_DEBUG_STREAM(
"The the new score is better than old. The new path replaces the old");
87 .at(
object.first).at(
object.second).size();
89 "The new path was not inserted");
93 predecessors.pop_back();
96 ROS_DEBUG_STREAM(
"Object " <<
"(" <<
object.first <<
"," <<
object.second <<
")" <<
"was already found");
105 unsigned int threshold = round(percentage_of_records_for_prediction *
specifiers_size_map_[best_path_it ->first]);
108 IsmObjects predecessors = path_with_score.first;
109 for (
unsigned int i = 0; i < threshold ; ++i)
111 ISM::PosePtr predicted_object_pose_ptr =
predictPose(pose, predecessors);
119 double score = 1 / ( (double) path.size());
121 "There must be more than one predecessor, otherwise all objects are in the reference");
134 IsmObjects predecessors = path_with_score.first;
135 ROS_DEBUG_STREAM(
"(" <<
object.first <<
"," <<
object.second <<
")" <<
" has " << predecessors.size() <<
" predecessors");
ISM::PatternToObjectToVoteMap votes_
void addPointToPointCloud(ISM::PosePtr pose_to_add, std::string type, std::string identifier)
RecognizerPredictionISM::addPointToPointCloud Adds an ISM Pose with object type and identifier as att...
AttributedPointCloud attributed_point_cloud_
std::set< IsmObject > IsmObjectSet
double calculatePathScore(IsmObjects path)
AttributedPointCloud predictUnfoundPoses(ISM::PosePtr &reference_pose, std::string pattern_name, double percentage_of_records_for_prediction)
predictUnfoundPoses Processes the following steps for each object in the objectpattern set...
std::pair< IsmObjects, double > PathWithScore
ISM::PosePtr predictPose(ISM::PosePtr reference_pose_ptr, IsmObjects path_to_object)
#define ROS_ASSERT_MSG(cond,...)
void createBestPathMap(std::string type, IsmObjects predecessors)
SizeMap specifiers_size_map_
#define ROS_DEBUG_STREAM(args)
std::pair< std::string, std::string > IsmObject
bool isReferenceObject(IsmObject object)
BestPathMap best_path_map_
#define ROS_INFO_STREAM(args)
BestPath(std::string database_filename)
void createAttributedPointCloud(ISM::PosePtr reference_pose_ptr, double percentage_of_records_for_prediction)
std::vector< IsmObject > IsmObjects
bool isFoundObject(IsmObject object)
IsmObjectSet getObjectTypesAndIdsBelongingToPattern(std::string type)
asr_msgs::AsrAttributedPointCloud AttributedPointCloud