30#include <boost/regex.hpp>
39 std::vector<std::string> devices = getDevices();
41 for (std::vector<std::string>::iterator it = devices.begin(); it != devices.end(); ++it)
45 this->sensors.push_back(sensor);
48 std::cout <<
"Connect Interfaces" << std::endl;
50 for (std::vector<std::shared_ptr<WeissHapticSensor>>::iterator it = sensors.begin();
58std::vector<std::string>
59WeissHapticUnit::getDevices()
61 const std::string target_path(
"/dev/");
62 const boost::regex my_filter(
"ttyACM[0-9]+");
64 std::vector<std::string> files;
66 std::filesystem::directory_iterator end_itr;
68 for (std::filesystem::directory_iterator i(target_path); i != end_itr; ++i)
76 if (!boost::regex_match(i->path().filename().string(), what, my_filter))
83 files.push_back(
"/dev/" + i->path().filename().string());
86 std::sort(files.begin(), files.end());
88 if (files.size() == 0)
94 ARMARX_INFO <<
"Detected ACM-Interfaces: " << files.size();
96 for (std::string file : files)
107 const std::string&
tag,
112 if (sensor->getDeviceName() == deviceName)
114 ARMARX_IMPORTANT <<
"scheduling to set new device tag for " << deviceName <<
": "
116 sensor->scheduleSetDeviceTag(
tag);
140 for (std::vector<std::shared_ptr<WeissHapticSensor>>::iterator it = sensors.begin();
145 (*it)->startSampling();
152 for (std::vector<std::shared_ptr<WeissHapticSensor>>::iterator it = sensors.begin();
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
HapticUnitListenerPrx hapticTopicPrx
void setDeviceTag(const std::string &deviceName, const std::string &tag, const Ice::Current &) override
void onExitHapticUnit() override
void onDisconnectComponent() override
Hook for subclass.
void onStartHapticUnit() override
PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitHapticUnit() override
void startLogging(const Ice::Current &) override
void stopLogging(const Ice::Current &) override
#define ARMARX_INFO
The normal logging level.
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
#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.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
std::shared_ptr< WeissHapticSensor > WeissHapticSensorPtr