65 #define IKFAST_NO_MAIN // Don't include main() from IKFast 142 std::vector<double>
value;
156 std::vector<std::string> joint_names_;
157 std::vector<double> joint_min_vector_;
158 std::vector<double> joint_max_vector_;
159 std::vector<bool> joint_has_limits_vector_;
160 std::vector<std::string> link_names_;
161 const size_t num_joints_;
162 std::vector<int> free_params_;
164 const std::string name_{
"ikfast" };
197 bool getPositionIK(
const geometry_msgs::Pose& ik_pose,
const std::vector<double>& ik_seed_state,
198 std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code,
216 bool getPositionIK(
const std::vector<geometry_msgs::Pose>& ik_poses,
const std::vector<double>& ik_seed_state,
228 bool searchPositionIK(
const geometry_msgs::Pose& ik_pose,
const std::vector<double>& ik_seed_state,
double timeout,
229 std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code,
241 bool searchPositionIK(
const geometry_msgs::Pose& ik_pose,
const std::vector<double>& ik_seed_state,
double timeout,
242 const std::vector<double>& consistency_limits, std::vector<double>& solution,
243 moveit_msgs::MoveItErrorCodes& error_code,
254 bool searchPositionIK(
const geometry_msgs::Pose& ik_pose,
const std::vector<double>& ik_seed_state,
double timeout,
255 std::vector<double>& solution,
const IKCallbackFn& solution_callback,
256 moveit_msgs::MoveItErrorCodes& error_code,
269 bool searchPositionIK(
const geometry_msgs::Pose& ik_pose,
const std::vector<double>& ik_seed_state,
double timeout,
270 const std::vector<double>& consistency_limits, std::vector<double>& solution,
271 const IKCallbackFn& solution_callback, moveit_msgs::MoveItErrorCodes& error_code,
282 bool getPositionFK(
const std::vector<std::string>& link_names,
const std::vector<double>& joint_angles,
283 std::vector<geometry_msgs::Pose>& poses)
const;
294 void setSearchDiscretization(
const std::map<int, double>& discretization);
299 bool setRedundantJoints(
const std::vector<unsigned int>& redundant_joint_indices);
302 bool initialize(
const std::string& robot_description,
const std::string& group_name,
const std::string& base_name,
303 const std::string& tip_name,
double search_discretization);
319 void getSolution(
const IkSolutionList<IkReal>& solutions,
const std::vector<double>& ik_seed_state,
int i,
320 std::vector<double>& solution)
const;
322 double harmonize(
const std::vector<double>& ik_seed_state, std::vector<double>& solution)
const;
324 void getClosestSolution(
const IkSolutionList<IkReal>& solutions,
const std::vector<double>& ik_seed_state,
325 std::vector<double>& solution)
const;
326 void fillFreeParams(
int count,
int* array);
327 bool getCount(
int& count,
const int& max_count,
const int& min_count)
const;
340 const std::string& base_name,
const std::string& tip_name,
341 double search_discretization)
343 setValues(robot_description, group_name, base_name, tip_name, search_discretization);
348 lookupParam(
"robot", robot, std::string());
353 if (free_params_.size() > 1)
355 ROS_FATAL(
"Only one free joint parameter supported!");
358 else if (free_params_.size() == 1)
360 redundant_joint_indices_.clear();
361 redundant_joint_indices_.push_back(free_params_[0]);
362 KinematicsBase::setSearchDiscretization(DEFAULT_SEARCH_DISCRETIZATION);
368 std::string urdf_xml, full_urdf_xml;
369 lookupParam(
"urdf_xml", urdf_xml, robot_description);
370 node_handle.searchParam(urdf_xml, full_urdf_xml);
373 if (!node_handle.getParam(full_urdf_xml, xml_string))
375 ROS_FATAL_NAMED(name_,
"Could not load the xml from parameter server: %s", urdf_xml.c_str());
383 urdf::LinkConstSharedPtr link = robot_model.getLink(getTipFrame());
384 while (link->name != base_frame_ && joint_names_.size() <= num_joints_)
387 link_names_.push_back(link->name);
388 urdf::JointSharedPtr joint = link->parent_joint;
391 if (joint->type != urdf::Joint::UNKNOWN && joint->type != urdf::Joint::FIXED)
395 joint_names_.push_back(joint->name);
398 if (joint->type != urdf::Joint::CONTINUOUS)
402 lower = joint->safety->soft_lower_limit;
403 upper = joint->safety->soft_upper_limit;
407 lower = joint->limits->lower;
408 upper = joint->limits->upper;
420 joint_has_limits_vector_.push_back(
true);
421 joint_min_vector_.push_back(lower);
422 joint_max_vector_.push_back(upper);
426 joint_has_limits_vector_.push_back(
false);
427 joint_min_vector_.push_back(-M_PI);
428 joint_max_vector_.push_back(M_PI);
434 ROS_WARN_NAMED(name_,
"no joint corresponding to %s", link->name.c_str());
436 link = link->getParent();
439 if (joint_names_.size() != num_joints_)
441 ROS_FATAL_STREAM_NAMED(name_,
"Joint numbers mismatch: URDF has " << joint_names_.size() <<
" and IKFast has " 446 std::reverse(link_names_.begin(), link_names_.end());
447 std::reverse(joint_names_.begin(), joint_names_.end());
448 std::reverse(joint_min_vector_.begin(), joint_min_vector_.end());
449 std::reverse(joint_max_vector_.begin(), joint_max_vector_.end());
450 std::reverse(joint_has_limits_vector_.begin(), joint_has_limits_vector_.end());
452 for (
size_t i = 0; i < num_joints_; ++i)
453 ROS_DEBUG_STREAM_NAMED(name_, joint_names_[i] <<
" " << joint_min_vector_[i] <<
" " << joint_max_vector_[i] <<
" " 454 << joint_has_limits_vector_[i]);
462 if (discretization.empty())
464 ROS_ERROR(
"The 'discretization' map is empty");
468 if (redundant_joint_indices_.empty())
474 if (discretization.begin()->first != redundant_joint_indices_[0])
476 std::string redundant_joint = joint_names_[free_params_[0]];
478 << discretization.begin()->first <<
", only joint '" << redundant_joint <<
"' with index " 479 << redundant_joint_indices_[0] <<
" is redundant.");
483 if (discretization.begin()->second <= 0.0)
489 redundant_joint_discretization_.clear();
490 redundant_joint_discretization_[redundant_joint_indices_[0]] = discretization.begin()->second;
495 ROS_ERROR_STREAM(
"Changing the redundant joints isn't permitted by this group's solver ");
506 trans[0] = pose_frame.
p[0];
507 trans[1] = pose_frame.
p[1];
508 trans[2] = pose_frame.
p[2];
522 vals[0] = mult(0, 0);
523 vals[1] = mult(0, 1);
524 vals[2] = mult(0, 2);
525 vals[3] = mult(1, 0);
526 vals[4] = mult(1, 1);
527 vals[5] = mult(1, 2);
528 vals[6] = mult(2, 0);
529 vals[7] = mult(2, 1);
530 vals[8] = mult(2, 2);
533 ComputeIk(trans, vals, vfree.size() > 0 ? &vfree[0] : NULL, solutions);
543 ComputeIk(trans, direction.
data, vfree.size() > 0 ? &vfree[0] : NULL, solutions);
551 ROS_ERROR_NAMED(name_,
"IK for this IkParameterizationType not implemented yet.");
557 ROS_ERROR_NAMED(name_,
"IK for this IkParameterizationType not implemented yet.");
564 ROS_ERROR_NAMED(name_,
"IK for this IkParameterizationType not implemented yet.");
568 double roll, pitch, yaw;
572 pose_frame.
M.
GetRPY(roll, pitch, yaw);
573 ComputeIk(trans, &yaw, vfree.size() > 0 ? &vfree[0] : NULL, solutions);
580 pose_frame.
M.
GetRPY(roll, pitch, yaw);
581 ComputeIk(trans, &roll, vfree.size() > 0 ? &vfree[0] : NULL, solutions);
588 pose_frame.
M.
GetRPY(roll, pitch, yaw);
589 ComputeIk(trans, &pitch, vfree.size() > 0 ? &vfree[0] : NULL, solutions);
593 ROS_ERROR_NAMED(name_,
"Unknown IkParameterizationType! Was the solver generated with an incompatible version " 600 std::vector<double>& solution)
const 603 solution.resize(num_joints_);
607 std::vector<IkReal> vsolfree(sol.
GetFree().size());
608 sol.
GetSolution(&solution[0], vsolfree.size() > 0 ? &vsolfree[0] : NULL);
619 const std::vector<double>& ik_seed_state,
int i,
620 std::vector<double>& solution)
const 623 solution.resize(num_joints_);
627 std::vector<IkReal> vsolfree(sol.
GetFree().size());
628 sol.
GetSolution(&solution[0], vsolfree.size() > 0 ? &vsolfree[0] : NULL);
631 for (std::size_t i = 0; i < num_joints_; ++i)
633 if (joint_has_limits_vector_[i])
635 double signed_distance = solution[i] - ik_seed_state[i];
636 while (signed_distance > M_PI && solution[i] - 2 * M_PI > (joint_min_vector_[i] -
LIMIT_TOLERANCE))
638 signed_distance -= 2 *
M_PI;
639 solution[i] -= 2 *
M_PI;
641 while (signed_distance < -M_PI && solution[i] + 2 * M_PI < (joint_max_vector_[i] +
LIMIT_TOLERANCE))
643 signed_distance += 2 *
M_PI;
644 solution[i] += 2 *
M_PI;
653 std::vector<double> ss = ik_seed_state;
654 for (
size_t i = 0; i < ik_seed_state.size(); ++i)
656 while (ss[i] > 2 * M_PI)
660 while (ss[i] < 2 * M_PI)
664 while (solution[i] > 2 * M_PI)
666 solution[i] -= 2 *
M_PI;
668 while (solution[i] < 2 * M_PI)
670 solution[i] += 2 *
M_PI;
672 dist_sqr += fabs(ik_seed_state[i] - solution[i]);
701 const std::vector<double>& ik_seed_state,
702 std::vector<double>& solution)
const 704 double mindist = DBL_MAX;
706 std::vector<double> sol;
711 getSolution(solutions, i, sol);
712 double dist = harmonize(ik_seed_state, sol);
715 if (minindex == -1 || dist < mindist)
723 getSolution(solutions, minindex, solution);
724 harmonize(ik_seed_state, solution);
730 free_params_.clear();
731 for (
int i = 0; i < count; ++i)
732 free_params_.push_back(array[i]);
739 if (-count >= min_count)
744 else if (count + 1 <= max_count)
756 if (1 - count <= max_count)
761 else if (count - 1 >= min_count)
772 const std::vector<double>& joint_angles,
773 std::vector<geometry_msgs::Pose>& poses)
const 781 ROS_ERROR_NAMED(name_,
"Can only compute FK for Transform6D IK type!");
786 if (link_names.size() == 0)
792 if (link_names.size() != 1 || link_names[0] != getTipFrame())
794 ROS_ERROR_NAMED(name_,
"Can compute FK for %s only", getTipFrame().c_str());
800 IkReal eerot[9], eetrans[3];
802 if (joint_angles.size() != num_joints_)
808 IkReal
angles[num_joints_];
809 for (
unsigned char i = 0; i < num_joints_; i++)
810 angles[i] = joint_angles[i];
815 for (
int i = 0; i < 3; ++i)
816 p_out.
p.
data[i] = eetrans[i];
818 for (
int i = 0; i < 9; ++i)
819 p_out.
M.
data[i] = eerot[i];
828 const std::vector<double>& ik_seed_state,
double timeout,
829 std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code,
832 const IKCallbackFn solution_callback = 0;
833 std::vector<double> consistency_limits;
835 return searchPositionIK(ik_pose, ik_seed_state, timeout, consistency_limits, solution, solution_callback, error_code,
840 const std::vector<double>& ik_seed_state,
double timeout,
841 const std::vector<double>& consistency_limits,
842 std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code,
845 const IKCallbackFn solution_callback = 0;
846 return searchPositionIK(ik_pose, ik_seed_state, timeout, consistency_limits, solution, solution_callback, error_code,
851 const std::vector<double>& ik_seed_state,
double timeout,
852 std::vector<double>& solution,
const IKCallbackFn& solution_callback,
853 moveit_msgs::MoveItErrorCodes& error_code,
856 std::vector<double> consistency_limits;
857 return searchPositionIK(ik_pose, ik_seed_state, timeout, consistency_limits, solution, solution_callback, error_code,
862 const std::vector<double>& ik_seed_state,
double timeout,
863 const std::vector<double>& consistency_limits,
864 std::vector<double>& solution,
const IKCallbackFn& solution_callback,
865 moveit_msgs::MoveItErrorCodes& error_code,
874 if (free_params_.size() == 0)
878 std::vector<geometry_msgs::Pose> ik_poses(1, ik_pose);
879 std::vector<std::vector<double>> solutions;
882 if (!getPositionIK(ik_poses, ik_seed_state, solutions, kinematic_result, options))
885 error_code.val = moveit_msgs::MoveItErrorCodes::NO_IK_SOLUTION;
890 std::vector<LimitObeyingSol> solutions_obey_limits;
891 for (std::size_t i = 0; i < solutions.size(); ++i)
894 for (std::size_t j = 0; j < ik_seed_state.size(); ++j)
896 dist_from_seed += fabs(ik_seed_state[j] - solutions[i][j]);
899 solutions_obey_limits.push_back({ solutions[i], dist_from_seed });
901 std::sort(solutions_obey_limits.begin(), solutions_obey_limits.end());
904 if (!solution_callback.empty())
906 for (std::size_t i = 0; i < solutions_obey_limits.size(); ++i)
908 solution_callback(ik_pose, solutions_obey_limits[i].
value, error_code);
909 if (error_code.val == moveit_msgs::MoveItErrorCodes::SUCCESS)
911 solution = solutions_obey_limits[i].value;
922 solution = solutions_obey_limits[0].value;
923 error_code.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
933 error_code.val = error_code.NO_IK_SOLUTION;
937 if (ik_seed_state.size() != num_joints_)
940 << ik_seed_state.size());
941 error_code.val = error_code.NO_IK_SOLUTION;
945 if (!consistency_limits.empty() && consistency_limits.size() != num_joints_)
947 ROS_ERROR_STREAM_NAMED(name_,
"Consistency limits be empty or must have size " << num_joints_ <<
" instead of size " 948 << consistency_limits.size());
949 error_code.val = error_code.NO_IK_SOLUTION;
959 std::vector<double> vfree(free_params_.size());
964 double initial_guess = ik_seed_state[free_params_[0]];
965 vfree[0] = initial_guess;
969 int num_positive_increments;
970 int num_negative_increments;
972 if (!consistency_limits.empty())
976 double max_limit = fmin(joint_max_vector_[free_params_[0]], initial_guess + consistency_limits[free_params_[0]]);
977 double min_limit = fmax(joint_min_vector_[free_params_[0]], initial_guess - consistency_limits[free_params_[0]]);
979 num_positive_increments = (int)((max_limit - initial_guess) / search_discretization_);
980 num_negative_increments = (int)((initial_guess - min_limit) / search_discretization_);
984 num_positive_increments = (joint_max_vector_[free_params_[0]] - initial_guess) / search_discretization_;
985 num_negative_increments = (initial_guess - joint_min_vector_[free_params_[0]]) / search_discretization_;
991 ROS_DEBUG_STREAM_NAMED(name_,
"Free param is " << free_params_[0] <<
" initial guess is " << initial_guess
992 <<
", # positive increments: " << num_positive_increments
993 <<
", # negative increments: " << num_negative_increments);
994 if ((search_mode &
OPTIMIZE_MAX_JOINT) && (num_positive_increments + num_negative_increments) > 1000)
997 double best_costs = -1.0;
998 std::vector<double> best_solution;
999 int nattempts = 0, nvalid = 0;
1004 int numsol = solve(frame, vfree, solutions);
1012 for (
int s = 0;
s < numsol; ++
s)
1015 std::vector<double> sol;
1016 getSolution(solutions, ik_seed_state, s, sol);
1018 bool obeys_limits =
true;
1019 for (
unsigned int i = 0; i < sol.size(); i++)
1021 if (joint_has_limits_vector_[i] && (sol[i] < joint_min_vector_[i] || sol[i] > joint_max_vector_[i]))
1023 obeys_limits =
false;
1031 getSolution(solutions, ik_seed_state, s, solution);
1034 if (!solution_callback.empty())
1036 solution_callback(ik_pose, solution, error_code);
1040 error_code.val = error_code.SUCCESS;
1043 if (error_code.val == error_code.SUCCESS)
1046 if (search_mode & OPTIMIZE_MAX_JOINT)
1050 for (
unsigned int i = 0; i < solution.size(); i++)
1052 double d = fabs(ik_seed_state[i] - solution[i]);
1056 if (costs < best_costs || best_costs == -1.0)
1059 best_solution = solution;
1070 if (!getCount(counter, num_positive_increments, -num_negative_increments))
1073 error_code.val = moveit_msgs::MoveItErrorCodes::NO_IK_SOLUTION;
1077 vfree[0] = initial_guess + search_discretization_ * counter;
1083 if ((search_mode & OPTIMIZE_MAX_JOINT) && best_costs != -1.0)
1085 solution = best_solution;
1086 error_code.val = error_code.SUCCESS;
1091 error_code.val = moveit_msgs::MoveItErrorCodes::NO_IK_SOLUTION;
1097 std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code,
1108 if (ik_seed_state.size() < num_joints_)
1110 ROS_ERROR_STREAM(
"ik_seed_state only has " << ik_seed_state.size() <<
" entries, this ikfast solver requires " 1116 for (std::size_t i = 0; i < ik_seed_state.size(); i++)
1119 if (joint_has_limits_vector_[i] && ((ik_seed_state[i] < (joint_min_vector_[i] -
LIMIT_TOLERANCE)) ||
1123 <<
" has limit: " << joint_has_limits_vector_[i] <<
" being " 1124 << joint_min_vector_[i] <<
" to " << joint_max_vector_[i]);
1129 std::vector<double> vfree(free_params_.size());
1130 for (std::size_t i = 0; i < free_params_.size(); ++i)
1132 int p = free_params_[i];
1133 ROS_ERROR(
"%u is %f", p, ik_seed_state[p]);
1134 vfree[i] = ik_seed_state[p];
1141 int numsol = solve(frame, vfree, solutions);
1144 std::vector<LimitObeyingSol> solutions_obey_limits;
1148 std::vector<double> solution_obey_limits;
1149 for (std::size_t s = 0;
s < numsol; ++
s)
1151 std::vector<double> sol;
1152 getSolution(solutions, ik_seed_state, s, sol);
1153 ROS_DEBUG_NAMED(name_,
"Sol %d: %e %e %e %e %e %e", (
int)s, sol[0], sol[1], sol[2], sol[3], sol[4],
1156 bool obeys_limits =
true;
1157 for (std::size_t i = 0; i < sol.size(); i++)
1160 if (joint_has_limits_vector_[i] && ((sol[i] < (joint_min_vector_[i] -
LIMIT_TOLERANCE)) ||
1164 obeys_limits =
false;
1166 << joint_has_limits_vector_[i] <<
" being " 1167 << joint_min_vector_[i] <<
" to " << joint_max_vector_[i]);
1174 getSolution(solutions, ik_seed_state, s, solution_obey_limits);
1175 double dist_from_seed = 0.0;
1176 for (std::size_t i = 0; i < ik_seed_state.size(); ++i)
1178 dist_from_seed += fabs(ik_seed_state[i] - solution_obey_limits[i]);
1181 solutions_obey_limits.push_back({ solution_obey_limits, dist_from_seed });
1191 if (!solutions_obey_limits.empty())
1193 std::sort(solutions_obey_limits.begin(), solutions_obey_limits.end());
1194 solution = solutions_obey_limits[0].value;
1195 error_code.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
1199 error_code.val = moveit_msgs::MoveItErrorCodes::NO_IK_SOLUTION;
1204 const std::vector<double>& ik_seed_state,
1205 std::vector<std::vector<double>>& solutions,
1218 if (ik_poses.empty())
1225 if (ik_poses.size() > 1)
1227 ROS_ERROR(
"ik_poses contains multiple entries, only one is allowed");
1232 if (ik_seed_state.size() < num_joints_)
1234 ROS_ERROR_STREAM(
"ik_seed_state only has " << ik_seed_state.size() <<
" entries, this ikfast solver requires " 1243 std::vector<IkSolutionList<IkReal>> solution_set;
1245 std::vector<double> vfree;
1247 std::vector<double> sampled_joint_vals;
1248 if (!redundant_joint_indices_.empty())
1251 sampled_joint_vals.push_back(ik_seed_state[redundant_joint_indices_[0]]);
1255 joint_has_limits_vector_[redundant_joint_indices_.front()])
1257 double joint_min = joint_min_vector_[redundant_joint_indices_.front()];
1258 double joint_max = joint_max_vector_[redundant_joint_indices_.front()];
1260 double jv = sampled_joint_vals[0];
1276 for (
unsigned int i = 0; i < sampled_joint_vals.size(); i++)
1279 vfree.push_back(sampled_joint_vals[i]);
1280 numsol += solve(frame, vfree, ik_solutions);
1281 solution_set.push_back(ik_solutions);
1287 numsol = solve(frame, vfree, ik_solutions);
1288 solution_set.push_back(ik_solutions);
1292 bool solutions_found =
false;
1298 for (
unsigned int r = 0;
r < solution_set.size();
r++)
1300 ik_solutions = solution_set[
r];
1302 for (
int s = 0;
s < numsol; ++
s)
1304 std::vector<double> sol;
1305 getSolution(ik_solutions, ik_seed_state, s, sol);
1307 bool obeys_limits =
true;
1308 for (
unsigned int i = 0; i < sol.size(); i++)
1311 if (joint_has_limits_vector_[i] && ((sol[i] < (joint_min_vector_[i] -
LIMIT_TOLERANCE)) ||
1315 obeys_limits =
false;
1317 << joint_has_limits_vector_[i] <<
" being " 1318 << joint_min_vector_[i] <<
" to " << joint_max_vector_[i]);
1325 solutions_found =
true;
1326 solutions.push_back(sol);
1331 if (solutions_found)
1347 std::vector<double>& sampled_joint_vals)
const 1349 double joint_min = -
M_PI;
1350 double joint_max =
M_PI;
1351 int index = redundant_joint_indices_.front();
1352 double joint_dscrt = redundant_joint_discretization_.at(index);
1354 if (joint_has_limits_vector_[redundant_joint_indices_.front()])
1356 joint_min = joint_min_vector_[index];
1357 joint_max = joint_max_vector_[index];
1364 int steps = std::ceil((joint_max - joint_min) / joint_dscrt);
1365 for (
unsigned int i = 0; i < steps; i++)
1367 sampled_joint_vals.push_back(joint_min + joint_dscrt * i);
1369 sampled_joint_vals.push_back(joint_max);
1374 int steps = std::ceil((joint_max - joint_min) / joint_dscrt);
1375 steps = steps > 0 ? steps : 1;
1376 double diff = joint_max - joint_min;
1377 for (
int i = 0; i < steps; i++)
1379 sampled_joint_vals.push_back(((diff * std::rand()) / (static_cast<double>(RAND_MAX))) + joint_min);
1388 ROS_ERROR_STREAM(
"Discretization method " << method <<
" is not supported");
virtual const IkSolutionBase< T > & GetSolution(size_t index) const
returns the solution pointer
KinematicError kinematic_error
bool initialize(const std::string &robot_description, const std::string &group_name, const std::string &base_name, const std::string &tip_name, double search_discretization)
2D translation along XY plane
const std::vector< std::string > & getLinkNames() const
#define ROS_DEBUG_STREAM_NAMED(name, args)
#define ROS_ERROR_STREAM_NAMED(name, args)
URDF_EXPORT bool initString(const std::string &xmlstring)
#define ROS_WARN_NAMED(name,...)
bool getCount(int &count, const int &max_count, const int &min_count) const
ROSCONSOLE_DECL void initialize()
virtual size_t GetNumSolutions() const
returns the number of solutions stored
void getClosestSolution(const IkSolutionList< IkReal > &solutions, const std::vector< double > &ik_seed_state, std::vector< double > &solution) const
void setSearchDiscretization(const std::map< int, double > &discretization)
Sets the discretization value for the redundant joint.
UNSUPORTED_DISCRETIZATION_REQUESTED
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
IkParameterizationType
The types of inverse kinematics parameterizations supported.
The discrete solutions are returned in this structure.
bool sampleRedundantJoint(kinematics::DiscretizationMethod method, std::vector< double > &sampled_joint_vals) const
samples the designated redundant joint using the chosen discretization method
const double LIMIT_TOLERANCE
end effector reaches desired 6D transformation
#define ROS_INFO_STREAM_NAMED(name, args)
number of parameterizations (does not count IKP_None)
bool operator<(const LimitObeyingSol &a) const
virtual void Clear()
clears all current solutions, note that any memory addresses returned from GetSolution will be invali...
virtual const std::vector< int > & GetFree() const =0
Gets the indices of the configuration space that have to be preset before a full solution can be retu...
PLUGINLIB_EXPORT_CLASS(ikfast_kinematics_plugin::IKFastKinematicsPlugin, kinematics::KinematicsBase)
bool searchPositionIK(const geometry_msgs::Pose &ik_pose, const std::vector< double > &ik_seed_state, double timeout, std::vector< double > &solution, moveit_msgs::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions()) const
Given a desired pose of the end-effector, search for the joint angles required to reach it...
end effector reaches desired 3D rotation
SEARCH_MODE
Search modes for searchPositionIK(), see there.
local point on end effector origin reaches desired 3D global point
IKFAST_API int GetNumFreeParameters()
direction on end effector coordinate system points to desired 3D position
void fillFreeParams(int count, int *array)
the mask for the unique ids
#define ROS_DEBUG_NAMED(name,...)
bit is set if the data represents the time-derivate velocity of an IkParameterization ...
bool setRedundantJoints(const std::vector< unsigned int > &redundant_joint_indices)
Overrides the default method to prevent changing the redundant joints.
#define ROS_WARN_STREAM_ONCE_NAMED(name, args)
#define ROS_FATAL_STREAM_NAMED(name, args)
IKFAST_API bool ComputeIk(const IkReal *eetrans, const IkReal *eerot, const IkReal *pfree, IkSolutionListBase< IkReal > &solutions)
void poseMsgToKDL(const geometry_msgs::Pose &m, KDL::Frame &k)
DiscretizationMethod discretization_method
double harmonize(const std::vector< double > &ik_seed_state, std::vector< double > &solution) const
def xml_string(rootXml, addHeader=True)
boost::function< void(const geometry_msgs::Pose &ik_pose, const std::vector< double > &ik_solution, moveit_msgs::MoveItErrorCodes &error_code)> IKCallbackFn
void GetRPY(double &roll, double &pitch, double &yaw) const
IKFAST_API int * GetFreeParameters()
virtual void GetSolution(T *solution, const T *freevalues) const =0
gets a concrete solution
std::vector< double > value
const std::vector< std::string > & getJointNames() const
end effector origin reaches desired 3D translation
void poseKDLToMsg(const KDL::Frame &k, geometry_msgs::Pose &m)
Default implementation of IkSolutionListBase.
ray on end effector coordinate system reaches desired global ray
#define ROS_FATAL_NAMED(name,...)
#define ROS_ERROR_NAMED(name,...)
IKFAST_API int GetIkType()
MULTIPLE_TIPS_NOT_SUPPORTED
IKFAST_API int GetNumJoints()
#define ROS_ERROR_STREAM(args)
bool getPositionIK(const geometry_msgs::Pose &ik_pose, const std::vector< double > &ik_seed_state, std::vector< double > &solution, moveit_msgs::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions()) const
Given a desired pose of the end-effector, compute the joint angles to reach it.
int solve(KDL::Frame &pose_frame, const std::vector< double > &vfree, IkSolutionList< IkReal > &solutions) const
Calls the IK solver from IKFast.
direction on end effector coordinate system reaches desired direction
IKFAST_API void ComputeFk(const IkReal *j, IkReal *eetrans, IkReal *eerot)
bool getPositionFK(const std::vector< std::string > &link_names, const std::vector< double > &joint_angles, std::vector< geometry_msgs::Pose > &poses) const
Given a set of joint angles and a set of links, compute their pose.
void getSolution(const IkSolutionList< IkReal > &solutions, int i, std::vector< double > &solution) const
Gets a specific solution from the set.
#define ROS_WARN_STREAM_NAMED(name, args)