32 #include <SimoxUtility/algorithm/string/string_tools.h>
42 std::string simPrxName = getProperty<std::string>(
"SimulatorName").getValue();
43 usingProxy(simPrxName);
44 robotNodeNames = getCommaSeparatedProperty(
"RobotNodes");
45 environmentObjectNames = getCommaSeparatedProperty(
"EnvironmentObjects");
46 robotName = getProperty<std::string>(
"RobotName").getValue();
47 offeringTopic(
"DebugDrawerUpdates");
55 std::string simPrxName = getProperty<std::string>(
"SimulatorName").getValue();
56 simulatorProxy = getProxy<SimulatorInterfacePrx>(simPrxName);
59 debugDrawerPrx = getTopic<DebugDrawerInterfacePrx>(
"DebugDrawerUpdates");
74 void HapticUnitDynamicSimulation::frameAcquisitionTaskLoop()
76 while (!sensorTask->isStopped())
78 for (
size_t i = 0; i < robotNodeNames.size(); i++)
81 std::string robotNodeName = robotNodeNames.at(i);
83 for (std::string objectName : environmentObjectNames)
85 DistanceInfo di = simulatorProxy->getDistance(robotName, robotNodeName, objectName);
86 ARMARX_IMPORTANT <<
"Distance between " << robotNodeName <<
" and " << objectName <<
" = " << di.distance;
88 debugDrawerPrx->setLineDebugLayerVisu(robotNodeName + objectName, di.p1, di.p2, 5.0f, DrawColor {1, 0, 0, 1});
94 (*matrix)(0, 0) = (now->getTimestamp() / 500) % 4096;
95 (*matrix)(0, 1) = (now->getTimestamp() / 1000) % 4096;
96 (*matrix)(0, 2) = (now->getTimestamp() / 2000) % 4096;
97 hapticTopicPrx->reportSensorValues(
"/virtualdev/sensorA",
"Left Index", matrix, now);
102 std::vector<std::string> HapticUnitDynamicSimulation::getCommaSeparatedProperty(std::string propertyName)
104 std::string strValue = getProperty<std::string>(propertyName).getValue();
107 for (
size_t i = 0; i <
values.size(); i++)
109 simox::alg::trim(
values.at(i));