本文整理汇总了C++中tf::Pose类的典型用法代码示例。如果您正苦于以下问题:C++ Pose类的具体用法?C++ Pose怎么用?C++ Pose使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pose类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: poseKDLToTF
void poseKDLToTF(const KDL::Frame& k, tf::Pose& t)
{
t.setOrigin(tf::Vector3(k.p[0], k.p[1], k.p[2]));
t.setBasis(tf::Matrix3x3(k.M.data[0], k.M.data[1], k.M.data[2],
k.M.data[3], k.M.data[4], k.M.data[5],
k.M.data[6], k.M.data[7], k.M.data[8]));
}
示例2: poseTFToKDL
void poseTFToKDL(const tf::Pose& t, KDL::Frame& k)
{
for (unsigned int i = 0; i < 3; ++i)
k.p[i] = t.getOrigin()[i];
for (unsigned int i = 0; i < 9; ++i)
k.M.data[i] = t.getBasis()[i/3][i%3];
}
示例3: getDistanceAtPose
// copied from channelcontroller
double CalibrateAction::getDistanceAtPose(const tf::Pose & pose, bool* in_bounds) const
{
// determine current dist
int pose_x, pose_y;
costmap_.worldToMapNoBounds(pose.getOrigin().x(), pose.getOrigin().y(),
pose_x, pose_y);
//ROS_INFO("pose_x: %i, pose_y: %i", pose_x, pose_y);
if(pose_x < 0 || pose_y < 0 ||
pose_x >= (int)voronoi_.getSizeX() || pose_y >= (int)voronoi_.getSizeY()) {
if(in_bounds == NULL) {
// only warn if in_bounds isn't checked externally
ROS_WARN_THROTTLE(1.0, "%s: Pose out of voronoi bounds (%.2f, %.2f) = (%d, %d)", __func__,
pose.getOrigin().x(), pose.getOrigin().y(), pose_x, pose_y);
} else {
*in_bounds = false;
}
return 0.0;
}
if(in_bounds) {
*in_bounds = true;
}
float dist = voronoi_.getDistance(pose_x, pose_y);
dist *= costmap_.getResolution();
return dist;
}
示例4: toPose
void toPose(const MathLib::Matrix4& mat4, tf::Pose& pose) {
MathLib::Matrix3 m1 = mat4.GetOrientation();
MathLib::Vector3 v1 = m1.GetRotationAxis();
tf::Vector3 ax(v1(0), v1(1), v1(2));
pose.setRotation(tf::Quaternion(ax, m1.GetRotationAngle()));
v1.Set(mat4.GetTranslation());
pose.setOrigin(tf::Vector3(v1(0),v1(1),v1(2)));
}
示例5: getNextSearchPose
bool MarkerSearcherComputation::getNextSearchPose(tf::Pose& returnPose) {
if(poseReturned) {
return false;
}
returnPose.setOrigin(nextSearchPose.getOrigin());
returnPose.setRotation(nextSearchPose.getRotation());
poseReturned = true;
return true;
}
示例6: Send
int CRvizMarker::Send(tf::Pose p, std::string frame) {
visualization_msgs::Marker marker;
// Set the frame ID and timestamp. See the TF tutorials for information on these.
marker.header.frame_id = frame;
marker.header.stamp = ros::Time::now();
// Set the namespace and id for this marker. This serves to create a unique ID
// Any marker sent with the same namespace and id will overwrite the old one
marker.ns = "nist_fanuc";
marker.id = _id++;
// Set the marker type. Initially this is CUBE, and cycles between that and SPHERE, ARROW, and CYLINDER
marker.type = shape;
// Set the marker action. Options are ADD and DELETE
marker.action = visualization_msgs::Marker::ADD;
// Set the pose of the marker. This is a full 6DOF pose relative to the frame/time specified in the header
#if 0
marker.pose.position.x = 0;
marker.pose.position.y = 0;
marker.pose.position.z = 0;
marker.pose.orientation.x = 0.0;
marker.pose.orientation.y = 0.0;
marker.pose.orientation.z = 0.0;
marker.pose.orientation.w = 1.0;
#endif
marker.pose.position.x = p.getOrigin().x();
marker.pose.position.y = p.getOrigin().y();
marker.pose.position.z = p.getOrigin().z();
marker.pose.orientation.x = p.getRotation().x();
marker.pose.orientation.y = p.getRotation().y();
marker.pose.orientation.z = p.getRotation().z();
marker.pose.orientation.w = p.getRotation().w();
// Set the scale of the marker -- 1x1x1 here means 1m on a side!!!
marker.scale.x = scalex;
marker.scale.y = scaley;
marker.scale.z = scalez;
// Set the color -- be sure to set alpha to something non-zero!
marker.color.r = r;
marker.color.g = g;
marker.color.b = b;
marker.color.a = a;
marker.lifetime = ros::Duration(0.0);
// Publish the marker
marker_pub.publish(marker);
ros::spinOnce();
ros::spinOnce();
return 0;
}
示例7: toTfPose
void toTfPose(const geometry_msgs::Pose& msg_pose, tf::Pose& tf_pose)
{
tf_pose.setOrigin(tf::Vector3(msg_pose.position.x,
msg_pose.position.y,
msg_pose.position.z));
tf_pose.setRotation(tf::Quaternion(msg_pose.orientation.x,
msg_pose.orientation.y,
msg_pose.orientation.z,
msg_pose.orientation.w));
}
示例8: toMatrix4
MathLib::Matrix4 toMatrix4(const tf::Pose& pose) {
MathLib::Matrix4 mat;
mat.Identity();
tf::Matrix3x3 mat33(pose.getRotation());
mat.SetTranslation(MathLib::Vector3(pose.getOrigin().x(), pose.getOrigin().y(), pose.getOrigin().z()));
mat.SetOrientation(MathLib::Matrix3(mat33[0][0], mat33[0][1], mat33[0][2],
mat33[1][0], mat33[1][1], mat33[1][2],
mat33[2][0], mat33[2][1], mat33[2][2]));
return mat;
}
示例9: TFPose2CameraPose
// Convert from tf::Pose to CameraPose (position and orientation)
inline void TFPose2CameraPose(const tf::Pose& pose, CameraPose& cameraPose)
{
// convert to position opencv vector
tf::Vector3 position_tf = pose.getOrigin();
cv::Point3d position = cv::Point3d(position_tf.getX(), position_tf.getY(), position_tf.getZ());
// Convert to orientation opencv quaternion
tf::Quaternion orientation_tf = pose.getRotation();
cv::Vec4d orientation(orientation_tf.getW(), orientation_tf.getX(), orientation_tf.getY(), orientation_tf.getZ());
cameraPose = CameraPose(position, orientation);
}
示例10: toMsgPose
void toMsgPose(const tf::Pose& tf_pose, geometry_msgs::Pose& msg_pose)
{
msg_pose.position.x = tf_pose.getOrigin().getX();
msg_pose.position.y = tf_pose.getOrigin().getY();
msg_pose.position.z = tf_pose.getOrigin().getZ();
tf::Quaternion orientation = tf_pose.getRotation();
msg_pose.orientation.w = orientation.getW();
msg_pose.orientation.x = orientation.getX();
msg_pose.orientation.y = orientation.getY();
msg_pose.orientation.z = orientation.getZ();
}
示例11: tfTransformToGeometryPose
geometry_msgs::Pose tfTransformToGeometryPose(const tf::Pose& goal_pose)
{
geometry_msgs::Pose target_pose1;
target_pose1.orientation.x = goal_pose.getRotation().getX();
target_pose1.orientation.y = goal_pose.getRotation().getY();
target_pose1.orientation.z = goal_pose.getRotation().getZ();
target_pose1.orientation.w = goal_pose.getRotation().getW();
target_pose1.position.x = goal_pose.getOrigin().getX(); // + std::sin(angle)*radius;
target_pose1.position.y = goal_pose.getOrigin().getY(); // + std::cos(angle)*radius;
target_pose1.position.z = goal_pose.getOrigin().getZ();
return target_pose1;
}
示例12: cartCallback
// Callback for the desired cartesian pose
void cartCallback(const geometry_msgs::PoseStampedConstPtr& msg) {
ROS_INFO_STREAM("Received Position Command");
const geometry_msgs::PoseStamped* data = msg.get();
des_ee_pose.setOrigin(tf::Vector3(data->pose.position.x,data->pose.position.y,data->pose.position.z));
des_ee_pose.setRotation(tf::Quaternion(data->pose.orientation.x,data->pose.orientation.y,data->pose.orientation.z,data->pose.orientation.w));
ROS_INFO_STREAM_THROTTLE(1, "Received Position: "<<des_ee_pose.getOrigin().x()<<","<<des_ee_pose.getOrigin().y()<<","<<des_ee_pose.getOrigin().z());
if(bOrientCtrl) {
tf::Quaternion q = des_ee_pose.getRotation();
ROS_INFO_STREAM_THROTTLE(1, "Received Orientation: "<<q.x()<<","<<q.y()<<","<<q.z()<<","<<q.w());
}
}
示例13: tfPoseToGeometryPose
geometry_msgs::Pose tfPoseToGeometryPose(const tf::Pose tPose)
{
geometry_msgs::Pose gPose;
gPose.position.x = tPose.getOrigin().x();
gPose.position.y = tPose.getOrigin().y();
gPose.position.z = tPose.getOrigin().z();
gPose.orientation.x = tPose.getRotation().x();
gPose.orientation.y = tPose.getRotation().y();
gPose.orientation.z = tPose.getRotation().z();
gPose.orientation.w = tPose.getRotation().w();
return gPose;
}
示例14: setMotion
void MotionModel::setMotion(const tf::Pose& pnew, const tf::Pose& pold)
{
tf::Pose delta_pose;
tf::Transform odom_to_base(pold.inverse().getRotation());
delta_pose.setOrigin(odom_to_base * (pnew.getOrigin() - pold.getOrigin()));
delta_pose.setRotation(pnew.getRotation() * pold.getRotation().inverse());
delta_x = delta_pose.getOrigin().x();
delta_y = delta_pose.getOrigin().y();
delta_yaw = atan2(sin(tf::getYaw(delta_pose.getRotation())), cos(tf::getYaw(delta_pose.getRotation())));
dxy=sqrt(delta_x*delta_x+delta_y*delta_y);
}
示例15: PoseValues
static RVector<double> PoseValues(tf::Pose & pose) {
RVector<double> values;
values.push_back( pose.getOrigin().x());
values.push_back( pose.getOrigin().y());
values.push_back( pose.getOrigin().z());
double roll, pitch, yaw;
tf::Quaternion q = pose.getRotation();
tf::Matrix3x3(q).getRPY(roll, pitch, yaw );
values.push_back( roll );
values.push_back( pitch );
values.push_back( yaw );
return values;
}