How to get live data from Veloview VLP 16 LiDAR by using python script only

Hi all, i am trying to work with VLP 16 veloview 3D LiDAR and getting familiar with its usage in python. I am able to visualize lidar output using veloview, but i want to record lidar output as live and pass to my AI model. Instead of saving pcap, can i directly pass pcap file to my code like (rtsp, udp). Kindly help me in getting that code.

from paraview.simple import *
#import sys
#print(sys.path)
#from paraview.catalyst import Options
#import paraview.catalyst
import paraview.catalyst.get_args, get_execute_params
#import catalyst.get_execute_params
#import paraview.catalyst as catalyst

from paraview.catalyst import get_args, get_execute_params

# print values for parameters passed via adaptor (note these don't change,
# and hence must be created as command line params)
print("executing catalyst_pipeline")
print("===================================")
print("pipeline args={}".format(get_args()))
print("===================================")

# registrationName must match the channel name used in the
# 'CatalystAdaptor'.
producer = TrivialProducer(registrationName="${args.channel-name}")


# this is only for testing purposes. never directly import `catalyst.detail`
from paraview.catalyst.detail import IsInsituInput, _transform_registration_name
assert(IsInsituInput("${args.channel-name}"))
assert(_transform_registration_name("${args.channel-name}")=="grid")

def catalyst_execute(info):
    global producer

    producer.UpdatePipeline()

    # get time parameter as example of a parameter changing during the simulation
    params = get_execute_params()
    timeParam = float(params[3].split("=")[1])

    # show that the time parameter matches the time tracked by catalyst
    assert (timeParam - info.time) < 1e-12

    print("executing (cycle={}, time={})".format(info.cycle, info.time))
    print("-----")
    print("pipeline parameters:")
    print("\n".join(params))
    print("-----")
    print("bounds:", producer.GetDataInformation().GetBounds())
    print("velocity-magnitude-range:", producer.PointData["velocity"].GetRange(-1))
    print("pressure-range:", producer.CellData["pressure"].GetRange(0))
    print("===================================")

I tried above code but no luck. I am running this on windows 11. Kindly help me in getting live output without saving pcap file in local.

Thanks

Hi @NIrbhay_Mathur,

Veloview is not maintained anymore, and python scripting is less mature. You could try out LidarView which is regularly updated and also support Velodyne VLP-16 (and more LiDAR constructors), LidarView 4.5.0 is available here.

If I understood correctly you want to use python scripting to display your LiDAR and also use it’s output in your custom code. What you can do is write a VTK filter (in python or c++) load it as a plugin in lidarview and connect it to your pipeline in python.

from paraview.simple import smp
from lidarview.simple import lv

stream = lv.OpenSensorStream("VLP-16.xml", "Velodyne Meta Interpreter")
smp.Show(stream)
stream.Start()

customFilter = smp.CustomFilter(Input=stream)

Note that you can forward the upd stream with stream.ForwardedIpAddress and stream.ForwardedPort properties.

If you need to change your python environment you could checkout this guide mentionned in this blog.

If you only want to manipulate the UDP stream yourself, you don’t need LidarView nor Veloview. You should be able to read the stream directly by listening to the right host and port.

Hope this helps

Hi @Timothee_Couble Thanks for your reply. I tried to follow your instruction. I am getting error in import

from paraview.simple import smp
ImportError: cannot import name 'smp' from 'paraview.simple' (C:\Users\Dr Nirbhay\.conda\envs\lidar\Lib\site-packages\paraview\simple.py). Did you mean: 'sm'?

also i dint found any package placeholder for installing
from lidarview.simple import lv
it will be great if you can provide any help.

Thanks

Hi @NIrbhay_Mathur,

I’m sorry, I have made an error in the snippet, it should be instead:

import paraview.simple as smp
import lidarview.simple as lv

Thanks @Timothee_Couble
import paraview.simple as smp this is resolved.
but still i am not able to install lidarview python package.
Below is the error ModuleNotFoundError: No module named 'lidarview'.
I tried to find solution on internet and got this link “LidarView/RELEASES.md at master · Kitware/LidarView · GitHub” .
Here i am getting .exe file to install no whl file to install python package.

It will be great if you can help in installing lidarview python package.
Thanks

Above import is done.
New error:

Traceback (most recent call last):
  File "C:\Users\Dr Nirbhay\Desktop\LiDAR\LiveParaview.py", line 4, in <module>
    stream = lv.OpenSensorStream("VLP-16.xml", "Velodyne Meta Interpreter")
  File "C:\Users\Dr Nirbhay\.conda\envs\lidar39\lib\site-packages\lidarviewcore\simple.py", line 151, in OpenSensorStream
    stream = smp.LidarStream(CalibrationFile=calibrationFile, Interpreter=interpreter)
AttributeError: module 'paraview.simple' has no attribute 'LidarStream'

this error come from :
stream = lv.OpenSensorStream("VLP-16.xml", "Velodyne Meta Interpreter")
Just to know how we can get Velodyne Meta Interpreter, where is this file comes from!! or this key word. ?
Thanks