ros-bridge icon indicating copy to clipboard operation
ros-bridge copied to clipboard

[lidar] speedup create_cloud

Open PierrickKoch opened this issue 2 years ago • 1 comments

Up to 4000 times faster, depending on points cloud size. Don't use struct pack_into over each point, copy numpy raw buffer instead.

  • See profiling and test scripts at [1].
  • Inspired from eric-wieser/ros_numpy [2].
  • Besides, fromstring is deprecated [3].

[1] https://gist.github.com/PierrickKoch/01181660d3427990db64056df43257a5#file-lidar_timeit-py [2] https://github.com/eric-wieser/ros_numpy/blob/master/src/ros_numpy/point_cloud2.py [3] https://github.com/numpy/numpy/blob/main/numpy/core/src/multiarray/multiarraymodule.c#L2248


This change is Reviewable

PierrickKoch avatar May 31 '22 10:05 PierrickKoch

Isn't this duplicate of https://github.com/carla-simulator/ros-bridge/pull/557 ? In any case it would be nice to have one of those merged.

ksuszka avatar Jun 08 '22 15:06 ksuszka