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

# Building point cloud using input from position, orientation and laser scan data

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]),
pcl::deg2rad(data_set[t][6]));

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.

edit retag close merge delete

## 1 Answer

Sort by ยป oldest newest most voted

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);
xform.setRotation(qt);
tfb.sendTransform(tf::StampedTransform(xform, ros::Time::now(), "base_frame", "target_frame"));


For more information, check the tf tutorials.

more

## Comments

With regard to this laser_geometry package, where does my pose information come into play?
( 2011-12-16 01:53:06 -0500 )edit
tf
( 2011-12-16 01:56:19 -0500 )edit
@dornhege:how do I assign/relate this pose message with the tf?
( 2011-12-16 02:02:42 -0500 )edit
@DimitriProsser: Thanks for the code snippet, but it complaints on "xform.setRotation(pose3D.orientation); " , is that parameter enough?
( 2011-12-16 02:52:29 -0500 )edit
What do you mean by this "You would publish this at a certain interval"? How do we do this?
( 2011-12-16 02:58:16 -0500 )edit
The code snippet already does that. Whoever has this information needs to fill the pose3D struct and call this code.
( 2011-12-16 03:18:42 -0500 )edit
But it complaints in the line "xform.setRotation(pose3D.orientation); " , is that parameter enough?
( 2011-12-16 03:34:27 -0500 )edit
I've tried " xform.setRotation(pose3D.orientation.x, pose3D.orientation.y, pose3D.orientation.z, pose3D.orientation.w);", it doesn't work either.
( 2011-12-16 06:19:45 -0500 )edit

## Stats

Asked: 2011-12-16 00:19:19 -0500

Seen: 1,083 times

Last updated: Dec 17 '11