Go to the documentation of this file.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
00035
00036
00037
00038 #include <moveit/kinematics_base/kinematics_base.h>
00039
00040 const double kinematics::KinematicsBase::DEFAULT_SEARCH_DISCRETIZATION = 0.1;
00041 const double kinematics::KinematicsBase::DEFAULT_TIMEOUT = 1.0;
00042
00043 void kinematics::KinematicsBase::setValues(const std::string& robot_description,
00044 const std::string& group_name,
00045 const std::string& base_frame,
00046 const std::string& tip_frame,
00047 double search_discretization)
00048 {
00049 robot_description_ = robot_description;
00050 group_name_ = group_name;
00051 base_frame_ = removeSlash(base_frame);
00052 tip_frame_ = removeSlash(tip_frame);
00053 search_discretization_ = search_discretization;
00054 }
00055
00056 bool kinematics::KinematicsBase::setRedundantJoints(const std::vector<unsigned int> &redundant_joint_indices)
00057 {
00058 for(std::size_t i = 0; i < redundant_joint_indices.size(); ++i)
00059 {
00060 if(redundant_joint_indices[i] >= getJointNames().size())
00061 {
00062 return false;
00063 }
00064 }
00065 redundant_joint_indices_ = redundant_joint_indices;
00066 return true;
00067 }
00068
00069 bool kinematics::KinematicsBase::setRedundantJoints(const std::vector<std::string> &redundant_joint_names)
00070 {
00071 const std::vector<std::string> &jnames = getJointNames();
00072 std::vector<unsigned int> redundant_joint_indices;
00073 for (std::size_t i = 0 ; i < redundant_joint_names.size() ; ++i)
00074 for (std::size_t j = 0 ; j < jnames.size() ; ++j)
00075 if (jnames[j] == redundant_joint_names[i])
00076 {
00077 redundant_joint_indices.push_back(j);
00078 break;
00079 }
00080 return redundant_joint_indices.size() == redundant_joint_names.size() ? setRedundantJoints(redundant_joint_indices) : false;
00081 }
00082
00083 std::string kinematics::KinematicsBase::removeSlash(const std::string &str) const
00084 {
00085 return (!str.empty() && str[0] == '/') ? removeSlash(str.substr(1)) : str;
00086 }