00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef KINEMATICS_MSGS_HELPER_FUNCTIONS_
00035 #define KINEMATICS_MSGS_HELPER_FUNCTIONS_
00036
00037 #include <set>
00038 #include <vector>
00039 #include <string>
00040
00041 namespace kinematics_msgs
00042 {
00054 void getCollisionLinks(const std::vector<std::string> &default_links, const std::vector<std::string> &collision_enable_links, const std::vector<std::string> &collision_disable_links, std::vector<std::string> &result)
00055 {
00056 if(collision_enable_links.empty() && collision_disable_links.empty())
00057 result = default_links;
00058 else if(!collision_enable_links.empty() && collision_disable_links.empty())
00059 result = collision_enable_links;
00060 else if(collision_enable_links.empty() && !collision_disable_links.empty())
00061 {
00062 std::set<std::string> tmp_set;
00063 for(unsigned int i=0; i < default_links.size(); i++)
00064 tmp_set.insert(default_links[i]);
00065 for(unsigned int i=0; i < collision_disable_links.size(); i++)
00066 tmp_set.erase(collision_disable_links[i]);
00067
00068 for(std::set<std::string>::iterator set_iterator = tmp_set.begin(); set_iterator != tmp_set.end(); set_iterator++)
00069 {
00070 result.push_back(*set_iterator);
00071 }
00072 }
00073 else
00074 {
00075 std::set<std::string> tmp_set;
00076 for(unsigned int i=0; i < default_links.size(); i++)
00077 tmp_set.insert(default_links[i]);
00078 for(unsigned int i=0; i < collision_enable_links.size(); i++)
00079 tmp_set.insert(collision_enable_links[i]);
00080 for(unsigned int i=0; i < collision_disable_links.size(); i++)
00081 tmp_set.erase(collision_disable_links[i]);
00082
00083 for(std::set<std::string>::iterator set_iterator = tmp_set.begin(); set_iterator != tmp_set.end(); set_iterator++)
00084 {
00085 result.push_back(*set_iterator);
00086 }
00087 }
00088 }
00089
00090 }
00091
00092 #endif