Ask Your Question
0

Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

asked 2019-05-02 09:12:08 -0600

Salahuddin_Khan gravatar image

updated 2019-05-02 09:22:04 -0600

I'm trying to find a cascaded transform but I'm running into the following errors :

tf::TransformListener listener;
tf::StampedTransform transform_cd;
try
{
  for(unsigned int i=0; i<tag_detection_array.detections.size(); i++) {
    geometry_msgs::PoseStamped pose;
    pose.pose = tag_detection_array.detections[i].pose.pose.pose;
    pose.header = tag_detection_array.detections[i].pose.header;
    tf::Stamped<tf::Transform> tag_transform, transform_td, transform_tc;
    tf::poseStampedMsgToTF(pose, tag_transform);
    listener.lookupTransform("camera", "drone",  tag_transform.stamp_, transform_cd);
    transform_tc = tag_transform.inverse();
    transform_td = transform_tc*transform_cd;
    tf::Matrix3x3(transform_td.getRotation()).getRPY(uavRollENU, uavPitchENU, uavYawENU);
    if(pose.pose.position.z>0.1 && fabs(uavPitchENU) < 30/57.2958 && fabs(uavRollENU) < 30/57.2958)
    {
      tf_pub_.sendTransform(tf::StampedTransform(tag_transform,
                                              tag_transform.stamp_,
                                              camera_tf_frame_,
                                              detection_names[i]));
      tf::poseStampedTFToMsg(transform_td, pose);


    error: no match for ‘operator=’ (operand types are ‘tf::Stamped<tf::Transform>’ and ‘tf::Transform’)
     transform_tc = tag_transform.inverse();
error: no match for ‘operator=’ (operand types are ‘tf::Stamped<tf::Transform>’ and ‘tf::Transform’)
     transform_td = transform_tc*transform_cd;
edit retag flag offensive close merge delete

Comments

This is what I'm attempting to do transform_tc = tag_transform.inverse();
transform_td = transform_tc*transform_cd;

Salahuddin_Khan gravatar imageSalahuddin_Khan ( 2019-05-02 09:21:26 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-05-02 10:36:00 -0600

Salahuddin_Khan gravatar image

I rectified the error by :

 tf::TransformListener listener;
tf::StampedTransform transform_cd;
tf::Transform  transform_tc,transform_td;
try
{
  for(unsigned int i=0; i<tag_detection_array.detections.size(); i++) {
    geometry_msgs::PoseStamped pose;
    pose.pose = tag_detection_array.detections[i].pose.pose.pose;
    pose.header = tag_detection_array.detections[i].pose.header;
    tf::Stamped<tf::Transform> tag_transform, tf_td;
    tf::poseStampedMsgToTF(pose, tag_transform);
    listener.lookupTransform("camera", "drone",  tag_transform.stamp_, transform_cd);
    transform_tc = tag_transform.inverse();
    transform_td = transform_tc*transform_cd;
    tf_td.setData(transform_td);
    tf::Matrix3x3(transform_td.getRotation()).getRPY(uavRollENU, uavPitchENU, uavYawENU);
    if(pose.pose.position.z>0.1 && fabs(uavPitchENU) < 30/57.2958 && fabs(uavRollENU) < 30/57.2958)
    {
      tf_pub_.sendTransform(tf::StampedTransform(tag_transform,
                                              tag_transform.stamp_,
                                              camera_tf_frame_,
                                              detection_names[i]));
      tf::poseStampedTFToMsg(tf_td, pose);
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-05-02 09:12:08 -0600

Seen: 153 times

Last updated: May 02 '19