22 namespace po = boost::program_options;
23 namespace fs = boost::filesystem;
28 double f = (double)rand() / RAND_MAX;
29 return min + f * (max - min);
35 double directioncos = cos(0.0 * (boost::math::constants::pi<double>() / 180.0));
36 double directionsin = sin(0.0 * (boost::math::constants::pi<double>() / 180.0));
40 vector<TrackPtr> trackVector;
41 for (
unsigned object = 0;
object < objects; ++object)
44 double x = frand(0, 1.0);
45 double z = frand(0, 1.0);
46 double angle = frand(0, boost::math::constants::pi<double>() * 2);
47 for (
unsigned timestep = 0; timestep < timesteps; ++timestep)
50 angle += (frand(boost::math::constants::pi<double>() * (-1), boost::math::constants::pi<double>())) * pow(frand(0, 1.0), 2);
51 double u = frand(0, 1.0);
52 double radius = frand(0, 0.01) * sqrt(u);
53 double xTranslation = radius * cos(angle);
54 double zTranslation = radius * sin(angle);
75 if(genRanOrientsAdditionally)
81 o =
ObjectPtr(
new Object(
string(
"testobj") + to_string(
object),
new Pose(
new Point(x, y, z),
new Quaternion(directionsin, 0.0, 0.0, directioncos)), to_string(
object)));
83 track->objects.push_back(o);
85 trackVector.push_back(track);
88 vector<ObjectSetPtr> objectSets = tracks->toObjectSetVector();
91 rec->insert(objectSet,
"demo_recording_" + to_string(objects) +
"_" + to_string(timesteps));
113 printYellow(
"Done. Objects are now stored in " + dbfile +
"\n");
void printYellow(std::string text)
boost::shared_ptr< Recorder > RecorderPtr
void generateDemoRecording(std::string dbfile, unsigned objects, unsigned timesteps, bool genRanOrientsAdditionally)
boost::shared_ptr< ObjectSet > ObjectSetPtr
boost::shared_ptr< Tracks > TracksPtr
double frand(double min, double max)
boost::shared_ptr< Track > TrackPtr
this namespace contains all generally usable classes.
boost::shared_ptr< Object > ObjectPtr