2 OPW_IGNORE_WARNINGS_PUSH
3 #include <gtest/gtest.h> 6 OPW_IGNORE_WARNINGS_POP
22 const static int width = 100;
27 p.translation() = Eigen::Vector3d(0.75, y * 0.01 - 0.5, 0.5 + z * 0.01);
41 double* pfree =
nullptr;
43 eetrans[0] = p.translation().x();
44 eetrans[1] = p.translation().y();
45 eetrans[2] = p.translation().z();
47 for (
int i = 0; i < 3; ++i)
49 for (
int j = 0; j < 3; ++j)
51 eerot[i * 3 + j] = p.matrix()(i,j);
59 std::array<double, 6 * 8>& sols)
66 std::size_t count = 0;
67 for (
int i = 0; i < 8; ++i)
70 for (
int j = 0; j < 6; ++j)
72 if (std::isnan(opw[i * 6 + j]))
78 if (is_valid) count++;
130 bool findSolInSet(
const std::vector<double>& s,
const std::array<double, 6 * 8>& opw)
132 for (
int i = 0; i < 8; ++i)
135 for (
int j = 0; j < 6; ++j)
137 double value = opw[i*6 + j];
147 if (is_same)
return true;
154 std::cout << std::setprecision(5) << std::fixed;
155 for (
int i = 0; i < 8; ++i)
157 for (
int j = 0; j < 6; ++j)
158 std::cout << sols[i * 6 + j] <<
" ";
168 bool equal_num = num_ikf_sols == num_opw_sols;
171 if (!equal_num)
return;
174 std::vector<double> v (6);
175 for (decltype(num_ikf_sols) i = 0; i < num_ikf_sols; ++i)
180 if (!found_sol_in_opw)
182 std::cout << v[0] <<
" " << v[1] <<
" " << v[2] <<
" " << v[3] <<
" " << v[4] <<
" " 191 TEST(ikfast_to_opw, similar_solutions)
196 const auto abb2400 = opw_kinematics::makeIrb2400_10<double>();
201 for (
int i = 0; i < 40000; ++i)
210 std::array<double, 6 * 8> opw_sols;
219 int main(
int argc,
char **argv)
221 testing::InitGoogleTest(&argc, argv);
222 return RUN_ALL_TESTS();
virtual const IkSolutionBase< T > & GetSolution(size_t index) const
returns the solution pointer
void solveOPW(const opw_kinematics::Parameters< double > ¶m, const Transform &p, std::array< double, 6 *8 > &sols)
void compare(ikfast::IkSolutionList< double > &ikf, std::array< double, 6 *8 > &opw)
virtual size_t GetNumSolutions() const
returns the number of solutions stored
void solveIKFast(const Transform &p, ikfast::IkSolutionList< double > &sols)
static double normalize_angle_positive(double angle)
normalize_angle_positive
size_t countValidSolutions(const std::array< double, 6 *8 > &opw)
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
TEST(ikfast_to_opw, similar_solutions)
void printResults(const std::array< double, 6 *8 > &sols)
IKFAST_API bool ComputeIk(const IkReal *eetrans, const IkReal *eerot, const IkReal *pfree, IkSolutionListBase< IkReal > &solutions)
int main(int argc, char **argv)
static double shortest_angular_distance(double from, double to)
shortest_angular_distance
bool findSolInSet(const std::vector< double > &s, const std::array< double, 6 *8 > &opw)
Eigen::Transform< T, 3, Eigen::Isometry > Transform
Default implementation of IkSolutionListBase.
static double normalize_angle(double angle)
normalize
void inverse(const Parameters< T > ¶ms, const Transform< T > &pose, T *out) noexcept
Computes up to 8 kinematically unique joint solutions that put the tool flange of the robot described...
#define EXPECT_TRUE(args)
opw_kinematics::Transform< double > Transform