27 #include <VirtualRobot/Robot.h>
31 #include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
43 defineOptionalProperty<float>(
"SelfCollisionCheck_Frequency",
45 "Frequency [Hz] of self collision checking (default = "
46 "10). If set to 0, no cllisions will be checked.",
48 defineOptionalProperty<float>(
"SelfCollisionCheck_MinSelfDistance",
50 "Minimum allowed distance (mm) between each collision "
51 "model before entering emergency stop (default = 20).",
53 defineOptionalProperty<std::string>(
54 "SelfCollisionCheck_ModelGroupsToCheck",
56 "Comma seperated list of groups (two or more) of collision models (RobotNodeSets "
57 "or RobotNodes) that "
58 "should be checked against each other by collision avoidance \n"
59 "(e.g. {rnsColModel1,rnsColModel2};{rnsColModel3,rnsColModel4}; .... "
60 "says that rnsColModel1 will be only checked against rnsColModel2 and rnsColModel3 "
61 "will only be checked against rnsColModel4). \n"
62 "Following predefined descriptors can be used: 'FLOOR' which represents a virtual "
63 "collision model of the floor.");
76 virtual public RobotUnitSelfCollisionCheckerInterface
88 return ModuleBase::Instance<SelfCollisionChecker>();
96 void _preOnInitRobotUnit();
98 void _postFinishControlThreadInitialization();
100 void _preFinishRunning();
102 void _componentPropertiesUpdated(
const std::set<std::string>& changed);
112 const Ice::Current& = Ice::emptyCurrent)
override;
118 const Ice::Current& = Ice::emptyCurrent)
override;
142 void selfCollisionAvoidanceTask();
148 std::thread selfCollisionAvoidanceThread;
154 std::set<std::pair<std::string, std::string>> namePairsToCheck;
156 std::atomic<float> checkFrequency{0};
162 std::mutex selfCollisionDataMutex;
164 std::atomic<float> minSelfDistance{0};
166 std::vector<std::pair<VirtualRobot::SceneObjectPtr, VirtualRobot::SceneObjectPtr>>
171 std::vector<VirtualRobot::RobotNodePtr> selfCollisionAvoidanceRobotNodes;
173 VirtualRobot::SceneObjectSetPtr floor;