Hello
I want to capture the raw data from lidar by Python 3.6 and the "ouster-os1" library in python. here is the code:
################################################################3
from os1 import OS1
from os1.utils import xyz_points
def handler(raw_packet):
"""Takes each packet and log it to a file as xyz points"""
with open('points.csv', 'a') as f:
x, y, z = xyz_points(raw_packet)
for coords in zip(x, y, z):
f.write("{}\n".format(','.join(coords)))
os1 = OS1('x.x.x.x', 'y.y.y.y', mode='1024x10') # OS1 sensor IP, destination IP, and resolution
os1.start()
os1.run_forever(handler)
#########################################################################
Both IP addresses are true and I have checked them. When I run the code, the error is something like this:
########################################################################3
Exception happened during processing of request from ('10.5.5.62', 59973)
Traceback (most recent call last):
File "C:\Python36\lib\socketserver.py", line 317, in _handle_request_noblock
self.process_request(request, client_address)
File "C:\Python36\lib\socketserver.py", line 348, in process_request
self.finish_request(request, client_address)
File "C:\Python36\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python36\lib\site-packages\os1\server.py", line 12, in init
super(RequestHandler, self).init(*args, **kwargs)
File "C:\Python36\lib\socketserver.py", line 721, in init
self.handle()
File "C:\Python36\lib\site-packages\os1\server.py", line 17, in handle
self.handler(data)
File "c:/Users/aminn/Documents/GUI/OusterLidar.py", line 10, in handler
f.write("{}\n".format(','.join(coords)))
TypeError: sequence item 0: expected str instance, float found
####################################################################################
Could you please help me with this issue? I searched a lot on the websites but, I could not figure out the problem.
Many thanks in advance