6 #include <gtest/gtest.h> 22 static constexpr
const char*
const NAME =
"float";
28 static constexpr
const char*
const NAME =
"double";
37 using Matrix = Eigen::Matrix<T, 3, 3>;
38 using Vector = Eigen::Matrix<T, 3, 1>;
40 Matrix Ra = Ta.rotation(), Rb = Tb.rotation();
41 for (
int i = 0; i < Ra.rows(); ++i)
43 for (
int j = 0; j < Ra.cols(); ++j)
49 Vector pa = Ta.translation(), pb = Tb.translation();
58 static std::default_random_engine en{ 42 };
59 static std::uniform_real_distribution<T> rg{ T(-
M_PI), T(
M_PI) };
74 const static unsigned int number_of_tests = 1000;
78 std::array<T, 6 * 8> sols;
80 for (
unsigned j = 0; j < number_of_tests; ++j)
90 for (
unsigned i = 0; i < 8; ++i)
104 template <
typename T>
107 const static unsigned int number_of_tests = 10000;
109 std::vector<Transform<T>, Eigen::aligned_allocator<Transform<T>>> poses;
110 poses.resize(number_of_tests);
114 std::vector<std::array<T, 6>> random_joint_values;
115 random_joint_values.resize(number_of_tests);
117 for (std::size_t i = 0; i < number_of_tests; ++i)
123 const auto fk_start_tm = std::chrono::steady_clock::now();
124 for (std::size_t i = 0; i < number_of_tests; ++i)
128 const auto fk_end_tm = std::chrono::steady_clock::now();
131 const auto fk_dt_us = std::chrono::duration_cast<std::chrono::microseconds>(fk_end_tm - fk_start_tm).count();
133 <<
" poses in " << fk_dt_us <<
" us\n";
134 std::cout <<
"Average us per fk solve: " <<
static_cast<double>(fk_dt_us) / number_of_tests <<
"\n";
137 std::array<T, 6*8> ik_sol_space;
138 const auto ik_start_tm = std::chrono::steady_clock::now();
139 for (std::size_t i = 0; i < number_of_tests; ++i)
143 const auto ik_end_tm = std::chrono::steady_clock::now();
145 const auto ik_dt_us = std::chrono::duration_cast<std::chrono::microseconds>(ik_end_tm - ik_start_tm).count();
147 <<
" poses in " << ik_dt_us <<
" us\n";
148 std::cout <<
"Average us per ik solve: " <<
static_cast<double>(ik_dt_us) / number_of_tests <<
"\n";
151 TEST(kuka_kr6, random_reachable_poses_double)
153 const auto kukaKR6_R700_sixx = opw_kinematics::makeKukaKR6_R700_sixx<double>();
157 TEST(kuka_kr6, random_reachable_poses_float)
159 const auto kukaKR6_R700_sixx = opw_kinematics::makeKukaKR6_R700_sixx<float>();
163 TEST(kuka_kr6, throughput_tests_float)
165 const auto params = opw_kinematics::makeKukaKR6_R700_sixx<float>();
169 TEST(kuka_kr6, throughput_tests_double)
171 const auto params = opw_kinematics::makeKukaKR6_R700_sixx<double>();
175 TEST(abb_2400, throughput_tests_float)
177 const auto params = opw_kinematics::makeIrb2400_10<float>();
180 TEST(abb_2400, random_reachable_poses_double)
182 const auto params = opw_kinematics::makeIrb2400_10<double>();
186 TEST(abb_2400, random_reachable_poses_float)
188 const auto params= opw_kinematics::makeIrb2400_10<float>();
192 TEST(abb_2400, throughput_tests_double)
194 const auto params = opw_kinematics::makeIrb2400_10<double>();
198 OPW_IGNORE_WARNINGS_PUSH
199 TEST(fanuc_r2000, random_reachable_poses_double)
201 const auto params = opw_kinematics::makeFanucR2000iB_200R<double>();
205 TEST(fanuc_r2000, random_reachable_poses_float)
207 const auto params= opw_kinematics::makeFanucR2000iB_200R<float>();
211 TEST(fanuc_r2000, throughput_tests_float)
213 const auto params = opw_kinematics::makeFanucR2000iB_200R<float>();
217 TEST(fanuc_r2000, throughput_tests_double)
219 const auto params = opw_kinematics::makeFanucR2000iB_200R<double>();
222 OPW_IGNORE_WARNINGS_POP
224 int main(
int argc,
char** argv)
226 testing::InitGoogleTest(&argc, argv);
227 return RUN_ALL_TESTS();
void runThroughputTests(const opw_kinematics::Parameters< T > ¶ms)
#define EXPECT_NEAR(a, b, prec)
bool isValid(const T *qs)
void comparePoses(const Transform< T > &Ta, const Transform< T > &Tb, double tolerance)
void runRandomReachablePosesTest(const opw_kinematics::Parameters< T > ¶ms)
void getRandomJointValues(T *q)
Eigen::Transform< T, 3, Eigen::Isometry > Transform
TEST(kuka_kr6, random_reachable_poses_double)
OPW_IGNORE_WARNINGS_POP int main(int argc, char **argv)
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...
opw_kinematics::Transform< double > Transform
Transform< T > forward(const Parameters< T > &p, const T *qs) noexcept
Computes the tool pose of the robot described by when said robot has the joint positions given by qs...