Go to the documentation of this file.
27 #include <SimoxUtility/algorithm/string/string_tools.h>
36 usingTopic(
"ForceTorqueDynamicSimulationValues");
37 agentName = getProperty<std::string>(
"AgentName").getValue();
39 std::string framesStr = getProperty<std::string>(
"ReportFrames").getValue();
41 ARMARX_INFO <<
"ForceTorqueUnit initialized." << std::endl
42 <<
"AgentName: " <<
agentName <<
". " << std::endl
43 <<
"Report Frames: " <<
frames;
44 auto sensorRobotNodeSplit =
45 armarx::Split(getProperty<std::string>(
"SensorRobotNodeMapping").getValue(),
",");
46 for (
auto& elem : sensorRobotNodeSplit)
48 simox::alg::trim(elem);
50 if (
split.size() == 2)
53 simox::alg::trim_copy(
split[1]);
57 usingProxy(getProperty<std::string>(
"RobotStateComponentName").getValue());
63 ARMARX_INFO <<
"Starting ForceTorqueUnit, requesting robot from RobotStateComponent...";
68 getProxy<RobotStateComponentInterfacePrx>(
69 getProperty<std::string>(
"RobotStateComponentName").getValue());
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;
186 auto itX = filters.find(name);
187 if (itX == filters.end())
191 itX = filters.find(name);
193 auto& filterX = *itX->second;
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&,
The Variant class is described here: Variants.
static bool synchronizeLocalClone(VirtualRobot::RobotPtr robot, RobotStateComponentInterfacePrx robotStatePrx)
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
void onStartForceTorqueUnit() override
VirtualRobot::RobotPtr remoteRobot
void onExitForceTorqueUnit() override
Vector3BasePtr filterValues(const std::string &sensorName, const Vector3BasePtr &torques, std::map< std::string, DatafieldFilterBasePtr > &filters)
std::shared_ptr< Value > value()
void setToNull(const Ice::Current &) override
void terminate()
Initiates termination of this IceManagedObject.
armarx::StringStringDictionary sensorRobotNodeMapping
void onInitForceTorqueUnit() override
std::vector< std::string > frames
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
std::map< std::string, DatafieldFilterBasePtr > forceFilters
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
ForceTorqueUnitListenerPrx listenerPrx
const VariantTypeId FramedDirection
VirtualRobot::RobotPtr createLocalClone()
Clones the structure of this remote robot to a local instance.
PropertyDefinitionsPtr createPropertyDefinitions() override
SharedRobotInterfacePrx sharedRobot
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
void setOffset(const FramedDirectionBasePtr &, const FramedDirectionBasePtr &, const Ice::Current &) override
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
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
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::map< std::string, DatafieldFilterBasePtr > torqueFilters
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)