43 const std::string Component::defaultName =
"collision_avoidance";
67 properties.controllerNames,
69 "Names of controllers to send the collision objects to. E.g. \"col:right,col:left\"");
147 return Component::defaultName;
153 return Component::defaultName;
156 std::vector<std::vector<std::string>>
159 std::vector<std::vector<std::string>> result;
161 std::stringstream ss(config);
164 while (std::getline(ss, pair,
','))
166 std::vector<std::string> parts;
167 std::stringstream pairStream(pair);
170 while (std::getline(pairStream, part,
':'))
172 parts.push_back(part);
174 result.push_back(parts);
182 std::string result =
str;
183 std::transform(result.begin(), result.end(), result.begin(), ::tolower);
190 std::string lowerCaseName =
toLower(name);
191 return std::all_of(list.begin(),
193 [&lowerCaseName](
const std::string& item)
195 std::string lowerCaseItem = toLower(item);
196 return lowerCaseName.find(lowerCaseItem) != std::string::npos;
204 auto names = robotUnit->getActivatedNJointControllerNames();
207 std::vector<std::string> controllerNames;
209 for (
const auto& pattern : controllerNamePatterns)
211 bool controllerFound =
false;
212 for (
const auto& name : names)
216 controllerNames.push_back(name);
217 ARMARX_LOG <<
"found controller name: " << name;
218 controllerFound =
true;
222 if (!controllerFound)
224 ARMARX_ERROR_S <<
"No matching controller for pattern " << pattern;
227 if (controllerNames.size() != 0)
232 objectInstanceReader,
233 articulatedObjectReader);
235 for (
const auto& name : controllerNames)
237 controller = Ice::checkedCast<armarx::control::TSColAvoidCtrlInterfacePrx>(
238 robotUnit->getNJointController(name));
240 controller->updateCollisionObjects(
"CollisionAvoidanceSkill", scene.toAronDTO());
248 auto names = robotUnit->getActivatedNJointControllerNames();
251 std::vector<std::string> controllerNames;
253 for (
const auto& pattern : controllerNamePatterns)
255 bool controllerFound =
false;
256 for (
const auto& name : names)
260 controllerNames.push_back(name);
261 ARMARX_LOG <<
"found controller name: " << name;
262 controllerFound =
true;
266 if (!controllerFound)
268 ARMARX_ERROR_S <<
"No matching controller for pattern " << pattern;
271 if (controllerNames.size() != 0)
273 for (
const auto& name : controllerNames)
275 controller = Ice::checkedCast<armarx::control::TSColAvoidCtrlInterfacePrx>(
276 robotUnit->getNJointController(name));
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
MemoryNameSystem & memoryNameSystem()
virtual void connect(armem::client::MemoryNameSystem &memoryNameSystem)
The VirtualRobotReader class.
ComponentPlugin & getControlComponentPlugin()
armarx::plugins::RobotUnitComponentPlugin & getRobotUnitPlugin()
void onInitComponent() override
void onDisconnectComponent() override
::armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onConnectComponent() override
void sendCollisionObjectsToController(const Ice::StringSeq &objectIDs, const Ice::Current &)
static std::string GetDefaultName()
Get the component's default name.
void onExitComponent() override
std::string getDefaultName() const override
RobotUnitInterfacePrx getRobotUnit() const
#define ARMARX_ERROR_S
The logging level for unexpected behaviour, that must be fixed.
void deleteCollisionObjects()
armarx::control::common::control_law::arondto::CollisionScene getCollisionSceneFromMemory(const std::vector< armarx::ObjectID > &objectIDs, armarx::armem::obj::clazz::ClassReader &objectClassReader, armarx::armem::obj::instance::Reader &objectInstanceReader, armarx::armem::articulated_object::ArticulatedObjectReader &articulatedObjectReader)
bool containsAll(std::string name, std::vector< std::string > list)
std::vector< std::vector< std::string > > parseColumnConfig(const std::string &config)
std::string toLower(const std::string &str)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.