ros-bridge
ros-bridge copied to clipboard
[lidar] speedup create_cloud
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
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.