Difference between revisions of "User:Aeh84"

From GICL Wiki
Jump to: navigation, search
(Do something new)
(Do something new)
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
 
= Registering pointclouds in ROS with PCL for [[Robot_Lab_(Spring_2012)]] =
 
= Registering pointclouds in ROS with PCL for [[Robot_Lab_(Spring_2012)]] =
Paths followed, lessons learned, code shared.
+
Paths followed, lessons learned, code shared, next steps.
  
 
== Find some data ==
 
== Find some data ==
Line 12: Line 12:
  
 
== Learn about registration ==
 
== Learn about registration ==
The pcl site has a lot of information.  I would recommend reading the introductory material on  
+
The pcl site has a lot of information.  I would recommend reading the introductory material on a number of pcl modules, including registration, keypoint estimation, features, and correspondence.  There are a number of ways to do this and it would be helpful to get a sense of some of them before starting on one.
  
 
== Try my scripts ==
 
== Try my scripts ==
 +
Download a tgz of my scripts: [[File:Registration_code.tar.gz]]
  
=== pose_registration ===
+
=== pose_registration.py ===
* http://www.euclideanspace.com/maths/geometry/space/coordinates/index.htm
+
Uses the pose data from the data set to transform each point cloud into a global frame of reference. Writes PLY files.
  
=== publish from file to ROS bus ===
+
Referenced http://www.euclideanspace.com/maths/geometry/space/coordinates/index.htm
  
=== pointcloud registration ===
+
To run:
$ rosmake register_pointclouds
+
# first set the global variables for file locations
$ roscore
+
$ ./pose_registration.py
$ rosrun register_pointclouds register
+
 
$
+
=== pointclouds_ah/publish_from_file.py ===
 +
Reads a pointcloud from a PLY or .3d file, in which each line gives the coordinates a point.  Publishes each pointcloud as a message to the a ROS topic.
 +
 
 +
To run:
 +
# first set the global variables for file locations
 +
$ rosrun pointclouds_ah public_from_file.py
 +
 
 +
=== register_pointclouds/registration.cpp ===
 +
Reads a pointcloud off the ROS bus (the topic name is set to the same one public_from_file.py writes to).  Runs Iterative Closest Point on each pair of pointclouds.
 +
 
 +
To run:
 +
$ rosmake register_pointclouds
 +
$ rosrun register_pointclouds register
  
 
== View results ==
 
== View results ==
Line 48: Line 61:
 
Things I would do if I were to keep working on this project.
 
Things I would do if I were to keep working on this project.
 
* Working odometry into the registration process appears to be key.  It would be nice to figure out the best way to do it.
 
* Working odometry into the registration process appears to be key.  It would be nice to figure out the best way to do it.
** I don't know whether / how it's possible to send odometry and pointclouds over the ROS bus and correlate them on the other side.  Do they need to be combined into a single message?  Can the callbacks on the two topics be tied together somehow?  It would be easier to start by skipping the ROS bus altogether and just reading in the pointcloud and omdometry data from file.
 
 
** A new version of pcl should be coming out any day now as I finish this quarter.  A new registration algorithm will take odometry data with each pointcloud; it's called Normal Distributions Transform.  That would be worth trying out.
 
** A new version of pcl should be coming out any day now as I finish this quarter.  A new registration algorithm will take odometry data with each pointcloud; it's called Normal Distributions Transform.  That would be worth trying out.
** Further research on Euler angles and rotations in 3d space could be useful.  There may be mathematical errors in the script I wrote to do this.
+
** I don't know whether / how it's possible to send odometry and pointclouds over the ROS bus and correlate them on the other side.  Do they need to be combined into a single message?  Can the callbacks on the two topics be tied together somehow?  It would be easier to start by skipping the ROS bus altogether and just reading in the pointcloud and omdometry data from file.
 +
** Further research on Euler angles and rotations in 3d space would probably be useful.  There may be mathematical errors in the script I wrote to do this.
 
* Cleaning noise from the data could be helpful.  I believe the circular artifacts in my images come from noise in the pointclouds.  Without them, registration could be more accurate.
 
* Cleaning noise from the data could be helpful.  I believe the circular artifacts in my images come from noise in the pointclouds.  Without them, registration could be more accurate.
* Experiment more with max correspondence and epsilon parameters to registration algorithms.
+
* Experiment more with max correspondence and epsilon parameters to registration algorithms.  These are highly dependent on the data set you use, and it seems they need to be discovered via trial-and-error, and then re-discovered if you use a different data set.

Latest revision as of 15:16, 15 June 2012

Contents

Registering pointclouds in ROS with PCL for Robot_Lab_(Spring_2012)

Paths followed, lessons learned, code shared, next steps.

Find some data

The data I used is dataset 14 at http://kos.informatik.uni-osnabrueck.de/3Dscans/

My python script, publish_from_file.py, can be easily adjusted to read any similar format, wherein each line gives the coordinates for a point. PLY is another option; PLY pointclouds can be loaded and viewed in Meshlab.

I didn't write any code to read pcl files, but this is the format that the pointcloud library reads and writes, so if you found some pcl data and like c++ that would also work.

Ideally, it would be best to take your own data, then you know everything about it. It turns out the better you know the data (how far did the robot move between images? what unit does your scanner use for measurements -- meters? pixels?) the better off you will be in fine-tuning the registration algorithms.

Learn about registration

The pcl site has a lot of information. I would recommend reading the introductory material on a number of pcl modules, including registration, keypoint estimation, features, and correspondence. There are a number of ways to do this and it would be helpful to get a sense of some of them before starting on one.

Try my scripts

Download a tgz of my scripts: File:Registration code.tar.gz

pose_registration.py

Uses the pose data from the data set to transform each point cloud into a global frame of reference. Writes PLY files.

Referenced http://www.euclideanspace.com/maths/geometry/space/coordinates/index.htm

To run:

# first set the global variables for file locations
$ ./pose_registration.py

pointclouds_ah/publish_from_file.py

Reads a pointcloud from a PLY or .3d file, in which each line gives the coordinates a point. Publishes each pointcloud as a message to the a ROS topic.

To run:

# first set the global variables for file locations
$ rosrun pointclouds_ah public_from_file.py

register_pointclouds/registration.cpp

Reads a pointcloud off the ROS bus (the topic name is set to the same one public_from_file.py writes to). Runs Iterative Closest Point on each pair of pointclouds.

To run:

$ rosmake register_pointclouds
$ rosrun register_pointclouds register

View results

The results never came out perfectly, but they do nicely show the effects of different types of translation on the data / stages in the process.

Running the original data set through pointcloud registration only:

RegistrationOriginal.png

Pointclouds registered by translating them according to odometry data:

RegistrationOdometry.png

Running the data set through odometry translation and then pointcloud registration:

RegistrationPrecomputed.png

Illustration accompanying the data set I used: RegistrationEt4.jpg

Do something new

Things I would do if I were to keep working on this project.

  • Working odometry into the registration process appears to be key. It would be nice to figure out the best way to do it.
    • A new version of pcl should be coming out any day now as I finish this quarter. A new registration algorithm will take odometry data with each pointcloud; it's called Normal Distributions Transform. That would be worth trying out.
    • I don't know whether / how it's possible to send odometry and pointclouds over the ROS bus and correlate them on the other side. Do they need to be combined into a single message? Can the callbacks on the two topics be tied together somehow? It would be easier to start by skipping the ROS bus altogether and just reading in the pointcloud and omdometry data from file.
    • Further research on Euler angles and rotations in 3d space would probably be useful. There may be mathematical errors in the script I wrote to do this.
  • Cleaning noise from the data could be helpful. I believe the circular artifacts in my images come from noise in the pointclouds. Without them, registration could be more accurate.
  • Experiment more with max correspondence and epsilon parameters to registration algorithms. These are highly dependent on the data set you use, and it seems they need to be discovered via trial-and-error, and then re-discovered if you use a different data set.