9 return v.x + v.y + v.z;
14 const auto d = lhs - rhs;
15 return sqrt(
sum(
d *
d));
20 geometry_msgs::Point ret;
21 ret.x = lhs.x + rhs.x;
22 ret.y = lhs.y + rhs.y;
23 ret.z = lhs.z + rhs.z;
29 geometry_msgs::Point ret;
30 ret.x = lhs.x - rhs.x;
31 ret.y = lhs.y - rhs.y;
32 ret.z = lhs.z - rhs.z;
38 geometry_msgs::Point ret;
39 ret.x = lhs.x * rhs.x;
40 ret.y = lhs.y * rhs.y;
41 ret.z = lhs.z * rhs.z;
47 geometry_msgs::Point ret;
56 return Eigen::Vector3d(point.x, point.y, point.z);
61 return Eigen::Vector3d(vector.x, vector.y, vector.z);
66 return Eigen::Quaterniond(quaternion.w, quaternion.x, quaternion.y, quaternion.z);
71 Eigen::Affine3d ret = Eigen::Translation3d(
toEigen(transform.translation)) *
toEigen(transform.rotation);
77 geometry_msgs::Point ret;
86 geometry_msgs::Quaternion ret;
87 ret.x = quaternion.x();
88 ret.y = quaternion.y();
89 ret.z = quaternion.z();
90 ret.w = quaternion.w();
96 geometry_msgs::Transform ret;
97 Eigen::Quaterniond rotation(transform.rotation());
98 Eigen::Vector3d translation = transform.translation();
100 ret.translation.x = translation.x();
101 ret.translation.y = translation.y();
102 ret.translation.z = translation.z();
111 const static double EPSILON = 0.000001;
115 Eigen::Quaterniond
astra_ros::lookAt(
const Eigen::Vector3d &source_point,
const Eigen::Vector3d &dest_point,
const Eigen::Vector3d &forward,
const Eigen::Vector3d &up)
117 using namespace Eigen;
119 const Vector3d forward_vec = (dest_point - source_point).normalized();
120 const double dot = forward.dot(forward_vec);
122 if (std::abs(
dot + 1.0
f) < EPSILON)
124 return Quaterniond(M_PI, up.x(), up.y(), up.z());
127 if (std::abs(
dot - 1.0
f) < EPSILON)
129 return Quaterniond::Identity();
133 const Vector3d axis = forward.cross(forward_vec).normalized();
136 ret = AngleAxisd(
angle, axis);