ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS DEPRECATED get_transforms_vec

asked 2013-04-21 19:02:39 -0600

Robetraks gravatar image

updated 2013-04-26 19:58:17 -0600

Hi,

I am trying to port scene_label_3D package at http://www.ros.org/wiki/cornell-ros-pkg, developed in a ROS diamondback to groovy. I was able to modify other bt objects in the package according to the bullet migration guide, but I am stuck in -

The problem is, that I want to find the transformation matrix by extracting the rotation and translation matrix from a tf::tfMessageConstPtr type object. This class has been changed and does not contain any get_transforms_vec function anymore. So my real question now is

How can I find a quaternion from the tf::tfMessageConstPtr object which is initialized as tf::tfMessageConstPtr tf_ptr = mtf.instantiate<tf::tfmessage >="" ();="" because="" my="" transformation="" data="" is="" contained="" inside="" a="" bag="" file.="" and="" assign="" it="" to="" a="" tf::transform="" type="" object?="" <="" p="">

The full code snippet is given below:

     tf::Transform final_tft;

    BOOST_FOREACH(rosbag::MessageInstance const mtf, view_tf)
    {
        cout<<"Inside boost foreach"<<endl;
        tf::tfMessageConstPtr tf_ptr = mtf.instantiate<tf::tfMessage > ();
        assert(tf_ptr != NULL);
        std::vector<geometry_msgs::TransformStamped> bt;
        tf_ptr->get_transforms_vec(bt);
        tf::Transform tft(getQuaternion(bt[0].transform.rotation), getVector3(bt[0].transform.translation));

            tf_count++;
            final_tft = tft;
    }

And I receive the error saying that there is no get_transforms_vec function. I am struggling to solve this problem since many days. I would really appreciate any help.

Thanks, Akshay

edit retag flag offensive close merge delete

Comments

Same problem, could you solved it? Thanks

olmin gravatar image olmin  ( 2014-01-29 06:00:39 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-07-15 08:38:28 -0600

Hello Akshay,

I have been working on it. What I found the solution is,

Change the whole section with the bellow section, it will works properly. Note: I am working on ROS groovy.

TransformG readTranform(const string & filename) {

boost::numeric::ublas::matrix<double> mat(4,4);

ifstream file((char*) filename.c_str(), ifstream::in);

string line;

int row = 0;

while(getline(file,line)){

    string e1;

    stringstream lineStream(line);

    int col = 0;

    while(getline(lineStream, e1, ',')){

        mat(row,col) = atof(e1.c_str());

            col +=1;

    }

    row += 1;

}

TransformG transG(mat);

return transG;

}

Have a look and let me know, If you still face any issue. Remember you might need to sort of changes in some other file too.

edit flag offensive delete link more
0

answered 2014-01-29 06:00:08 -0600

olmin gravatar image

Same problem, could you solved it? Thanks

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-04-21 19:02:39 -0600

Seen: 308 times

Last updated: Jul 15 '15