65 #define IKFAST_NO_MAIN // Don't include main() from IKFast 163 std::vector<int> free_params_;
170 const std::vector<std::string>& getLinkNames()
const 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());
354 if (free_params_.size() > 1)
356 ROS_FATAL(
"Only one free joint parameter supported!");
359 else if (free_params_.size() == 1)
361 redundant_joint_indices_.clear();
362 redundant_joint_indices_.push_back(free_params_[0]);
363 KinematicsBase::setSearchDiscretization(DEFAULT_SEARCH_DISCRETIZATION);
369 std::string urdf_xml, full_urdf_xml;
370 lookupParam(
"urdf_xml", urdf_xml, robot_description);
374 if (!node_handle.
getParam(full_urdf_xml, xml_string))
376 ROS_FATAL_NAMED(
"ikfast",
"Could not load the xml from parameter server: %s", urdf_xml.c_str());
384 urdf::LinkConstSharedPtr link = robot_model.getLink(getTipFrame());
385 while (link->name != base_frame_ && joint_names_.size() <= num_joints_)
388 link_names_.push_back(link->name);
389 urdf::JointSharedPtr joint = link->parent_joint;
392 if (joint->type != urdf::Joint::UNKNOWN && joint->type != urdf::Joint::FIXED)
396 joint_names_.push_back(joint->name);
399 if (joint->type != urdf::Joint::CONTINUOUS)
403 lower = joint->safety->soft_lower_limit;
404 upper = joint->safety->soft_upper_limit;
408 lower = joint->limits->lower;
409 upper = joint->limits->upper;
421 joint_has_limits_vector_.push_back(
true);
422 joint_min_vector_.push_back(lower);
423 joint_max_vector_.push_back(upper);
427 joint_has_limits_vector_.push_back(
false);
428 joint_min_vector_.push_back(-M_PI);
429 joint_max_vector_.push_back(M_PI);
435 ROS_WARN_NAMED(
"ikfast",
"no joint corresponding to %s", link->name.c_str());
437 link = link->getParent();
440 if (joint_names_.size() != num_joints_)
442 ROS_FATAL_STREAM_NAMED(
"ikfast",
"Joint numbers mismatch: URDF has " << joint_names_.size() <<
" and IKFast has " 447 std::reverse(link_names_.begin(), link_names_.end());
448 std::reverse(joint_names_.begin(), joint_names_.end());
449 std::reverse(joint_min_vector_.begin(), joint_min_vector_.end());
450 std::reverse(joint_max_vector_.begin(), joint_max_vector_.end());
451 std::reverse(joint_has_limits_vector_.begin(), joint_has_limits_vector_.end());
453 for (
size_t i = 0; i < num_joints_; ++i)
454 ROS_DEBUG_STREAM_NAMED(
"ikfast", joint_names_[i] <<
" " << joint_min_vector_[i] <<
" " << joint_max_vector_[i]
455 <<
" " << joint_has_limits_vector_[i]);
463 if (discretization.empty())
465 ROS_ERROR(
"The 'discretization' map is empty");
469 if (redundant_joint_indices_.empty())
475 if (discretization.begin()->first != redundant_joint_indices_[0])
477 std::string redundant_joint = joint_names_[free_params_[0]];
479 << discretization.begin()->first <<
", only joint '" << redundant_joint <<
"' with index " 480 << redundant_joint_indices_[0] <<
" is redundant.");
484 if (discretization.begin()->second <= 0.0)
490 redundant_joint_discretization_.clear();
491 redundant_joint_discretization_[redundant_joint_indices_[0]] = discretization.begin()->second;
496 ROS_ERROR_STREAM(
"Changing the redundant joints isn't permitted by this group's solver ");
507 trans[0] = pose_frame.
p[0];
508 trans[1] = pose_frame.
p[1];
509 trans[2] = pose_frame.
p[2];
523 vals[0] = mult(0, 0);
524 vals[1] = mult(0, 1);
525 vals[2] = mult(0, 2);
526 vals[3] = mult(1, 0);
527 vals[4] = mult(1, 1);
528 vals[5] = mult(1, 2);
529 vals[6] = mult(2, 0);
530 vals[7] = mult(2, 1);
531 vals[8] = mult(2, 2);
534 ComputeIk(trans, vals, vfree.size() > 0 ? &vfree[0] : NULL, solutions);
544 ComputeIk(trans, direction.
data, vfree.size() > 0 ? &vfree[0] : NULL, solutions);
552 ROS_ERROR_NAMED(
"ikfast",
"IK for this IkParameterizationType not implemented yet.");
558 ROS_ERROR_NAMED(
"ikfast",
"IK for this IkParameterizationType not implemented yet.");
568 ROS_ERROR_NAMED(
"ikfast",
"IK for this IkParameterizationType not implemented yet.");
572 ROS_ERROR_NAMED(
"ikfast",
"Unknown IkParameterizationType! Was the solver generated with an incompatible version " 579 std::vector<double>& solution)
const 582 solution.resize(num_joints_);
586 std::vector<IkReal> vsolfree(sol.
GetFree().size());
587 sol.
GetSolution(&solution[0], vsolfree.size() > 0 ? &vsolfree[0] : NULL);
598 const std::vector<double>& ik_seed_state,
int i,
599 std::vector<double>& solution)
const 602 solution.resize(num_joints_);
606 std::vector<IkReal> vsolfree(sol.
GetFree().size());
607 sol.
GetSolution(&solution[0], vsolfree.size() > 0 ? &vsolfree[0] : NULL);
610 for (std::size_t i = 0; i < num_joints_; ++i)
612 if (joint_has_limits_vector_[i])
614 double signed_distance = solution[i] - ik_seed_state[i];
617 signed_distance -= 2 *
M_PI;
618 solution[i] -= 2 *
M_PI;
622 signed_distance += 2 *
M_PI;
623 solution[i] += 2 *
M_PI;
632 std::vector<double> ss = ik_seed_state;
633 for (
size_t i = 0; i < ik_seed_state.size(); ++i)
635 while (ss[i] > 2 *
M_PI)
639 while (ss[i] < 2 *
M_PI)
643 while (solution[i] > 2 *
M_PI)
645 solution[i] -= 2 *
M_PI;
647 while (solution[i] < 2 *
M_PI)
649 solution[i] += 2 *
M_PI;
651 dist_sqr += fabs(ik_seed_state[i] - solution[i]);
680 const std::vector<double>& ik_seed_state,
681 std::vector<double>& solution)
const 683 double mindist = DBL_MAX;
685 std::vector<double> sol;
690 getSolution(solutions, i, sol);
691 double dist = harmonize(ik_seed_state, sol);
694 if (minindex == -1 || dist < mindist)
702 getSolution(solutions, minindex, solution);
703 harmonize(ik_seed_state, solution);
709 free_params_.clear();
710 for (
int i = 0; i < count; ++i)
711 free_params_.push_back(array[i]);
718 if (-count >= min_count)
723 else if (count + 1 <= max_count)
735 if (1 - count <= max_count)
740 else if (count - 1 >= min_count)
751 const std::vector<double>& joint_angles,
752 std::vector<geometry_msgs::Pose>& poses)
const 760 ROS_ERROR_NAMED(
"ikfast",
"Can only compute FK for Transform6D IK type!");
765 if (link_names.size() == 0)
771 if (link_names.size() != 1 || link_names[0] != getTipFrame())
773 ROS_ERROR_NAMED(
"ikfast",
"Can compute FK for %s only", getTipFrame().c_str());
779 IkReal eerot[9], eetrans[3];
780 IkReal
angles[joint_angles.size()];
781 for (
unsigned char i = 0; i < joint_angles.size(); i++)
782 angles[i] = joint_angles[i];
787 for (
int i = 0; i < 3; ++i)
788 p_out.
p.
data[i] = eetrans[i];
790 for (
int i = 0; i < 9; ++i)
791 p_out.
M.
data[i] = eerot[i];
800 const std::vector<double>& ik_seed_state,
double timeout,
801 std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code,
805 std::vector<double> consistency_limits;
807 return searchPositionIK(ik_pose, ik_seed_state, timeout, consistency_limits, solution, solution_callback, error_code,
812 const std::vector<double>& ik_seed_state,
double timeout,
813 const std::vector<double>& consistency_limits,
814 std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code,
818 return searchPositionIK(ik_pose, ik_seed_state, timeout, consistency_limits, solution, solution_callback, error_code,
823 const std::vector<double>& ik_seed_state,
double timeout,
824 std::vector<double>& solution,
const IKCallbackFn& solution_callback,
825 moveit_msgs::MoveItErrorCodes& error_code,
828 std::vector<double> consistency_limits;
829 return searchPositionIK(ik_pose, ik_seed_state, timeout, consistency_limits, solution, solution_callback, error_code,
834 const std::vector<double>& ik_seed_state,
double timeout,
835 const std::vector<double>& consistency_limits,
836 std::vector<double>& solution,
const IKCallbackFn& solution_callback,
837 moveit_msgs::MoveItErrorCodes& error_code,
846 if (free_params_.size() == 0)
850 std::vector<geometry_msgs::Pose> ik_poses(1, ik_pose);
851 std::vector<std::vector<double>> solutions;
854 if (!getPositionIK(ik_poses, ik_seed_state, solutions, kinematic_result, options))
857 error_code.val = moveit_msgs::MoveItErrorCodes::NO_IK_SOLUTION;
862 std::vector<LimitObeyingSol> solutions_obey_limits;
863 for (std::size_t i = 0; i < solutions.size(); ++i)
866 for (std::size_t j = 0; j < ik_seed_state.size(); ++j)
868 dist_from_seed += fabs(ik_seed_state[j] - solutions[i][j]);
871 solutions_obey_limits.push_back({ solutions[i], dist_from_seed });
873 std::sort(solutions_obey_limits.begin(), solutions_obey_limits.end());
876 if (!solution_callback.empty())
878 for (std::size_t i = 0; i < solutions_obey_limits.size(); ++i)
880 solution_callback(ik_pose, solutions_obey_limits[i].
value, error_code);
881 if (error_code.val == moveit_msgs::MoveItErrorCodes::SUCCESS)
883 solution = solutions_obey_limits[i].value;
894 solution = solutions_obey_limits[0].value;
895 error_code.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
905 error_code.val = error_code.NO_IK_SOLUTION;
909 if (ik_seed_state.size() != num_joints_)
912 << ik_seed_state.size());
913 error_code.val = error_code.NO_IK_SOLUTION;
917 if (!consistency_limits.empty() && consistency_limits.size() != num_joints_)
920 << num_joints_ <<
" instead of size " << consistency_limits.size());
921 error_code.val = error_code.NO_IK_SOLUTION;
931 std::vector<double> vfree(free_params_.size());
936 double initial_guess = ik_seed_state[free_params_[0]];
937 vfree[0] = initial_guess;
941 int num_positive_increments;
942 int num_negative_increments;
944 if (!consistency_limits.empty())
948 double max_limit = fmin(joint_max_vector_[free_params_[0]], initial_guess + consistency_limits[free_params_[0]]);
949 double min_limit = fmax(joint_min_vector_[free_params_[0]], initial_guess - consistency_limits[free_params_[0]]);
951 num_positive_increments = (int)((max_limit - initial_guess) / search_discretization_);
952 num_negative_increments = (int)((initial_guess - min_limit) / search_discretization_);
956 num_positive_increments = (joint_max_vector_[free_params_[0]] - initial_guess) / search_discretization_;
957 num_negative_increments = (initial_guess - joint_min_vector_[free_params_[0]]) / search_discretization_;
963 ROS_DEBUG_STREAM_NAMED(
"ikfast",
"Free param is " << free_params_[0] <<
" initial guess is " << initial_guess
964 <<
", # positive increments: " << num_positive_increments
965 <<
", # negative increments: " << num_negative_increments);
966 if ((search_mode &
OPTIMIZE_MAX_JOINT) && (num_positive_increments + num_negative_increments) > 1000)
969 double best_costs = -1.0;
970 std::vector<double> best_solution;
971 int nattempts = 0, nvalid = 0;
976 int numsol = solve(frame, vfree, solutions);
984 for (
int s = 0;
s < numsol; ++
s)
987 std::vector<double> sol;
988 getSolution(solutions, ik_seed_state,
s, sol);
990 bool obeys_limits =
true;
991 for (
unsigned int i = 0; i < sol.size(); i++)
993 if (joint_has_limits_vector_[i] && (sol[i] < joint_min_vector_[i] || sol[i] > joint_max_vector_[i]))
995 obeys_limits =
false;
1003 getSolution(solutions, ik_seed_state,
s, solution);
1006 if (!solution_callback.empty())
1008 solution_callback(ik_pose, solution, error_code);
1012 error_code.val = error_code.SUCCESS;
1015 if (error_code.val == error_code.SUCCESS)
1018 if (search_mode & OPTIMIZE_MAX_JOINT)
1022 for (
unsigned int i = 0; i < solution.size(); i++)
1024 double d = fabs(ik_seed_state[i] - solution[i]);
1028 if (costs < best_costs || best_costs == -1.0)
1031 best_solution = solution;
1042 if (!getCount(counter, num_positive_increments, -num_negative_increments))
1045 error_code.val = moveit_msgs::MoveItErrorCodes::NO_IK_SOLUTION;
1049 vfree[0] = initial_guess + search_discretization_ * counter;
1055 if ((search_mode & OPTIMIZE_MAX_JOINT) && best_costs != -1.0)
1057 solution = best_solution;
1058 error_code.val = error_code.SUCCESS;
1063 error_code.val = moveit_msgs::MoveItErrorCodes::NO_IK_SOLUTION;
1069 std::vector<double>& solution, moveit_msgs::MoveItErrorCodes& error_code,
1080 if (ik_seed_state.size() < num_joints_)
1082 ROS_ERROR_STREAM(
"ik_seed_state only has " << ik_seed_state.size() <<
" entries, this ikfast solver requires " 1088 for (std::size_t i = 0; i < ik_seed_state.size(); i++)
1091 if (joint_has_limits_vector_[i] && ((ik_seed_state[i] < (joint_min_vector_[i] -
LIMIT_TOLERANCE)) ||
1095 <<
" has limit: " << joint_has_limits_vector_[i] <<
" being " 1096 << joint_min_vector_[i] <<
" to " << joint_max_vector_[i]);
1101 std::vector<double> vfree(free_params_.size());
1102 for (std::size_t i = 0; i < free_params_.size(); ++i)
1104 int p = free_params_[i];
1105 ROS_ERROR(
"%u is %f", p, ik_seed_state[p]);
1106 vfree[i] = ik_seed_state[p];
1113 int numsol = solve(frame, vfree, solutions);
1116 std::vector<LimitObeyingSol> solutions_obey_limits;
1120 std::vector<double> solution_obey_limits;
1121 for (std::size_t
s = 0;
s < numsol; ++
s)
1123 std::vector<double> sol;
1124 getSolution(solutions, ik_seed_state,
s, sol);
1125 ROS_DEBUG_NAMED(
"ikfast",
"Sol %d: %e %e %e %e %e %e", (
int)
s, sol[0], sol[1], sol[2], sol[3], sol[4],
1128 bool obeys_limits =
true;
1129 for (std::size_t i = 0; i < sol.size(); i++)
1132 if (joint_has_limits_vector_[i] && ((sol[i] < (joint_min_vector_[i] -
LIMIT_TOLERANCE)) ||
1136 obeys_limits =
false;
1138 << joint_has_limits_vector_[i] <<
" being " 1139 << joint_min_vector_[i] <<
" to " << joint_max_vector_[i]);
1146 getSolution(solutions, ik_seed_state, s, solution_obey_limits);
1148 for (std::size_t i = 0; i < ik_seed_state.size(); ++i)
1150 dist_from_seed += fabs(ik_seed_state[i] - solution_obey_limits[i]);
1153 solutions_obey_limits.push_back({ solution_obey_limits, dist_from_seed });
1163 if (!solutions_obey_limits.empty())
1165 std::sort(solutions_obey_limits.begin(), solutions_obey_limits.end());
1166 solution = solutions_obey_limits[0].value;
1167 error_code.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
1171 error_code.val = moveit_msgs::MoveItErrorCodes::NO_IK_SOLUTION;
1176 const std::vector<double>& ik_seed_state,
1177 std::vector<std::vector<double>>& solutions,
1190 if (ik_poses.empty())
1197 if (ik_poses.size() > 1)
1199 ROS_ERROR(
"ik_poses contains multiple entries, only one is allowed");
1204 if (ik_seed_state.size() < num_joints_)
1206 ROS_ERROR_STREAM(
"ik_seed_state only has " << ik_seed_state.size() <<
" entries, this ikfast solver requires " 1215 std::vector<IkSolutionList<IkReal>> solution_set;
1217 std::vector<double> vfree;
1219 std::vector<double> sampled_joint_vals;
1220 if (!redundant_joint_indices_.empty())
1223 sampled_joint_vals.push_back(ik_seed_state[redundant_joint_indices_[0]]);
1227 joint_has_limits_vector_[redundant_joint_indices_.front()])
1229 double joint_min = joint_min_vector_[redundant_joint_indices_.front()];
1230 double joint_max = joint_max_vector_[redundant_joint_indices_.front()];
1232 double jv = sampled_joint_vals[0];
1248 for (
unsigned int i = 0; i < sampled_joint_vals.size(); i++)
1251 vfree.push_back(sampled_joint_vals[i]);
1252 numsol += solve(frame, vfree, ik_solutions);
1253 solution_set.push_back(ik_solutions);
1259 numsol = solve(frame, vfree, ik_solutions);
1260 solution_set.push_back(ik_solutions);
1264 bool solutions_found =
false;
1270 for (
unsigned int r = 0;
r < solution_set.size();
r++)
1272 ik_solutions = solution_set[
r];
1274 for (
int s = 0;
s < numsol; ++
s)
1276 std::vector<double> sol;
1277 getSolution(ik_solutions, ik_seed_state,
s, sol);
1279 bool obeys_limits =
true;
1280 for (
unsigned int i = 0; i < sol.size(); i++)
1283 if (joint_has_limits_vector_[i] && ((sol[i] < (joint_min_vector_[i] -
LIMIT_TOLERANCE)) ||
1287 obeys_limits =
false;
1289 "ikfast",
"Not in limits! " << i <<
" value " << sol[i] <<
" has limit: " << joint_has_limits_vector_[i]
1290 <<
" being " << joint_min_vector_[i] <<
" to " << joint_max_vector_[i]);
1297 solutions_found =
true;
1298 solutions.push_back(sol);
1303 if (solutions_found)
1319 std::vector<double>& sampled_joint_vals)
const 1321 double joint_min = -
M_PI;
1322 double joint_max =
M_PI;
1323 int index = redundant_joint_indices_.front();
1324 double joint_dscrt = redundant_joint_discretization_.at(index);
1326 if (joint_has_limits_vector_[redundant_joint_indices_.front()])
1328 joint_min = joint_min_vector_[index];
1329 joint_max = joint_max_vector_[index];
1336 int steps = std::ceil((joint_max - joint_min) / joint_dscrt);
1337 for (
unsigned int i = 0; i < steps; i++)
1339 sampled_joint_vals.push_back(joint_min + joint_dscrt * i);
1341 sampled_joint_vals.push_back(joint_max);
1346 int steps = std::ceil((joint_max - joint_min) / joint_dscrt);
1347 steps = steps > 0 ? steps : 1;
1348 double diff = joint_max - joint_min;
1349 for (
int i = 0; i < steps; i++)
1351 sampled_joint_vals.push_back(((diff * std::rand()) / (static_cast<double>(RAND_MAX))) + joint_min);
1360 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
IKFAST_API int GetIkType()
void getClosestSolution(const IkSolutionList< IkReal > &solutions, const std::vector< double > &ik_seed_state, std::vector< double > &solution) 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,...)
ROSCONSOLE_DECL void initialize()
IKFAST_API int GetNumJoints()
end effector reaches desired 6D transformation
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.
virtual size_t GetNumSolutions() const
returns the number of solutions stored
UNSUPORTED_DISCRETIZATION_REQUESTED
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
std::vector< bool > joint_has_limits_vector_
number of parameterizations (does not count IKP_None)
The discrete solutions are returned in this structure.
the mask for the unique ids
#define ROS_INFO_STREAM_NAMED(name, args)
virtual void Clear()
clears all current solutions, note that any memory addresses returned from GetSolution will be invali...
std::vector< double > joint_min_vector_
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...
IKFAST_API bool ComputeIk(const IkReal *eetrans, const IkReal *eerot, const IkReal *pfree, IkSolutionListBase< IkReal > &solutions)
IkParameterizationType
The types of inverse kinematics parameterizations supported.
ray on end effector coordinate system reaches desired global ray
direction on end effector coordinate system points to desired 3D position
#define ROS_DEBUG_NAMED(name,...)
SEARCH_MODE
Search modes for searchPositionIK(), see there.
std::vector< double > value
end effector reaches desired 3D rotation
double harmonize(const std::vector< double > &ik_seed_state, std::vector< double > &solution) const
#define ROS_WARN_STREAM_ONCE_NAMED(name, args)
#define ROS_FATAL_STREAM_NAMED(name, args)
local point on end effector origin reaches desired 3D global point
std::vector< double > joint_max_vector_
IKFAST_API int GetNumFreeParameters()
bool searchParam(const std::string &key, std::string &result) const
std::vector< std::string > link_names_
bool setRedundantJoints(const std::vector< unsigned int > &redundant_joint_indices)
Overrides the default method to prevent changing the redundant joints.
2D translation along XY plane
void poseMsgToKDL(const geometry_msgs::Pose &m, KDL::Frame &k)
bool getCount(int &count, const int &max_count, const int &min_count) const
DiscretizationMethod discretization_method
void setSearchDiscretization(const std::map< int, double > &discretization)
Sets the discretization value for the redundant joint.
const std::vector< std::string > & getJointNames() const
def xml_string(rootXml, addHeader=True)
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...
boost::function< void(const geometry_msgs::Pose &ik_pose, const std::vector< double > &ik_solution, moveit_msgs::MoveItErrorCodes &error_code)> IKCallbackFn
direction on end effector coordinate system reaches desired direction
IKFAST_API int * GetFreeParameters()
end effector origin reaches desired 3D translation
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.
virtual void GetSolution(T *solution, const T *freevalues) const =0
gets a concrete solution
const double LIMIT_TOLERANCE
void poseKDLToMsg(const KDL::Frame &k, geometry_msgs::Pose &m)
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)
Default implementation of IkSolutionListBase.
bool getParam(const std::string &key, std::string &s) const
#define ROS_FATAL_NAMED(name,...)
IKFAST_API void ComputeFk(const IkReal *j, IkReal *eetrans, IkReal *eerot)
bool sampleRedundantJoint(kinematics::DiscretizationMethod method, std::vector< double > &sampled_joint_vals) const
samples the designated redundant joint using the chosen discretization method
#define ROS_ERROR_NAMED(name,...)
int solve(KDL::Frame &pose_frame, const std::vector< double > &vfree, IkSolutionList< IkReal > &solutions) const
Calls the IK solver from IKFast.
MULTIPLE_TIPS_NOT_SUPPORTED
#define ROS_ERROR_STREAM(args)
void fillFreeParams(int count, int *array)
bool operator<(const LimitObeyingSol &a) const
bit is set if the data represents the time-derivate velocity of an IkParameterization ...
#define ROS_WARN_STREAM_NAMED(name, args)
std::vector< std::string > joint_names_