How to connect RPLiDAR to Pixhawk 4 and raspberry pi

Hi, I want to use my a3m1 RPLiDAR for object avoidance and I also need to connect the RPLiDAR to a raspberry pi 3 B+ to use google cartographer to map the area. Does anyone have any ideas how to do this?

Thanks!

use the linux device driver for it. But you can not connected to both AFAIK