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

**URL:** https://discourse.paraview.org/t/how-to-get-live-data-from-veloview-vlp-16-lidar-by-using-python-script-only/13725
**Category:** LidarView, Lidar, and SLAM
**Tags:** python
**Created:** [January 17, 2024, 8:45am UTC](https://discourse.paraview.org/t/how-to-get-live-data-from-veloview-vlp-16-lidar-by-using-python-script-only/13725 "2024-01-17T08:45:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![NIrbhay\_Mathur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nirbhay_mathur/32/13417_2.png) [@NIrbhay\_Mathur](https://discourse.paraview.org/u/NIrbhay_Mathur)
#### Post date: [January 17, 2024, 8:45am UTC](https://discourse.paraview.org/t/how-to-get-live-data-from-veloview-vlp-16-lidar-by-using-python-script-only/13725/1 "2024-01-17T08:45:11Z")

</div>

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.

```auto
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

---

<div class="post-metadata">

### Author: ![Timothee\_Couble](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timothee_couble/32/9790_2.png) [@Timothee\_Couble](https://discourse.paraview.org/u/Timothee_Couble)
#### Post date: [January 19, 2024, 9:15am UTC](https://discourse.paraview.org/t/how-to-get-live-data-from-veloview-vlp-16-lidar-by-using-python-script-only/13725/2 "2024-01-19T09:15:43Z")

</div>

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](https://gitlab.kitware.com/LidarView/lidarview/-/releases).

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](https://gitlab.kitware.com/paraview/paraview/-/blob/master/Examples/Plugins/PythonAlgorithm/PythonAlgorithmExamples.py?ref_type=heads) or [c++](https://gitlab.kitware.com/paraview/paraview/tree/master/Examples/Plugins/ElevationFilter)) load it as a plugin in lidarview and connect it to your pipeline in python.

```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](https://gitlab.kitware.com/LidarView/plugins/lidarviewdeeplearningplugins/-/blob/main/mmdetection3d/INSTALL.md) mentionned in this [blog](https://www.kitware.com/3d-point-cloud-object-detection-in-lidarview/).

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

---

<div class="post-metadata">

### Author: ![NIrbhay\_Mathur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nirbhay_mathur/32/13417_2.png) [@NIrbhay\_Mathur](https://discourse.paraview.org/u/NIrbhay_Mathur)
#### Post date: [January 23, 2024, 9:34am UTC](https://discourse.paraview.org/t/how-to-get-live-data-from-veloview-vlp-16-lidar-by-using-python-script-only/13725/3 "2024-01-23T09:34:25Z")

</div>

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

```auto
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

---

<div class="post-metadata">

### Author: ![Timothee\_Couble](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timothee_couble/32/9790_2.png) [@Timothee\_Couble](https://discourse.paraview.org/u/Timothee_Couble)
#### Post date: [January 23, 2024, 12:59pm UTC](https://discourse.paraview.org/t/how-to-get-live-data-from-veloview-vlp-16-lidar-by-using-python-script-only/13725/4 "2024-01-23T12:59:02Z")

</div>

Hi @NIrbhay_Mathur,

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

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

```

---

<div class="post-metadata">

### Author: ![NIrbhay\_Mathur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nirbhay_mathur/32/13417_2.png) [@NIrbhay\_Mathur](https://discourse.paraview.org/u/NIrbhay_Mathur)
#### Post date: [January 25, 2024, 4:32am UTC](https://discourse.paraview.org/t/how-to-get-live-data-from-veloview-vlp-16-lidar-by-using-python-script-only/13725/5 "2024-01-25T04:32:28Z")

</div>

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](https://github.com/Kitware/LidarView/blob/master/RELEASES.md)” .  
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

---

<div class="post-metadata">

### Author: ![NIrbhay\_Mathur](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nirbhay_mathur/32/13417_2.png) [@NIrbhay\_Mathur](https://discourse.paraview.org/u/NIrbhay_Mathur)
#### Post date: [January 25, 2024, 6:51am UTC](https://discourse.paraview.org/t/how-to-get-live-data-from-veloview-vlp-16-lidar-by-using-python-script-only/13725/6 "2024-01-25T06:51:02Z")

</div>

Above import is done.  
New error:

```auto
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
