Rosanswers logo

I am willing to build a point cloud taking input from position and orientation (pose message) data gathered over time along with laser scan message. In achieving this, of course I need to publish a topic of type PointCloud, but, then, the processing procedures, I'm not really sure.

The stored pose data looks like below:

Here is a loop of the data gathered reading some values row by row..

{btQuaternion q(pcl::deg2rad(data_set[t][8]), pcl::deg2rad(data_set[t][7]),

        pose3D.position.x =  data_set[t][3];
        pose3D.position.y = data_set[t][4];
        pose3D.position.z = data_set[t][5];

        pose3D.orientation.x = q.x();
        pose3D.orientation.y = q.y();
        pose3D.orientation.z = q.z();
        pose3D.orientation.w = q.w();

Could someone provide me any code snippet or example that does the functionality.

Originally posted by alfa_80 on ROS Answers with karma: 1053 on 2011-12-16

Post score: 0


1 Answer 1


Rosanswers logo

ROS provides the laser_geometry package to do just this. Give that a shot. It will make your life much easier.

Edit: Here's some code to publish your odom information. You would publish this at a certain interval in your odometry node, and laser_geometry would be able to read it.

static tf::TransformBroadcaster tfb;
tf::Transform xform;
xform.setOrigin(tf::Vector3(pose3D.position.x, pose3D.position.y, pose3D.position.z));
tf::Quaternion qt(pose3D.orientation.x, pose3D.orientation.y, pose3D.orientation.z, pose3D.orientation.w);
tfb.sendTransform(tf::StampedTransform(xform, ros::Time::now(), "base_frame", "target_frame"));

For more information, check the tf tutorials.

Originally posted by DimitriProsser with karma: 11163 on 2011-12-16

This answer was ACCEPTED on the original site

Post score: 3

Original comments

Comment by alfa_80 on 2011-12-16:
@DimitriProsser: Thanks a lot, that one works..however, when I check for the Point Cloud2, it complaints "Showing [0] points from [0] messages" even, when I check for /laser, there are messages got published..

Comment by DimitriProsser on 2011-12-16:
Try what I've posted above.

Comment by alfa_80 on 2011-12-16:
I've tried " xform.setRotation(pose3D.orientation.x, pose3D.orientation.y, pose3D.orientation.z, pose3D.orientation.w);", it doesn't work either.

Comment by alfa_80 on 2011-12-16:
But it complaints in the line "xform.setRotation(pose3D.orientation); " , is that parameter enough?

Comment by dornhege on 2011-12-16:
The code snippet already does that. Whoever has this information needs to fill the pose3D struct and call this code.

Comment by alfa_80 on 2011-12-16:
What do you mean by this "You would publish this at a certain interval"? How do we do this?

Comment by alfa_80 on 2011-12-16:
@DimitriProsser: Thanks for the code snippet, but it complaints on "xform.setRotation(pose3D.orientation); " , is that parameter enough?

Comment by alfa_80 on 2011-12-16:
@dornhege:how do I assign/relate this pose message with the tf?

Comment by dornhege on 2011-12-16:

Comment by alfa_80 on 2011-12-16:
With regard to this laser_geometry package, where does my pose information come into play?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.