11 return RobotPose::Identity();
22 pose.translation() = translation;
30 Eigen::Vector3d{X, Y, Z});
34 const Eigen::Ref<const Eigen::Vector3d> &rotation)
37 pose.translation() = translation;
39 pose.linear() = (Eigen::AngleAxisd(rotation[0], Eigen::Vector3d::UnitX()) *
40 Eigen::AngleAxisd(rotation[1], Eigen::Vector3d::UnitY()) *
41 Eigen::AngleAxisd(rotation[2], Eigen::Vector3d::UnitZ()))
50 Eigen::Vector4d{W, X, Y, Z});
54 const Eigen::Ref<const Eigen::Vector4d> &rotation)
56 return createPoseQ(translation, Eigen::Quaterniond(rotation));
60 const Eigen::Quaterniond &rotation)
63 pose.translation() = translation;
64 pose.linear() = rotation.toRotationMatrix();
71 return Eigen::Quaterniond(pose.rotation());
76 Eigen::Vector3d vector;
86 geometry_msgs::Point msg;
96 Eigen::Vector3d vector;
106 geometry_msgs::Vector3 msg;
116 return RobotPose(Eigen::Translation3d(msg.position.x, msg.position.y, msg.position.z) *
122 geometry_msgs::Pose msg;
124 const auto &t = pose.translation();
125 msg.position.x = t.x();
126 msg.position.y = t.y();
127 msg.position.z = t.z();
137 return Eigen::Quaterniond(msg.w, msg.x, msg.y, msg.z);
142 geometry_msgs::Quaternion msg;
143 msg.w = quaternion.w();
144 msg.x = quaternion.x();
145 msg.y = quaternion.y();
146 msg.z = quaternion.z();
153 moveit_msgs::BoundingVolume bv;
155 if (geometry->isMesh())
157 bv.meshes.push_back(geometry->getMeshMsg());
162 bv.primitives.push_back(geometry->getSolidMsg());
173 moveit_msgs::PositionConstraint constraint;
175 constraint.header.frame_id = base_name;
176 constraint.link_name = ee_name;
179 constraint.target_point_offset.x = 0;
180 constraint.target_point_offset.y = 0;
181 constraint.target_point_offset.z = 0;
184 constraint.weight = 1;
191 const Eigen::Quaterniond &orientation,
192 const Eigen::Vector3d &tolerances)
194 moveit_msgs::OrientationConstraint constraint;
196 constraint.header.frame_id = base_name;
197 constraint.link_name = ee_name;
198 constraint.absolute_x_axis_tolerance = tolerances[0];
199 constraint.absolute_y_axis_tolerance = tolerances[1];
200 constraint.absolute_z_axis_tolerance = tolerances[2];
202 constraint.weight = 1;
208 const Eigen::Vector3d &tolerances)
211 Eigen::Quaterniond sampled = Eigen::AngleAxisd(vec[0], Eigen::Vector3d::UnitX())
212 * Eigen::AngleAxisd(vec[1], Eigen::Vector3d::UnitY())
213 * Eigen::AngleAxisd(vec[2], Eigen::Vector3d::UnitZ());
215 return orientation * sampled;
221 Eigen::Quaterniond sampled = Eigen::AngleAxisd(vec[0], Eigen::Vector3d::UnitX())
222 * Eigen::AngleAxisd(vec[1], Eigen::Vector3d::UnitY())
223 * Eigen::AngleAxisd(vec[2], Eigen::Vector3d::UnitZ());
231 return Eigen::AngleAxisd(value, axis) * orientation;
246 auto sampled = RobotPose::Identity();
255 auto sampled = RobotPose::Identity();
265 geometry_msgs::TransformStamped msg;
267 msg.header.stamp = ros::Time::now();
268 msg.header.frame_id = source;
269 msg.child_frame_id = target;
271 const auto &t = tf.translation();
272 msg.transform.translation.x = t.x();
273 msg.transform.translation.y = t.y();
274 msg.transform.translation.z = t.z();
285 pose.translation().x() = tf.transform.translation.x;
286 pose.translation().y() = tf.transform.translation.y;
287 pose.translation().z() = tf.transform.translation.z;
321 bool TF::isVecZero(
const Eigen::Ref<const Eigen::VectorXd> &v,
double tolerance)
323 return v.norm() < tolerance;
A const shared pointer wrapper for robowflex::Geometry.
Eigen::Vector3d uniformRPY(const Eigen::Vector3d &lbound, const Eigen::Vector3d &ubound)
Uniform random sampling of Euler roll-pitch-yaw angles within lower bound lbound and upper bound ubou...
Eigen::Vector3d uniformVec(const Eigen::Vector3d &lbound, const Eigen::Vector3d &ubound)
Generate a uniform real vector within given bounds: [lower_bound, upper_bound)
Eigen::Vector3d gaussianVec(const Eigen::Vector3d &mean, const Eigen::Vector3d &stddev)
Generate a random real vector using a normal distribution with given mean and standard deviation.
moveit_msgs::OrientationConstraint getOrientationConstraint(const std::string &ee_name, const std::string &base_name, const Eigen::Quaterniond &orientation, const Eigen::Vector3d &tolerances)
Get an orientation constraint message.
geometry_msgs::Vector3 vectorEigenToMsg(const Eigen::Vector3d &vector)
Converts an Eigen::Vector3d to a vector message.
Eigen::Vector3d vectorMsgToEigen(const geometry_msgs::Vector3 &msg)
Converts a vector message to an Eigen::Vector3d.
double toDegrees(double v)
Convert an angle to degrees.
geometry_msgs::TransformStamped transformEigenToMsg(const std::string &source, const std::string &target, const RobotPose &tf)
Encode a transform as a message.
RobotPose poseMsgToEigen(const geometry_msgs::Pose &msg)
Converts a pose message to RobotPose.
RobotPose createPoseQ(double x, double y, double z, double W, double X, double Y, double Z)
Creates a robot pose from a linear component and a Quaternion.
double toRadians(double v)
Convert an angle to radians.
RobotPose createPoseXYZ(double x, double y, double z)
Creates a robot pose from a linear component and zero orientation.
Eigen::Vector3d samplePositionGaussian(const Eigen::Vector3d &stddev)
Sample a position from a gaussian distribution with mean zero and given standard deviation.
Eigen::Quaterniond sampleOrientation(const Eigen::Quaterniond &orientation, const Eigen::Vector3d &tolerances)
Sample an orientation from a given orientation with XYZ Euler angle tolerances.
Eigen::Vector3d pointMsgToEigen(const geometry_msgs::Point &msg)
Converts a point message to an Eigen::Vector3d.
geometry_msgs::Pose poseEigenToMsg(const RobotPose &pose)
Converts an RobotPose to a pose message.
RobotPose samplePoseUniform(const Eigen::Vector3d &pos_bounds, const Eigen::Vector3d &orn_bounds)
Sample a pose within the given position, orientation bounds.
double angleNormalize(double v)
Normalize an angle between -pi to pi.
Eigen::Vector3d samplePositionUniform(const Eigen::Vector3d &bounds)
Sample a position within the given bounds using a uniform distribution.
Eigen::Quaterniond quaternionMsgToEigen(const geometry_msgs::Quaternion &msg)
Converts a quaternion message to Eigen::Quaterniond.
geometry_msgs::Point pointEigenToMsg(const Eigen::Vector3d &vector)
Converts an Eigen::Vector3d to a point message.
Eigen::Quaterniond offsetOrientation(const Eigen::Quaterniond &orientation, const Eigen::Vector3d &axis, double value)
Offset an orientation by a rotation about an axis.
moveit_msgs::BoundingVolume getBoundingVolume(const RobotPose &pose, const GeometryConstPtr &geometry)
Get a bounding volume message for given geometry at a pose.
Eigen::Quaterniond sampleOrientationUniform(const Eigen::Vector3d &tolerances)
Sample an orientation within the XYZ Euler angle tolerances.
RobotPose identity()
Creates the Identity pose.
moveit_msgs::PositionConstraint getPositionConstraint(const std::string &ee_name, const std::string &base_name, const RobotPose &pose, const GeometryConstPtr &geometry)
Get a position constraint message.
RobotPose samplePoseGaussian(const Eigen::Vector3d &pos_stddev, const Eigen::Vector3d &orn_bounds)
Sample a pose with gaussian sampling for the position with given standard deviations and uniform samp...
bool isVecZero(const Eigen::Ref< const Eigen::VectorXd > &v, double tolerance=constants::eps)
Checks if a vector is close to zero.
geometry_msgs::Quaternion quaternionEigenToMsg(const Eigen::Quaterniond &quaternion)
Converts an Eigen::Quaterniond to a quaternion message.
RobotPose transformMsgToEigen(const geometry_msgs::TransformStamped &tf)
Decode a message as a transform.
Eigen::Quaterniond getPoseRotation(const RobotPose &pose)
Get the rotational component of a robot pose.
static const double two_pi
Main namespace. Contains all library classes and functions.
std::decay< decltype(std::declval< moveit::core::Transforms >().getTransform("")) >::type RobotPose
A pose (point in SE(3)) used in various functions. Defined from what MoveIt! uses.