95inline bool solveCosineEqn(
double a,
double b,
double c,
double& soln1,
double& soln2)
97 double theta1 = atan2(b, a);
98 double denom = sqrt(a * a + b * b);
100 if (fabs(denom) < IK_EPS)
103 std::cout <<
"denom: " << denom <<
'\n';
107 double rhs_ratio = c / denom;
108 if (rhs_ratio < -1 || rhs_ratio > 1)
111 std::cout <<
"rhs_ratio: " << rhs_ratio <<
'\n';
115 double acos_term = acos(rhs_ratio);
116 soln1 = theta1 + acos_term;
117 soln2 = theta1 - acos_term;
140 bool init(
const urdf::ModelInterface& robot_model,
const std::string& root_name,
const std::string& tip_name);
148 std::vector<std::vector<double> >& solution)
const;
156 std::vector<std::vector<double> >& solution)
const;
165 void getSolverInfo(moveit_msgs::msg::KinematicSolverInfo& info);
175 void addJointToChainInfo(
const urdf::JointConstSharedPtr& joint, moveit_msgs::msg::KinematicSolverInfo& info);
177 bool checkJointLimits(
const std::vector<double>& joint_values)
const;
179 bool checkJointLimits(
double joint_value,
int joint_num)
const;
181 Eigen::Isometry3f grhs_, gf_, home_inv_;
183 std::vector<double> angle_multipliers_;
185 std::vector<double> solution_;
187 double shoulder_upperarm_offset_, upperarm_elbow_offset_, elbow_wrist_offset_, shoulder_wrist_offset_,
188 shoulder_elbow_offset_, torso_shoulder_offset_x_, torso_shoulder_offset_y_, torso_shoulder_offset_z_;
190 std::vector<double> min_angles_;
192 std::vector<double> max_angles_;
194 std::vector<bool> continuous_joint_;
void computeIKShoulderRoll(const Eigen::Isometry3f &g_in, double shoulder_roll_initial_guess, std::vector< std::vector< double > > &solution) const
compute IK based on an initial guess for the shoulder roll angle. h
bool init(const urdf::ModelInterface &robot_model, const std::string &root_name, const std::string &tip_name)
Initialize the solver by providing a urdf::Model and a root and tip name.