33 std::random_device rd;
36 boost::uniform_int<> dist(0,RAND_MAX);
37 boost::variate_generator<boost::mt19937,boost::uniform_int<>> gen(eng,dist);
41 std::vector<boost::shared_ptr<TestSet>>
testSets(pTestSetCount);
43 for (
unsigned int i = 0; i < pTestSetCount; i++)
46 unsigned int randomTimestep = gen() % pExamplesList.size();
47 unsigned int randomObjectIndex = gen() % pExamplesList[randomTimestep]->objects.size();
48 ISM::ObjectPtr referenceObject(
new ISM::Object(*pExamplesList[randomTimestep]->objects[randomObjectIndex]));
50 testSets[i].reset(
new TestSet());
51 testSets[i]->mObjectSet->insert(referenceObject);
53 for (std::string objectType:
mTypes)
55 if (objectType != referenceObject->type)
57 ISM::ObjectPtr object;
59 unsigned int counter = 0;
60 while (!
object && counter < pExamplesList.size())
62 unsigned int newRandomTimestep = gen() % pExamplesList.size();
63 for (ISM::ObjectPtr currentObject: pExamplesList[newRandomTimestep]->objects)
65 if (currentObject->type == objectType)
67 object = ISM::ObjectPtr(
new ISM::Object(*currentObject));
75 throw std::runtime_error(
"In TestSetGenerator::generateTestSets(): Failed to find object of type " + objectType +
" in evidence list.");
77 testSets[i]->mObjectSet->insert(
object);
~ReferenceTestSetGenerator()
std::vector< std::string > mTypes
void setPoseOfObjectRelativeToReference(ISM::ObjectPtr pObject, ISM::ObjectPtr pReference)
virtual std::vector< boost::shared_ptr< TestSet > > generateRandomSets(std::vector< boost::shared_ptr< ISM::ObjectSet >> pExamplesList, unsigned int pTestSetCount)
ReferenceTestSetGenerator(boost::shared_ptr< AbstractTopologyEvaluator > pEvaluator, boost::shared_ptr< SceneModel::Topology > pFullyMeshedTopology, const std::vector< std::string > &pObjectTypes)
#define ROS_INFO_STREAM(args)