27#include <SimoxUtility/algorithm/string/string_tools.h>
36 usingTopic(
"ForceTorqueDynamicSimulationValues");
40 frames = simox::alg::split(framesStr,
",;");
41 ARMARX_INFO <<
"ForceTorqueUnit initialized." << std::endl
42 <<
"AgentName: " <<
agentName <<
". " << std::endl
43 <<
"Report Frames: " <<
frames;
44 auto sensorRobotNodeSplit =
46 for (
auto& elem : sensorRobotNodeSplit)
48 simox::alg::trim(elem);
49 std::vector<std::string>
split = simox::alg::split(elem,
":");
50 if (
split.size() == 2)
53 simox::alg::trim_copy(
split[1]);
63 ARMARX_INFO <<
"Starting ForceTorqueUnit, requesting robot from RobotStateComponent...";
70 sharedRobot = robotStateComponent->getSynchronizedRobot();
82 if (!frame.empty() && !
remoteRobot->hasRobotNode(frame))
85 << frame <<
"'. Will not report FT values in this frame...";
104 const Vector3BasePtr& torque,
105 const std::string& sensorName,
106 const std::string& nodeName,
108 const Ice::Current&
c)
121 if (sensorName != nodeName &&
remoteRobot->hasRobotNode(sensorName))
124 framedTorque->changeFrame(
remoteRobot, sensorName);
129 prx->reportSensorValues(sensorName, framedForce, framedTorque);
132 for (
auto& frame :
frames)
134 if (!frame.empty() &&
remoteRobot->hasRobotNode(frame))
142 prx->reportSensorValues(sensorName, framedForce1, framedTorque1);
155 framedForce1->changeFrame(
remoteRobot, it->second);
156 framedTorque1->changeFrame(
remoteRobot, it->second);
157 prx->reportSensorValues(it->second, framedForce1, framedTorque1);
159 << framedForce1->output() <<
"\n"
160 << framedTorque1->output();
168 prx->ice_flushBatchRequests();
179 const std::string& sensorName,
180 const Vector3BasePtr& torques,
181 std::map<std::string, DatafieldFilterBasePtr>&
filters)
183 auto filter = [&,
this](
const std::string& dim,
float value)
185 const auto name = sensorName + dim;
193 auto& filterX = *itX->second;
194 filterX.update(0,
new Variant(value));
195 double r = filterX.getValue()->getDouble();
200 Vector3BasePtr result =
201 new Vector3(filter(
"x", torques->x), filter(
"y", torques->y), filter(
"z", torques->z));
207 const armarx::FramedDirectionBasePtr&,
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
VirtualRobot::RobotPtr remoteRobot
void setToNull(const Ice::Current &) override
std::map< std::string, DatafieldFilterBasePtr > forceFilters
Vector3BasePtr filterValues(const std::string &sensorName, const Vector3BasePtr &torques, std::map< std::string, DatafieldFilterBasePtr > &filters)
void reportForceTorque(const Vector3BasePtr &force, const Vector3BasePtr &torque, const std::string &sensorName, const std::string &nodeName, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
std::map< std::string, DatafieldFilterBasePtr > torqueFilters
SharedRobotInterfacePrx sharedRobot
void setOffset(const FramedDirectionBasePtr &, const FramedDirectionBasePtr &, const Ice::Current &) override
void onExitForceTorqueUnit() override
void onStartForceTorqueUnit() override
std::vector< std::string > frames
PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitForceTorqueUnit() override
armarx::StringStringDictionary sensorRobotNodeMapping
ForceTorqueUnitListenerPrx listenerPrx
FramedDirection is a 3 dimensional direction vector with a reference frame.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
void terminate()
Initiates termination of this IceManagedObject.
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
VirtualRobot::RobotPtr createLocalClone()
Clones the structure of this remote robot to a local instance.
static bool synchronizeLocalClone(VirtualRobot::RobotPtr robot, RobotStateComponentInterfacePrx robotStatePrx)
The Variant class is described here: Variants.
#define ARMARX_INFO
The normal logging level.
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
IceInternal::Handle< Vector3 > Vector3Ptr
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
IceInternal::Handle< FramedDirection > FramedDirectionPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx