The ydlidar G4 seems to be using a 5V UART, so I am guessing using that one is out of the question. Also, it is already used for my GPS, so it’s not an option either way. Now, the ydlidar seems to be including an UART to USB bridge. Has anyone tried using that with the Raspberry Pi? It seems a special driver is required (in the Windows example), making me suspect that I’ll end up in ever lasting pain if I go that route.
Indeed, using the USB adapter board is recommended with SBC, such as the RPi.
As for use under Linux, there is ROS support for this product from the manufacturer (see user manual, page 8).
Here’s an example of someone using a ydlidar product with a RPi 3 B+ that is recent: http://georgeknowlden.com/projects/farm_robot/log.html
I did not review it in details but it seems full of info about various pitfalls and how to get around them successfully!
I hope this helps.
Sincerely,
P.-S.: You can find all the documents on the project page under Useful Links.