in roboschool/cpp-household/test-tool-qt4.cpp [43:79]
void load_model_or_robot()
{
try {
time_t t = mtime(the_filename);
if (last_reload_time==t)
return;
world->clean_everything();
world->klass_cache_clear();
btQuaternion quat(0,0,0,1);
if (the_model_along_y)
quat.setEuler(0, M_PI/2, 0);
last_reload_time = t;
QString test = QString::fromLocal8Bit(the_filename.c_str());
if (test.endsWith(".urdf")) {
QElapsedTimer timer;
timer.start();
the_robot = world->load_urdf(the_filename, btTransform(quat, btVector3(0,0,0)), false, false);
double load_ms = timer.nsecsElapsed()/1000000.0;
fprintf(stderr, "%s loaded in %0.2lfms\n", the_filename.c_str(), load_ms);
} else if (test.endsWith(".xml") || test.endsWith(".sdl")) {
the_robot.reset();
std::list<shared_ptr<Robot>> robots = world->load_sdf_mjcf(the_filename, test.endsWith(".xml"));
other_robots_keep_reference = robots;
for (auto r: robots)
if (!the_robot || the_robot->joints.size() < r->joints.size())
the_robot = r;
} else {
the_model = world->load_thingy(the_filename, btTransform(quat, btVector3(0,0,0)), 1.0, 1.0, 0xFF0000, false);
}
} catch (const std::exception& e) {
fprintf(stderr, "ERROR: %s\n", e.what());
}
}