31 #include <Inventor/Qt/SoQt.h>
36 #define MAIN_LOOP_SLEEP_MS 33
39 #define MAX_RENDER_TIME_WARNING_MS 33
43 exitApplication(false)
60 VirtualRobot::init(
"SimulatorViewerApp");
66 if (getProperty<bool>(
"UseDebugDrawer").getValue())
68 std::stringstream ddName;
69 ddName <<
getName() <<
"_EntityDrawer";
70 debugDrawer = Component::create<memoryx::EntityDrawerComponent>(properties, ddName.str());
75 std::stringstream svName;
76 svName <<
getName() <<
"_PhysicsWorldVisualization";
77 simVisu = Component::create<ArmarXPhysicsWorldVisualization>(properties, svName.str());
84 std::stringstream swName;
85 swName <<
getName() <<
"_SimulationWindow";
86 mainWindow = Component::create<ArmarXSimulatorWindow>(properties, swName.str());
108 std::cout <<
"Started ArmarXSimulatorViewerApp" << std::endl;
122 memoryx::EntityDrawerInterfacePrx prxDD = armarXManager->getIceManager()->getTopic<memoryx::EntityDrawerInterfacePrx>(
"DebugDrawerUpdates");
123 memoryx::PriorKnowledgeInterfacePrx priorKnowledgePrx = armarXManager->getIceManager()->getProxy<memoryx::PriorKnowledgeInterfacePrx>(
"PriorKnowledge");
125 std::string objClassName =
"vitaliscereal";
126 memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx = priorKnowledgePrx->getObjectClassesSegment();
127 memoryx::EntityBasePtr classesEntity = classesSegmentPrx->getEntityByName(objClassName);
135 prxDD->setObjectVisu(
"debug",
"vitalis", objectClass, gp);
139 armarx::CycleUtil cycle(IceUtil::Time::secondsDouble(1.0 / getProperty<float>(
"UpdateRate").getValue()));
147 color = (color + 1) % 1000;
152 col.a =
float(color) / 1000.0f;
154 prxDD->updateObjectColor(
"debug",
"vitalis", col);
187 auto startTime1 = IceUtil::Time::now();
190 if (duration1.toMilliSecondsDouble() > 5)
194 simVisu->synchronizeVisualizationData();
198 auto startTime1 = IceUtil::Time::now();
202 if (duration1.toMilliSecondsDouble() > 20)
208 mainWindow->setDrawTimeMeasured((
float)duration.toMilliSecondsDouble());
213 IceUtil::Time lastWarnDuration = IceUtil::Time::now() - lastWarnTimeRender;
215 if (lastWarnDuration.toSecondsDouble() > 4.0)
217 lastWarnTimeRender = IceUtil::Time::now();
218 ARMARX_DEBUG <<
"*** Rendering slow !! Render time in ms:" << duration.toMilliSecondsDouble();
233 armarXManager->shutdown();
235 armarXManager->waitForShutdown();
251 void SimulatorViewerApp::closeRequest_sent()