26 #include <SimoxUtility/algorithm/string/string_tools.h>
40 this, &HapticUnitDynamicSimulation::frameAcquisitionTaskLoop);
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");
78 HapticUnitDynamicSimulation::frameAcquisitionTaskLoop()
80 while (!sensorTask->isStopped())
82 for (
size_t i = 0; i < robotNodeNames.size(); i++)
85 std::string robotNodeName = robotNodeNames.at(i);
87 for (std::string objectName : environmentObjectNames)
89 DistanceInfo di = simulatorProxy->getDistance(robotName, robotNodeName, objectName);
90 ARMARX_IMPORTANT <<
"Distance between " << robotNodeName <<
" and " << objectName
91 <<
" = " << di.distance;
93 debugDrawerPrx->setLineDebugLayerVisu(
94 robotNodeName + objectName, di.p1, di.p2, 5.0f, DrawColor{1, 0, 0, 1});
100 (*matrix)(0, 0) = (now->getTimestamp() / 500) % 4096;
101 (*matrix)(0, 1) = (now->getTimestamp() / 1000) % 4096;
102 (*matrix)(0, 2) = (now->getTimestamp() / 2000) % 4096;
103 hapticTopicPrx->reportSensorValues(
"/virtualdev/sensorA",
"Left Index", matrix, now);
108 std::vector<std::string>
109 HapticUnitDynamicSimulation::getCommaSeparatedProperty(std::string propertyName)
111 std::string strValue = getProperty<std::string>(propertyName).getValue();
114 for (
size_t i = 0; i <
values.size(); i++)
116 simox::alg::trim(
values.at(i));