spot_ros
spot_ros copied to clipboard
[WIP]Support publishing Velodyne VLP16 Lidar pointcloud on Spot EAP
This PR is for publishing point cloud from Velodyne VLP16 on Spot EAP . I confirmed this node publishes the topic about 8Hz, but there is a delay. Using pyinstrument,
Program: /home/obinata/ros/spot_driver_ws/src/spot-ros/spot_driver/scripts/spot_ros joint_states:=/joint_states tf:=/tf __name:=spot_ros __log:=/home/obinata/.ros/log/5d1c4c2a-8bb4-11ec-9995-a8a1590e9101/spot-sp
ot_ros-2.log
0.492 PointCloudCB spot_driver/spot_ros.py:247
└─ 0.492 GetPointCloudMsg spot_driver/ros_helpers.py:185
├─ 0.479 ndarray.tolist ../../../../.ros/<built-in>:0
│ [2 frames hidden] ..
└─ 0.013 [self]
I found that it was because using np.tolist for converting nparray to python list(ros array msg). I want to know whether it has better solution or not.
What is the shape of the ndarray that you receive from frombuffer
? Is there any way we can avoid doing the conversion? Reading https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tolist.html indicates that it converts from numpy to python scalars, which may be part of the high cost. Could you just use list
instead?
Use tobytes()
instead
0.011 PointCloudCB spot_driver/spot_ros.py:246
└─ 0.011 GetPointCloudMsg spot_driver/ros_helpers.py:185
├─ 0.009 robotToLocalTime spot_driver/spot_wrapper.py:445
└─ 0.002 ndarray.tobytes ../../../../.ros/<built-in>:0
[2 frames hidden] ..
and improved a lot.
If you're still working on this, can you please mark it as WIP. And then leave a comment when it's ready for review, please.
@mqcmd196 This looks like it's pretty much complete. I've merged in the recent changes to master. Can you check that it still works and I'll merge it to the main branch?
Hi, thank you for your checking. I'll check and report later
@heuristicus I'd like to merge this branch to master to make use of its functionality, is there anything I can do to help?
Do you have an EAP unit you can test this on? That's the only thing that was blocking me merging this.
Yes I do, I'll post here once I've tested it out.
https://user-images.githubusercontent.com/32976023/223709665-3a2b19e5-aa2b-4799-85ab-a04b8ad58856.mov
I've tested this branch on my Spot EAP, PointCloud2 data appears to be publishing fine. I think its good for merge.
Sorry, our spot has not been used for a while because of repairment... Anyway, thank you for merging