spot_ros icon indicating copy to clipboard operation
spot_ros copied to clipboard

[WIP]Support publishing Velodyne VLP16 Lidar pointcloud on Spot EAP

Open mqcmd196 opened this issue 3 years ago • 5 comments

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.

mqcmd196 avatar Feb 12 '22 09:02 mqcmd196

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?

heuristicus avatar Feb 14 '22 11:02 heuristicus

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.

mqcmd196 avatar Feb 16 '22 07:02 mqcmd196

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.

civerachb-cpr avatar Feb 17 '22 16:02 civerachb-cpr

@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?

heuristicus avatar Oct 18 '22 22:10 heuristicus

Hi, thank you for your checking. I'll check and report later

mqcmd196 avatar Oct 19 '22 02:10 mqcmd196

@heuristicus I'd like to merge this branch to master to make use of its functionality, is there anything I can do to help?

jeremysee2 avatar Mar 06 '23 18:03 jeremysee2

Do you have an EAP unit you can test this on? That's the only thing that was blocking me merging this.

heuristicus avatar Mar 06 '23 18:03 heuristicus

Yes I do, I'll post here once I've tested it out.

jeremysee2 avatar Mar 06 '23 18:03 jeremysee2

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.

jeremysee2 avatar Mar 08 '23 12:03 jeremysee2

Sorry, our spot has not been used for a while because of repairment... Anyway, thank you for merging

mqcmd196 avatar Mar 12 '23 02:03 mqcmd196