28#include <SimoxUtility/algorithm/string/string_tools.h>
42 this, &HapticUnitDynamicSimulation::frameAcquisitionTaskLoop);
46 robotNodeNames = getCommaSeparatedProperty(
"RobotNodes");
47 environmentObjectNames = getCommaSeparatedProperty(
"EnvironmentObjects");
80HapticUnitDynamicSimulation::frameAcquisitionTaskLoop()
82 while (!sensorTask->isStopped())
84 for (
size_t i = 0; i < robotNodeNames.size(); i++)
87 std::string robotNodeName = robotNodeNames.at(i);
89 for (std::string objectName : environmentObjectNames)
91 DistanceInfo di = simulatorProxy->getDistance(robotName, robotNodeName, objectName);
92 ARMARX_IMPORTANT <<
"Distance between " << robotNodeName <<
" and " << objectName
93 <<
" = " << di.distance;
95 debugDrawerPrx->setLineDebugLayerVisu(
96 robotNodeName + objectName, di.p1, di.p2, 5.0f, DrawColor{1, 0, 0, 1});
102 (*matrix)(0, 0) = (now->getTimestamp() / 500) % 4096;
103 (*matrix)(0, 1) = (now->getTimestamp() / 1000) % 4096;
104 (*matrix)(0, 2) = (now->getTimestamp() / 2000) % 4096;
105 hapticTopicPrx->reportSensorValues(
"/virtualdev/sensorA",
"Left Index", matrix, now);
110std::vector<std::string>
111HapticUnitDynamicSimulation::getCommaSeparatedProperty(std::string propertyName)
114 std::vector<std::string>
values = simox::alg::split(strValue,
",");
116 for (
size_t i = 0; i <
values.size(); i++)
118 simox::alg::trim(
values.at(i));
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
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
static std::string GetDefaultName()
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