Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(doTransform): 10-100x faster transform of pointcloud #432

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from

Commits on Dec 5, 2019

  1. refactor(doTransform): 10-100x faster transform of pointcloud

    It seems like generating an Eigen::Vector3f and transforming it for each iteration is very inefficient. In our case, this mod took transform-time of a point-cloud from 90-100ms to 1-2ms.
    
    Verified to give same result as old doTransform using:
    
    ```
    sensor_msgs::PointCloud2ConstIterator<float> x_old(cloud1, "x");
    sensor_msgs::PointCloud2ConstIterator<float> y_old(cloud1, "y");
    sensor_msgs::PointCloud2ConstIterator<float> z_old(cloud1, "z");
    
    sensor_msgs::PointCloud2ConstIterator<float> x_new(cloud2, "x");
    sensor_msgs::PointCloud2ConstIterator<float> y_new(cloud2, "y");
    sensor_msgs::PointCloud2ConstIterator<float> z_new(cloud2, "z");
    
    std::vector<double> compare_vector;
    for (; x_new != x_new.end(); ++x_new, ++y_new, ++z_new, ++x_old, ++y_old, ++z_old) {
    compare_vector.push_back(*x_new - *x_old);
    compare_vector.push_back(*y_new - *y_old);
    compare_vector.push_back(*z_new - *z_old);
    }
    double max_diff = *max_element(compare_vector.begin(), compare_vector.end());
    double min_diff = *min_element(compare_vector.begin(), compare_vector.end());
    
    ROS_INFO("Biggest differences: %f, %f", max_diff, min_diff);
    ```
    
    Not sure how/where to put this test-code in a proper test, so I'll leave it here until I get some feedback.
    steinmn committed Dec 5, 2019
    Configuration menu
    Copy the full SHA
    63802d0 View commit details
    Browse the repository at this point in the history