11 double dist(
const Eigen::Vector3d& from,
const Eigen::Vector3d& to)
13 return (from - to).norm();
17 const Eigen::Vector3d& st_pt,
const Eigen::Vector3d& end_pt)
const 19 geometry_msgs::Pose cylinder_pose;
22 Eigen::Vector3d axis = end_pt - st_pt;
24 Eigen::Vector3d z_vec(0.0, 0.0, 1.0);
25 const Eigen::Vector3d& x_vec = axis.cross(z_vec);
35 double theta = axis.dot(z_vec);
55 const int&
id,
const Eigen::Vector3d& st_pt,
const Eigen::Vector3d& end_pt,
56 const double& element_diameter, std::string&& shrink_type_suffix)
const 58 moveit_msgs::CollisionObject collision_cylinder;
59 std::string cylinder_id =
"element_" + std::to_string(
id) +
"_" + shrink_type_suffix;
61 collision_cylinder.id = cylinder_id;
63 collision_cylinder.operation = moveit_msgs::CollisionObject::ADD;
65 shape_msgs::SolidPrimitive cylinder_solid;
66 cylinder_solid.type = shape_msgs::SolidPrimitive::CYLINDER;
67 cylinder_solid.dimensions.resize(2);
68 cylinder_solid.dimensions[0] =
dist(st_pt, end_pt);
69 cylinder_solid.dimensions[1] = element_diameter;
70 collision_cylinder.primitives.push_back(cylinder_solid);
73 return collision_cylinder;
79 Eigen::Vector3d translation_vec = end_pt - st_pt;
80 translation_vec.normalize();
82 if(2 * shrink_length > (st_pt - end_pt).norm())
84 ROS_WARN_STREAM(
"[ts processing] shrink length longer than element length!");
85 shrink_length = 0.2 * (st_pt - end_pt).norm();
88 st_pt = st_pt + shrink_length * translation_vec;
89 end_pt = end_pt - shrink_length * translation_vec;
94 choreo_msgs::ElementCandidatePoses msg;
101 if(
"support" ==
type_)
103 msg.type = choreo_msgs::ElementCandidatePoses::SUPPORT;
105 if(
"create" ==
type_)
107 msg.type = choreo_msgs::ElementCandidatePoses::CREATE;
109 if(
"connect" ==
type_)
111 msg.type = choreo_msgs::ElementCandidatePoses::CONNECT;
120 Eigen::Vector3d shrinked_st_pt =
st_pt_;
121 Eigen::Vector3d shrinked_end_pt =
end_pt_;
150 geometry_msgs::Vector3 vec_msg;
153 msg.feasible_orients.push_back(vec_msg);
void vectorEigenToTF(const Eigen::Vector3d &e, tf::Vector3 &t)
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
void vectorEigenToMsg(const Eigen::Vector3d &e, geometry_msgs::Vector3 &m)
static void quaternionTFToMsg(const Quaternion &bt, geometry_msgs::Quaternion &msg)
#define ROS_WARN_STREAM(args)
void pointEigenToMsg(const Eigen::Vector3d &e, geometry_msgs::Point &m)
void createShrinkedEndPoint(Eigen::Vector3d &st_pt, Eigen::Vector3d &end_st, double shrink_length)
INLINE Rall1d< T, V, S > acos(const Rall1d< T, V, S > &x)
std::vector< Eigen::Vector3d > feasible_orients_
choreo_msgs::ElementCandidatePoses asElementCandidatePoses()
double dist(const Eigen::Vector3d &from, const Eigen::Vector3d &to)
geometry_msgs::Pose computeCylinderPose(const Eigen::Vector3d &st_pt, const Eigen::Vector3d &end_pt) const
moveit_msgs::CollisionObject createCollisionObject(const int &id, const Eigen::Vector3d &st_pt, const Eigen::Vector3d &end_pt, const double &element_diameter, std::string &&shrink_type_suffix="") const