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

rosToOpen3d for tensor pointclouds does not handle custom fields correctly #22

Open
willat343 opened this issue May 12, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@willat343
Copy link

There are a few problems with this function in terms of custom fields:

  • the output field type in the open3d structure is float32, regardless of the ros field type
  • custom fields are entered as triplets into the open3d structure, where the triplet contains 3 copies of the same data entry
  • only uint8/int8/float32 ros field types are handled in the iterator

This is a code snippet from the rosToOpen3d function:

        sensor_msgs::PointCloud2ConstIterator<float> ros_pc2_fx(*ros_pc2, ros_pc2->fields[num_fields].name);
        sensor_msgs::PointCloud2ConstIterator<float> ros_pc2_fy(*ros_pc2, ros_pc2->fields[num_fields].name);
        sensor_msgs::PointCloud2ConstIterator<float> ros_pc2_fz(*ros_pc2, ros_pc2->fields[num_fields].name);
        std::vector<Eigen::Vector3d> o3d_TensorList_fields;

        for (size_t i = 0; i < ros_pc2->height * ros_pc2->width; ++i, ++ros_pc2_fx, ++ros_pc2_fy, ++ros_pc2_fz)
        {
          o3d_TensorList_fields.push_back(Eigen::Vector3d(*ros_pc2_fx, *ros_pc2_fy, *ros_pc2_fz));
        }
        open3d::core::Tensor o3d_tpc_fields =
          open3d::core::eigen_converter::EigenVector3dVectorToTensor(o3d_TensorList_fields, dtype_f, device_type);
        o3d_tpc.SetPointAttr(ros_pc2->fields[num_fields].name, o3d_tpc_fields);
@nkhedekar nkhedekar added the bug Something isn't working label May 27, 2022
@nkhedekar
Copy link
Collaborator

Yes, this should be corrected, there is no reason for the fields to be repeated. Please feel free to submit a PR but we will try to fix this asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants