3 #include <SimoxUtility/math/distance/angle_between.h>
4 #include <SimoxUtility/math/project_to_plane.h>
5 #include <SimoxUtility/math/convert/pos_mat3f_to_mat4f.h>
6 #include <SimoxUtility/meta/enum/adapt_enum.h>
15 const simox::meta::EnumNames<armarx::box_to_grasp_candidates::box_alignment>
16 enum_names<armarx::box_to_grasp_candidates::box_alignment>
52 template<
class D1,
class D2,
class D3>
55 simox::meta::is_vec3_v<D1>&&
56 simox::meta::is_vec3_v<D2>&&
57 simox::meta::is_vec3_v<D3>, box_to_grasp_candidates::grasp >
59 const Eigen::MatrixBase<D1>& center_pos,
60 const Eigen::MatrixBase<D2>& up,
float up_len,
const Eigen::Vector3f& hand_up,
61 const Eigen::MatrixBase<D3>& transverse,
const Eigen::Vector3f& hand_transv,
62 const Eigen::Vector3f& tcp_shift)
64 const Eigen::Vector3f up_normalized = up.normalized();
66 const Eigen::Vector3f ax = hand_up.cross(up).normalized();
67 const float ang_u = simox::math::angle_between_vec3f_vec3f(hand_up, up_normalized, ax);
68 const Eigen::Matrix3f upward_ori = Eigen::AngleAxisf(ang_u, ax).toRotationMatrix();
72 const Eigen::Vector3f hand_transv_glob = upward_ori * hand_transv;
73 const Eigen::Vector3f hand_transv_glob_flat = simox::math::project_to_plane(hand_transv_glob, up_normalized);
74 const Eigen::Vector3f transverse_flat = simox::math::project_to_plane(transverse, up_normalized);
75 const float ang = simox::math::angle_between_vec3f_vec3f(
76 hand_transv_glob_flat,
80 const Eigen::Matrix3f transv_align = Eigen::AngleAxisf{ang, up_normalized.normalized()}.toRotationMatrix();
83 const Eigen::Vector3f gc_pos = center_pos + up_normalized * up_len / 2;
86 simox::math::pos_mat3f_to_mat4f(
87 gc_pos + gc_ori * tcp_shift,
102 for (std::uint_fast8_t i = 0; i < 24; ++i)
125 for (std::uint_fast8_t i = 0; i < 24; ++i)
147 const std::string&
s,
156 const std::string&
s,