26#include <SimoxUtility/algorithm/string/string_tools.h>
40 this, &HapticUnitDynamicSimulation::frameAcquisitionTaskLoop);
44 robotNodeNames = getCommaSeparatedProperty(
"RobotNodes");
45 environmentObjectNames = getCommaSeparatedProperty(
"EnvironmentObjects");
78HapticUnitDynamicSimulation::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);
108std::vector<std::string>
109HapticUnitDynamicSimulation::getCommaSeparatedProperty(std::string propertyName)
112 std::vector<std::string>
values = simox::alg::split(strValue,
",");
114 for (
size_t i = 0; i <
values.size(); i++)
116 simox::alg::trim(
values.at(i));
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
void onExitHapticUnit() override
void onStartHapticUnit() override
PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitHapticUnit() override
HapticUnitListenerPrx hapticTopicPrx
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
static void MSSleep(int durationMS)
lock the calling thread for a given duration (like usleep(...) but using Timeserver time)
static TimestampVariantPtr nowPtr()
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
const VariantTypeId MatrixFloat
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< MatrixFloat > MatrixFloatPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
IceInternal::Handle< TimestampVariant > TimestampVariantPtr