34#include <RobotAPI/interface/units/HapticUnit.h>
48 "HapticTopicName",
"HapticValues",
"Name of the HapticUnit Topic");
71 if (deltas.size() < count)
73 deltas.push_back(delta);
77 deltas.at(pos) = delta;
78 pos = (pos + 1) % count;
97 if (deltas.size() == 0)
104 for (std::vector<long>::iterator it = deltas.begin(); it != deltas.end(); ++it)
109 return sum / deltas.size();
138 return "HapticUnitObserver";
146 const ::std::string& name,
147 const ::armarx::MatrixFloatBasePtr& values,
148 const ::armarx::TimestampBasePtr&
timestamp,
149 const ::Ice::Current& = Ice::emptyCurrent)
override;
157 std::mutex dataMutex;
158 std::string topicName;
161 void updateStatistics();
163 std::map<std::string, HapticSampleStatistics> statistics;
HapticObserverPropertyDefinitions(std::string prefix)
void onConnectObserver() override
Framework hook.
void setTopicName(std::string topicName)
void onExitObserver() override
Framework hook.
void reportSensorValues(const ::std::string &device, const ::std::string &name, const ::armarx::MatrixFloatBasePtr &values, const ::armarx::TimestampBasePtr ×tamp, const ::Ice::Current &=Ice::emptyCurrent) override
PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitObserver() override
Framework hook.
std::string getDefaultName() const override
Retrieve default name of component.
HapticSampleStatistics(unsigned int count, long timestamp)
ObserverPropertyDefinitions(std::string prefix)
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.