本文整理汇总了C++中tf::StampedTransform::setData方法的典型用法代码示例。如果您正苦于以下问题:C++ StampedTransform::setData方法的具体用法?C++ StampedTransform::setData怎么用?C++ StampedTransform::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tf::StampedTransform
的用法示例。
在下文中一共展示了StampedTransform::setData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stampedTFDifferenceStampedTF
void stampedTFDifferenceStampedTF(tf::StampedTransform &tf1,
tf::StampedTransform &tf2,
tf::StampedTransform &tfResult)
{
tfResult.setData(tf1.inverseTimes(tf2));
}
示例2: poseStampedToStampedTF
void poseStampedToStampedTF(geometry_msgs::PoseStamped &msg, tf::StampedTransform &stampedTF, std::string child)
{
tf::Transform btTrans;
stampedTF.stamp_ = msg.header.stamp;
stampedTF.frame_id_ = msg.header.frame_id;
stampedTF.child_frame_id_ = child;
tf::poseMsgToTF(msg.pose, btTrans);
stampedTF.setData(btTrans);
}
示例3: multiply_stamped_tfs
bool OdomTf::multiply_stamped_tfs(tf::StampedTransform A_stf,
tf::StampedTransform B_stf, tf::StampedTransform &C_stf) {
//long-winded approach:
//std::string str1(A_stf.child_frame_id_); //want to compare strings to check consistency
//std::string str2(B_stf.frame_id_);
//if (str1.compare(str2) != 0) { //SHOULD get that child frame of A is parent frame of B
//more compact approach:
if (A_stf.child_frame_id_.compare(B_stf.frame_id_) != 0) {
std::cout << "can't multiply transforms; mismatched frames" << endl;
std::cout << A_stf.child_frame_id_ << " is not " << B_stf.frame_id_ << '\n';
return false;
}
//if here, the named frames are logically consistent
tf::Transform C = A_stf*B_stf; //multiplication is defined for transforms
C_stf.setData(C);
C_stf.frame_id_ = A_stf.frame_id_;
C_stf.child_frame_id_ = B_stf.child_frame_id_;
C_stf.stamp_ = ros::Time::now();
//long-winded approach, equivalent to above:
/*
tf::Transform A, B; //simple transforms--not stamped
A = get_tf_from_stamped_tf(A_stf); // get the transform from the stamped transform
B = get_tf_from_stamped_tf(B_stf);
C = A*B; //multiplication is defined for transforms
C_stf.frame_id_ = A_stf.frame_id_; //assign appropriate parent and child frames to result
C_stf.child_frame_id_ = B_stf.child_frame_id_;
C_stf.setOrigin(C.getOrigin()); //populate the origin and orientation of the result
C_stf.setBasis(C.getBasis());
C_stf.stamp_ = ros::Time::now(); //assign the time stamp to current time;
* */
// alternatively, could assign this to the OLDER of A or B transforms
return true; //if got here, the multiplication is valid
}