Sensor Fusion - Camera and Lidar

Hello, I would like to know how to possibly combine two seperate codes to work together related to the Raspberry Pi Camera V2 and the Benewake TFMIni Plus Lidar sensor.

I understand that NVIDIA has no experience with the TFMini Plus Lidar, however, I have got the sensor to work and am simply looking for a way to combine the camera and lidar codes to work together.

Camera Code running on SSD-mobilenet-v2:

import jetson.inference
import jetson.utils
net = jetson.inference.detectNet(“ssd-mobilenet-v2”, threshold=0.5)
camera = jetson.utils.videoSource(“csi://0”) # ‘/dev/video0’ for V4L2
display = jetson.utils.videoOutput(“display://0”) # ‘my_video.mp4’ for file
while display.IsStreaming():
img = camera.Capture()
detections = net.Detect(img)
display.Render(img)
display.SetStatus(“Forward Collision Detection {:.0f} FPS”.format(net.GetNetworkFPS()))

TFMIni Plus Lidar code:

import serial
import time
ser = serial.Serial("/dev/ttyUSB0", 115200)
def getTFminiData():
while True:
#time.sleep(0.1)
count = ser.in_waiting
if count > 8:
recv = ser.read(9)
ser.reset_input_buffer()
# type(recv), ‘str’ in python2(recv[0] = ‘Y’), ‘bytes’ in python3(recv[0] = 89)
# type(recv[0]), ‘str’ in python2, ‘int’ in python3
if recv[0] == 0x59 and recv[1] == 0x59:
distance = recv[2] + recv[3] * 256
strength = recv[4] + recv[5] * 256
print(’(’, distance, ‘,’, strength, ‘)’)
ser.reset_input_buffer()

  	#python3
  	if recv[0] == 'Y' and recv[1] == 'Y': #python2
  		lowD = int(recv[2].encode('hex'), 16)
  		highD = int(recv[3].encode('hex'), 16)
  		lowS = int(recv[4].encode('hex'), 16)
  		highS = int(recv[5].encode('hex'), 16)
  		distance = lowD + highD * 256
  		strength = lowS + highS * 256
  		print(distance, strength)

if name == ‘main’:
try:
if ser.is_open == False:
ser.open()
getTFminiData()
except KeyboardInterrupt: # Ctrl+C
if ser != None:
ser.close()

Sorry that we really don’t have know how to do this, may other developers share experiences if they done something similar.