diff --git a/ATV Lidar Documentation.docx b/ATV Lidar Documentation.docx new file mode 100644 index 0000000..8ad7884 Binary files /dev/null and b/ATV Lidar Documentation.docx differ diff --git a/ATV Lidar Setup and Documentation.md b/ATV Lidar Setup and Documentation.md new file mode 100644 index 0000000..2b4cd59 --- /dev/null +++ b/ATV Lidar Setup and Documentation.md @@ -0,0 +1,50 @@ +1.Henry Haight + +_University of Washington Bothell_ + + + +**_Abstract—The purpose of this document is to describe how to operate the YDLidar for the Autonomous ATV. This includes setup instructions and written explanations for the functions used by the lidar to detect objects._** + +Keywords—template, UWB Electronics Club, format + +# Features + +- Setup +- Functions +- Quirks of the YDLidar +## Setup + +Download the SDK driver for \[YDLIDAR\]() + +Check the Linux machine has: + +- swig +- python +- openpyxl +- pandas +- cmake +- matplotlib +- Follow the \[instructions for installation on the YDLIDAR Github page\]() +- Open 'YDLidar-SDK/python/examples/plot\\\_tof\\\_test.py' and change line 26 to this: 'laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 128000\\)' +- Run Test '$ cd YDLidar-SDK/python/examples/ $ python plot\\\_tof\\\_test.py' + +## Functions + +animate(num) + +This function is the main function of the LIDAR code. This creates 3 arrays and uses them to append the 3 major components of the LIDAR signal: angle, range, and intensity. These arrays are added to using the YDLidar scan function, which then adds them to each array every pass of the LIDAR. This is then graphed at the end of the function after passing through the other 2 functions, which determine which signals are objects. + +The intensity is always set at 10, so it is useless for our application. This seems to be a quirk of the YDLidar API. The angle is measured in radians. Range seems to be measured in feet. + +find_close_sequences(angle, threshold=, ran) + +This finds where the sequences are close and returns arrays where there are points that are close, so we can fit a line between 3 points of those arrays in graph_points + +graph_points(sequences) + +Finds the midpoints, start, and end of the 2D array, which is then returned as one array so it can be graphed + +## Quirks of the Lidar + +To use your own code place the file you want to modify or make in YDLidar-SDK/python/examples/. This allows the lidar to find the library it needs to start and call the lidar. diff --git a/YDLIDAR_ATV.py b/YDLIDAR_ATV.py new file mode 100644 index 0000000..8ee1ec9 --- /dev/null +++ b/YDLIDAR_ATV.py @@ -0,0 +1,81 @@ +import os +import ydlidar +import time +import sys +from matplotlib.patches import Arc +import matplotlib.pyplot as plt +import matplotlib.animation as animation +import numpy as np +import pandas as pd + +RMAX = 32.0 + + +fig = plt.figure() +fig.canvas.set_window_title('YDLidar LIDAR Monitor') +lidar_polar = plt.subplot(polar=True) +lidar_polar.autoscale_view(True,True,True) +lidar_polar.set_rmax(RMAX) +lidar_polar.grid(True) +ports = ydlidar.lidarPortList(); +port = "/dev/ydlidar"; +for key, value in ports.items(): + port = value; + +laser = ydlidar.CYdLidar(); +laser.setlidaropt(ydlidar.LidarPropSerialPort, port); +laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 128000) +laser.setlidaropt(ydlidar.LidarPropLidarType, ydlidar.TYPE_TOF); +laser.setlidaropt(ydlidar.LidarPropDeviceType, ydlidar.YDLIDAR_TYPE_SERIAL); +laser.setlidaropt(ydlidar.LidarPropScanFrequency, 10.0); +laser.setlidaropt(ydlidar.LidarPropSampleRate, 20); +laser.setlidaropt(ydlidar.LidarPropSingleChannel, False); +laser.setlidaropt(ydlidar.LidarPropMaxAngle, 180.0); +laser.setlidaropt(ydlidar.LidarPropMinAngle, -180.0); +laser.setlidaropt(ydlidar.LidarPropMaxRange, 32.0); +laser.setlidaropt(ydlidar.LidarPropMinRange, 0.01); +scan = ydlidar.LaserScan() + +dfa = pd.DataFrame() +dfr = pd.DataFrame() +dfi = pd.DataFrame() + + +def animate(num): + + r = laser.doProcessSimple(scan); + if r: + angle = [] + ran = [] + intensity = [] + + for point in scan.points: + angle.append(point.angle); + ran.append(point.range); + intensity.append(point.intensity); + + + lidar_polar.clear() + lidar_polar.scatter(angle, ran, c=intensity, cmap='hsv', alpha=0.95) + + + dfa = pd.DataFrame({'Angle': angle, 'Ran': ran, 'Intensity': intensity}) + dfa.to_excel('angle.xlsx', index=False) + #dfr = pd.DataFrame(ran) + #dfr.to_excel('ran.xlsx', index=False) + #dfi = pd.DataFrame(angle) + #dfi.to_excel('intensity.xlsx', index=False) + +ret = laser.initialize(); +if ret: + ret = laser.turnOn(); + if ret: + ani = animation.FuncAnimation(fig, animate, interval=50) + plt.show() + laser.turnOff(); + + + +laser.disconnecting(); +plt.close(); + diff --git a/YDLIDAR_ATV_obstacle.py b/YDLIDAR_ATV_obstacle.py new file mode 100644 index 0000000..18f346f --- /dev/null +++ b/YDLIDAR_ATV_obstacle.py @@ -0,0 +1,108 @@ +import os +import ydlidar +import time +import sys +from matplotlib.patches import Arc +import matplotlib.pyplot as plt +import matplotlib.animation as animation +import numpy as np +import pandas as pd + + +RMAX = 32.0 + + +fig = plt.figure() +fig.canvas.set_window_title('YDLidar LIDAR Monitor') +lidar_polar = plt.subplot(polar=True) +lidar_polar.autoscale_view(True,True,True) +lidar_polar.set_rmax(RMAX) +lidar_polar.grid(True) +ports = ydlidar.lidarPortList(); +port = "/dev/ydlidar"; +for key, value in ports.items(): + port = value; + +laser = ydlidar.CYdLidar(); +laser.setlidaropt(ydlidar.LidarPropSerialPort, port); +laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 128000) +laser.setlidaropt(ydlidar.LidarPropLidarType, ydlidar.TYPE_TOF); +laser.setlidaropt(ydlidar.LidarPropDeviceType, ydlidar.YDLIDAR_TYPE_SERIAL); +laser.setlidaropt(ydlidar.LidarPropScanFrequency, 10.0); +laser.setlidaropt(ydlidar.LidarPropSampleRate, 20); +laser.setlidaropt(ydlidar.LidarPropSingleChannel, False); +laser.setlidaropt(ydlidar.LidarPropMaxAngle, 180.0); +laser.setlidaropt(ydlidar.LidarPropMinAngle, -180.0); +laser.setlidaropt(ydlidar.LidarPropMaxRange, 32.0); +laser.setlidaropt(ydlidar.LidarPropMinRange, 0.01); +scan = ydlidar.LaserScan() + +def find_close_sequences(angle, ran, threshold=0.015): + i = 0 + angle_sequences = [] + ran_sequences = [] + + while i < len(angle) - 1: + start = i + while i < len(angle) - 1 and abs(angle[i] - angle[i + 1]) <= threshold: + i += 1 + if i > start: + angle_sequences.append(angle[start:i + 1]) + ran_sequences.append(ran[start:i + 1]) + i += 1 + + return angle_sequences, ran_sequences + +def graph_points(sequences): + points = [] + + for i, seq in enumerate(sequences): + start = sequences[i][0] + end = start + len(seq) - 1 + mid = (start + end) // 2.0 + points.append([start, mid, end]) + + return points + + + +def animate(num): + + r = laser.doProcessSimple(scan); + if r: + angle = [] + ran = [] + intensity = [] + + for point in scan.points: + if point.range < 2.0: + angle.append(point.angle); + ran.append(point.range); + intensity.append(point.intensity); + angle_objects, ran_objects = find_close_sequences(angle, ran, threshold=0.015) + + angle_gp = graph_points(angle_objects) + ran_gp = graph_points(ran_objects) + + + lidar_polar.clear() + #lidar_polar.scatter(angle, ran, c=intensity, cmap='hsv', alpha=0.95) + plt.plot(angle, ran) + + dfa = pd.DataFrame({'Angle': angle_gp, 'Range': ran_gp}) + dfa.to_excel('data.xlsx', index=False) + + + +ret = laser.initialize(); +if ret: + ret = laser.turnOn(); + if ret: + ani = animation.FuncAnimation(fig, animate, interval=50) + plt.show() + laser.turnOff(); + +laser.disconnecting(); +plt.close(); + + diff --git a/YDLIDAR_ATV_obstacle.py-LK_Version.py b/YDLIDAR_ATV_obstacle.py-LK_Version.py new file mode 100644 index 0000000..3965526 --- /dev/null +++ b/YDLIDAR_ATV_obstacle.py-LK_Version.py @@ -0,0 +1,121 @@ +import os +import ydlidar +import time +import sys +from matplotlib.patches import Arc +import matplotlib.pyplot as plt +import matplotlib.animation as animation +import numpy as np +import pandas as pd + + +RMAX = 32.0 + + +fig = plt.figure() +fig.canvas.set_window_title('YDLidar LIDAR Monitor') +lidar_polar = plt.subplot(polar=True) +lidar_polar.autoscale_view(True,True,True) +lidar_polar.set_rmax(RMAX) +lidar_polar.grid(True) +ports = ydlidar.lidarPortList(); +port = "/dev/ydlidar"; +for key, value in ports.items(): + port = value; + +laser = ydlidar.CYdLidar(); +laser.setlidaropt(ydlidar.LidarPropSerialPort, port); +laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 128000) +laser.setlidaropt(ydlidar.LidarPropLidarType, ydlidar.TYPE_TOF); +laser.setlidaropt(ydlidar.LidarPropDeviceType, ydlidar.YDLIDAR_TYPE_SERIAL); +laser.setlidaropt(ydlidar.LidarPropScanFrequency, 10.0); +laser.setlidaropt(ydlidar.LidarPropSampleRate, 20); +laser.setlidaropt(ydlidar.LidarPropSingleChannel, False); +laser.setlidaropt(ydlidar.LidarPropMaxAngle, 180.0); +laser.setlidaropt(ydlidar.LidarPropMinAngle, -180.0); +laser.setlidaropt(ydlidar.LidarPropMaxRange, 32.0); +laser.setlidaropt(ydlidar.LidarPropMinRange, 0.01); +scan = ydlidar.LaserScan() + +def find_close_sequences(angle, ran, threshold=0.015): + i = 0 + angle_sequences = [] + ran_sequences = [] + + while i < len(angle) - 1: + start = i + while i < len(angle) - 1 and abs(angle[i] - angle[i + 1]) <= threshold: + i += 1 + if i > start: + angle_sequences.append(angle[start:i + 1]) + ran_sequences.append(ran[start:i + 1]) + i += 1 + + return angle_sequences, ran_sequences + +def graph_points(sequences): + points = [] + + for i, seq in enumerate(sequences): + start = 0 + end = start + len(seq) - 1 + mid = (start + end) // 2 + points.append([start, mid, end]) + + return points + + + +def animate(num): + + r = laser.doProcessSimple(scan); + if r: + angle = [] + ran = [] + intensity = [] + obs = [] + obs2 = [] + + for point in scan.points: + if point.range < 5: + angle.append(point.angle) + ran.append(point.range) + intensity.append(point.intensity) + + + angle_objects, ran_objects = find_close_sequences(angle, ran, threshold=0.015) + + angle_gp = graph_points(angle_objects) + ran_gp = graph_points(ran_objects) + + + lidar_polar.clear() + lidar_polar.scatter(angle, ran, c=intensity, cmap='hsv', alpha=0.95) + + if point.range < .01: + print("Number of objects detected: ", len(angle_objects)); + print("Object detected, shutting down the program..."); + + for i in range(len(angle_objects)): + lidar_polar.plot(angle_objects[i], ran_objects[i], marker='o', markersize=3, linestyle='-', linewidth=1, alpha=0.5) + lidar_polar.plot([angle_gp[i][0], angle_gp[i][1], angle_gp[i][2]], [ran_gp[i][0], ran_gp[i][1], ran_gp[i][2]], marker='o', markersize=3, linestyle='-', linewidth=1, alpha=0.5) + sys.exit(); + + + dfa = pd.DataFrame({'Angle': angle_objects, 'Range': ran_objects}) + dfa.to_excel('data.xlsx', index=False) + + + +ret = laser.initialize(); +if ret: + ret = laser.turnOn(); + if ret: + ani = animation.FuncAnimation(fig, animate, interval=50) + plt.show() + laser.turnOff(); + +laser.disconnecting(); +plt.close(); + + diff --git a/_ydlidar.so b/_ydlidar.so new file mode 100644 index 0000000..963fb10 Binary files /dev/null and b/_ydlidar.so differ diff --git a/angle.xlsx b/angle.xlsx new file mode 100644 index 0000000..6e7c1b5 Binary files /dev/null and b/angle.xlsx differ diff --git a/data.xlsx b/data.xlsx new file mode 100644 index 0000000..f5195f1 Binary files /dev/null and b/data.xlsx differ diff --git a/lidar data.png b/lidar data.png new file mode 100644 index 0000000..586f74c Binary files /dev/null and b/lidar data.png differ diff --git a/ydlidar.py b/ydlidar.py new file mode 100644 index 0000000..8bec130 --- /dev/null +++ b/ydlidar.py @@ -0,0 +1,619 @@ +# This file was automatically generated by SWIG (https://www.swig.org). +# Version 4.3.0 +# +# Do not make changes to this file unless you know what you are doing - modify +# the SWIG interface file instead. + +from sys import version_info as _swig_python_version_info +# Import the low-level C/C++ module +if __package__ or "." in __name__: + from . import _ydlidar +else: + import _ydlidar + +try: + import builtins as __builtin__ +except ImportError: + import __builtin__ + +def _swig_repr(self): + try: + strthis = "proxy of " + self.this.__repr__() + except __builtin__.Exception: + strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + + +def _swig_setattr_nondynamic_instance_variable(set): + def set_instance_attr(self, name, value): + if name == "this": + set(self, name, value) + elif name == "thisown": + self.this.own(value) + elif hasattr(self, name) and isinstance(getattr(type(self), name), property): + set(self, name, value) + else: + raise AttributeError("You cannot add instance attributes to %s" % self) + return set_instance_attr + + +def _swig_setattr_nondynamic_class_variable(set): + def set_class_attr(cls, name, value): + if hasattr(cls, name) and not isinstance(getattr(cls, name), property): + set(cls, name, value) + else: + raise AttributeError("You cannot add class attributes to %s" % cls) + return set_class_attr + + +def _swig_add_metaclass(metaclass): + """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" + def wrapper(cls): + return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) + return wrapper + + +class _SwigNonDynamicMeta(type): + """Meta class to enforce nondynamic attributes (no new attributes) for a class""" + __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) + + +class SwigPyIterator(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + __swig_destroy__ = _ydlidar.delete_SwigPyIterator + + def value(self): + return _ydlidar.SwigPyIterator_value(self) + + def incr(self, n=1): + return _ydlidar.SwigPyIterator_incr(self, n) + + def decr(self, n=1): + return _ydlidar.SwigPyIterator_decr(self, n) + + def distance(self, x): + return _ydlidar.SwigPyIterator_distance(self, x) + + def equal(self, x): + return _ydlidar.SwigPyIterator_equal(self, x) + + def copy(self): + return _ydlidar.SwigPyIterator_copy(self) + + def next(self): + return _ydlidar.SwigPyIterator_next(self) + + def __next__(self): + return _ydlidar.SwigPyIterator___next__(self) + + def previous(self): + return _ydlidar.SwigPyIterator_previous(self) + + def advance(self, n): + return _ydlidar.SwigPyIterator_advance(self, n) + + def __eq__(self, x): + return _ydlidar.SwigPyIterator___eq__(self, x) + + def __ne__(self, x): + return _ydlidar.SwigPyIterator___ne__(self, x) + + def __iadd__(self, n): + return _ydlidar.SwigPyIterator___iadd__(self, n) + + def __isub__(self, n): + return _ydlidar.SwigPyIterator___isub__(self, n) + + def __add__(self, n): + return _ydlidar.SwigPyIterator___add__(self, n) + + def __sub__(self, *args): + return _ydlidar.SwigPyIterator___sub__(self, *args) + def __iter__(self): + return self + +# Register SwigPyIterator in _ydlidar: +_ydlidar.SwigPyIterator_swigregister(SwigPyIterator) +class PointVector(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _ydlidar.PointVector_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _ydlidar.PointVector___nonzero__(self) + + def __bool__(self): + return _ydlidar.PointVector___bool__(self) + + def __len__(self): + return _ydlidar.PointVector___len__(self) + + def __getslice__(self, i, j): + return _ydlidar.PointVector___getslice__(self, i, j) + + def __setslice__(self, *args): + return _ydlidar.PointVector___setslice__(self, *args) + + def __delslice__(self, i, j): + return _ydlidar.PointVector___delslice__(self, i, j) + + def __delitem__(self, *args): + return _ydlidar.PointVector___delitem__(self, *args) + + def __getitem__(self, *args): + return _ydlidar.PointVector___getitem__(self, *args) + + def __setitem__(self, *args): + return _ydlidar.PointVector___setitem__(self, *args) + + def pop(self): + return _ydlidar.PointVector_pop(self) + + def append(self, x): + return _ydlidar.PointVector_append(self, x) + + def empty(self): + return _ydlidar.PointVector_empty(self) + + def size(self): + return _ydlidar.PointVector_size(self) + + def swap(self, v): + return _ydlidar.PointVector_swap(self, v) + + def begin(self): + return _ydlidar.PointVector_begin(self) + + def end(self): + return _ydlidar.PointVector_end(self) + + def rbegin(self): + return _ydlidar.PointVector_rbegin(self) + + def rend(self): + return _ydlidar.PointVector_rend(self) + + def clear(self): + return _ydlidar.PointVector_clear(self) + + def get_allocator(self): + return _ydlidar.PointVector_get_allocator(self) + + def pop_back(self): + return _ydlidar.PointVector_pop_back(self) + + def erase(self, *args): + return _ydlidar.PointVector_erase(self, *args) + + def __init__(self, *args): + _ydlidar.PointVector_swiginit(self, _ydlidar.new_PointVector(*args)) + + def push_back(self, x): + return _ydlidar.PointVector_push_back(self, x) + + def front(self): + return _ydlidar.PointVector_front(self) + + def back(self): + return _ydlidar.PointVector_back(self) + + def assign(self, n, x): + return _ydlidar.PointVector_assign(self, n, x) + + def resize(self, *args): + return _ydlidar.PointVector_resize(self, *args) + + def insert(self, *args): + return _ydlidar.PointVector_insert(self, *args) + + def reserve(self, n): + return _ydlidar.PointVector_reserve(self, n) + + def capacity(self): + return _ydlidar.PointVector_capacity(self) + __swig_destroy__ = _ydlidar.delete_PointVector + +# Register PointVector in _ydlidar: +_ydlidar.PointVector_swigregister(PointVector) +class Str2strMap(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def iterator(self): + return _ydlidar.Str2strMap_iterator(self) + def __iter__(self): + return self.iterator() + + def __nonzero__(self): + return _ydlidar.Str2strMap___nonzero__(self) + + def __bool__(self): + return _ydlidar.Str2strMap___bool__(self) + + def __len__(self): + return _ydlidar.Str2strMap___len__(self) + def __iter__(self): + return self.key_iterator() + def iterkeys(self): + return self.key_iterator() + def itervalues(self): + return self.value_iterator() + def iteritems(self): + return self.iterator() + + def __getitem__(self, key): + return _ydlidar.Str2strMap___getitem__(self, key) + + def __delitem__(self, key): + return _ydlidar.Str2strMap___delitem__(self, key) + + def has_key(self, key): + return _ydlidar.Str2strMap_has_key(self, key) + + def keys(self): + return _ydlidar.Str2strMap_keys(self) + + def values(self): + return _ydlidar.Str2strMap_values(self) + + def items(self): + return _ydlidar.Str2strMap_items(self) + + def __contains__(self, key): + return _ydlidar.Str2strMap___contains__(self, key) + + def key_iterator(self): + return _ydlidar.Str2strMap_key_iterator(self) + + def value_iterator(self): + return _ydlidar.Str2strMap_value_iterator(self) + + def __setitem__(self, *args): + return _ydlidar.Str2strMap___setitem__(self, *args) + + def asdict(self): + return _ydlidar.Str2strMap_asdict(self) + + def __init__(self, *args): + _ydlidar.Str2strMap_swiginit(self, _ydlidar.new_Str2strMap(*args)) + + def empty(self): + return _ydlidar.Str2strMap_empty(self) + + def size(self): + return _ydlidar.Str2strMap_size(self) + + def swap(self, v): + return _ydlidar.Str2strMap_swap(self, v) + + def begin(self): + return _ydlidar.Str2strMap_begin(self) + + def end(self): + return _ydlidar.Str2strMap_end(self) + + def rbegin(self): + return _ydlidar.Str2strMap_rbegin(self) + + def rend(self): + return _ydlidar.Str2strMap_rend(self) + + def clear(self): + return _ydlidar.Str2strMap_clear(self) + + def get_allocator(self): + return _ydlidar.Str2strMap_get_allocator(self) + + def count(self, x): + return _ydlidar.Str2strMap_count(self, x) + + def erase(self, *args): + return _ydlidar.Str2strMap_erase(self, *args) + + def find(self, x): + return _ydlidar.Str2strMap_find(self, x) + + def lower_bound(self, x): + return _ydlidar.Str2strMap_lower_bound(self, x) + + def upper_bound(self, x): + return _ydlidar.Str2strMap_upper_bound(self, x) + __swig_destroy__ = _ydlidar.delete_Str2strMap + +# Register Str2strMap in _ydlidar: +_ydlidar.Str2strMap_swigregister(Str2strMap) +class CYdLidar(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + + def __init__(self): + _ydlidar.CYdLidar_swiginit(self, _ydlidar.new_CYdLidar()) + __swig_destroy__ = _ydlidar.delete_CYdLidar + + def initialize(self): + return _ydlidar.CYdLidar_initialize(self) + + def GetLidarVersion(self, version): + return _ydlidar.CYdLidar_GetLidarVersion(self, version) + + def turnOn(self): + return _ydlidar.CYdLidar_turnOn(self) + + def isScanning(self): + return _ydlidar.CYdLidar_isScanning(self) + + def doProcessSimple(self, outscan): + return _ydlidar.CYdLidar_doProcessSimple(self, outscan) + + def turnOff(self): + return _ydlidar.CYdLidar_turnOff(self) + + def disconnecting(self): + return _ydlidar.CYdLidar_disconnecting(self) + + def DescribeError(self): + return _ydlidar.CYdLidar_DescribeError(self) + + def getDriverError(self): + return _ydlidar.CYdLidar_getDriverError(self) + + def setWorkMode(self, mode, addr=0): + return _ydlidar.CYdLidar_setWorkMode(self, mode, addr) + + def enableSunNoise(self, e=True): + return _ydlidar.CYdLidar_enableSunNoise(self, e) + + def enableGlassNoise(self, e=True): + return _ydlidar.CYdLidar_enableGlassNoise(self, e) + + def getUserVersion(self, version): + return _ydlidar.CYdLidar_getUserVersion(self, version) + + def setBottomPriority(self, yes=True): + return _ydlidar.CYdLidar_setBottomPriority(self, yes) + + def getDeviceInfo(self, *args): + return _ydlidar.CYdLidar_getDeviceInfo(self, *args) + + def setAutoIntensity(self, yes=False): + return _ydlidar.CYdLidar_setAutoIntensity(self, yes) + + def getPitchAngle(self, pitch): + return _ydlidar.CYdLidar_getPitchAngle(self, pitch) + + def setEnableDebug(self, yes): + return _ydlidar.CYdLidar_setEnableDebug(self, yes) + + def setOtaFile(self, name): + return _ydlidar.CYdLidar_setOtaFile(self, name) + + def setOtaEncode(self, e): + return _ydlidar.CYdLidar_setOtaEncode(self, e) + + def ota(self): + return _ydlidar.CYdLidar_ota(self) + + def setlidaropt(self, *args): + return _ydlidar.CYdLidar_setlidaropt(self, *args) + + def getlidaropt_toInt(self, optname): + return _ydlidar.CYdLidar_getlidaropt_toInt(self, optname) + + def getlidaropt_toBool(self, optname): + return _ydlidar.CYdLidar_getlidaropt_toBool(self, optname) + + def getlidaropt_toFloat(self, optname): + return _ydlidar.CYdLidar_getlidaropt_toFloat(self, optname) + + def getlidaropt_toString(self, optname): + return _ydlidar.CYdLidar_getlidaropt_toString(self, optname) + +# Register CYdLidar in _ydlidar: +_ydlidar.CYdLidar_swigregister(CYdLidar) + +def os_init(): + return _ydlidar.os_init() + +def os_isOk(): + return _ydlidar.os_isOk() + +def os_shutdown(): + return _ydlidar.os_shutdown() + +def lidarPortList(): + return _ydlidar.lidarPortList() + +def printLogo(): + return _ydlidar.printLogo() +MAX_DEBUG_INDEX = _ydlidar.MAX_DEBUG_INDEX +class LaserDebug(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + cVer = property(_ydlidar.LaserDebug_cVer_get, _ydlidar.LaserDebug_cVer_set) + debug2 = property(_ydlidar.LaserDebug_debug2_get, _ydlidar.LaserDebug_debug2_set) + hfVer = property(_ydlidar.LaserDebug_hfVer_get, _ydlidar.LaserDebug_hfVer_set) + fVer = property(_ydlidar.LaserDebug_fVer_get, _ydlidar.LaserDebug_fVer_set) + month = property(_ydlidar.LaserDebug_month_get, _ydlidar.LaserDebug_month_set) + day = property(_ydlidar.LaserDebug_day_get, _ydlidar.LaserDebug_day_set) + year = property(_ydlidar.LaserDebug_year_get, _ydlidar.LaserDebug_year_set) + numH = property(_ydlidar.LaserDebug_numH_get, _ydlidar.LaserDebug_numH_set) + numL = property(_ydlidar.LaserDebug_numL_get, _ydlidar.LaserDebug_numL_set) + health = property(_ydlidar.LaserDebug_health_get, _ydlidar.LaserDebug_health_set) + model = property(_ydlidar.LaserDebug_model_get, _ydlidar.LaserDebug_model_set) + maxIndex = property(_ydlidar.LaserDebug_maxIndex_get, _ydlidar.LaserDebug_maxIndex_set) + + def __init__(self): + _ydlidar.LaserDebug_swiginit(self, _ydlidar.new_LaserDebug()) + __swig_destroy__ = _ydlidar.delete_LaserDebug + +# Register LaserDebug in _ydlidar: +_ydlidar.LaserDebug_swigregister(LaserDebug) +class LaserScan(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + stamp = property(_ydlidar.LaserScan_stamp_get, _ydlidar.LaserScan_stamp_set) + scanFreq = property(_ydlidar.LaserScan_scanFreq_get, _ydlidar.LaserScan_scanFreq_set) + sampleRate = property(_ydlidar.LaserScan_sampleRate_get, _ydlidar.LaserScan_sampleRate_set) + points = property(_ydlidar.LaserScan_points_get, _ydlidar.LaserScan_points_set) + size = property(_ydlidar.LaserScan_size_get, _ydlidar.LaserScan_size_set) + config = property(_ydlidar.LaserScan_config_get, _ydlidar.LaserScan_config_set) + moduleNum = property(_ydlidar.LaserScan_moduleNum_get, _ydlidar.LaserScan_moduleNum_set) + envFlag = property(_ydlidar.LaserScan_envFlag_get, _ydlidar.LaserScan_envFlag_set) + + def __init__(self): + _ydlidar.LaserScan_swiginit(self, _ydlidar.new_LaserScan()) + __swig_destroy__ = _ydlidar.delete_LaserScan + +# Register LaserScan in _ydlidar: +_ydlidar.LaserScan_swigregister(LaserScan) +YDLIDAR_TYPE_SERIAL = _ydlidar.YDLIDAR_TYPE_SERIAL +YDLIDAR_TYPE_TCP = _ydlidar.YDLIDAR_TYPE_TCP +YDLIDAR_TYPC_UDP = _ydlidar.YDLIDAR_TYPC_UDP +TYPE_TOF = _ydlidar.TYPE_TOF +TYPE_TRIANGLE = _ydlidar.TYPE_TRIANGLE +TYPE_TOF_NET = _ydlidar.TYPE_TOF_NET +TYPE_GS = _ydlidar.TYPE_GS +TYPE_SCL = _ydlidar.TYPE_SCL +TYPE_SDM = _ydlidar.TYPE_SDM +TYPE_SDM18 = _ydlidar.TYPE_SDM18 +TYPE_TIA = _ydlidar.TYPE_TIA +TYPE_Tail = _ydlidar.TYPE_Tail +LidarPropSerialPort = _ydlidar.LidarPropSerialPort +LidarPropIgnoreArray = _ydlidar.LidarPropIgnoreArray +LidarPropSerialBaudrate = _ydlidar.LidarPropSerialBaudrate +LidarPropLidarType = _ydlidar.LidarPropLidarType +LidarPropDeviceType = _ydlidar.LidarPropDeviceType +LidarPropSampleRate = _ydlidar.LidarPropSampleRate +LidarPropAbnormalCheckCount = _ydlidar.LidarPropAbnormalCheckCount +LidarPropIntenstiyBit = _ydlidar.LidarPropIntenstiyBit +LidarPropMaxRange = _ydlidar.LidarPropMaxRange +LidarPropMinRange = _ydlidar.LidarPropMinRange +LidarPropMaxAngle = _ydlidar.LidarPropMaxAngle +LidarPropMinAngle = _ydlidar.LidarPropMinAngle +LidarPropScanFrequency = _ydlidar.LidarPropScanFrequency +LidarPropFixedResolution = _ydlidar.LidarPropFixedResolution +LidarPropReversion = _ydlidar.LidarPropReversion +LidarPropInverted = _ydlidar.LidarPropInverted +LidarPropAutoReconnect = _ydlidar.LidarPropAutoReconnect +LidarPropSingleChannel = _ydlidar.LidarPropSingleChannel +LidarPropIntenstiy = _ydlidar.LidarPropIntenstiy +LidarPropSupportMotorDtrCtrl = _ydlidar.LidarPropSupportMotorDtrCtrl +LidarPropSupportHeartBeat = _ydlidar.LidarPropSupportHeartBeat +class YDLidar(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + lidar = property(_ydlidar.YDLidar_lidar_get, _ydlidar.YDLidar_lidar_set) + + def __init__(self): + _ydlidar.YDLidar_swiginit(self, _ydlidar.new_YDLidar()) + __swig_destroy__ = _ydlidar.delete_YDLidar + +# Register YDLidar in _ydlidar: +_ydlidar.YDLidar_swigregister(YDLidar) +NoError = _ydlidar.NoError +DeviceNotFoundError = _ydlidar.DeviceNotFoundError +PermissionError = _ydlidar.PermissionError +UnsupportedOperationError = _ydlidar.UnsupportedOperationError +UnknownError = _ydlidar.UnknownError +TimeoutError = _ydlidar.TimeoutError +NotOpenError = _ydlidar.NotOpenError +BlockError = _ydlidar.BlockError +NotBufferError = _ydlidar.NotBufferError +TrembleError = _ydlidar.TrembleError +LaserFailureError = _ydlidar.LaserFailureError +class LaserPoint(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + angle = property(_ydlidar.LaserPoint_angle_get, _ydlidar.LaserPoint_angle_set) + range = property(_ydlidar.LaserPoint_range_get, _ydlidar.LaserPoint_range_set) + intensity = property(_ydlidar.LaserPoint_intensity_get, _ydlidar.LaserPoint_intensity_set) + + def __init__(self): + _ydlidar.LaserPoint_swiginit(self, _ydlidar.new_LaserPoint()) + __swig_destroy__ = _ydlidar.delete_LaserPoint + +# Register LaserPoint in _ydlidar: +_ydlidar.LaserPoint_swigregister(LaserPoint) +class LaserConfig(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + min_angle = property(_ydlidar.LaserConfig_min_angle_get, _ydlidar.LaserConfig_min_angle_set) + max_angle = property(_ydlidar.LaserConfig_max_angle_get, _ydlidar.LaserConfig_max_angle_set) + angle_increment = property(_ydlidar.LaserConfig_angle_increment_get, _ydlidar.LaserConfig_angle_increment_set) + time_increment = property(_ydlidar.LaserConfig_time_increment_get, _ydlidar.LaserConfig_time_increment_set) + scan_time = property(_ydlidar.LaserConfig_scan_time_get, _ydlidar.LaserConfig_scan_time_set) + min_range = property(_ydlidar.LaserConfig_min_range_get, _ydlidar.LaserConfig_min_range_set) + max_range = property(_ydlidar.LaserConfig_max_range_get, _ydlidar.LaserConfig_max_range_set) + + def __init__(self): + _ydlidar.LaserConfig_swiginit(self, _ydlidar.new_LaserConfig()) + __swig_destroy__ = _ydlidar.delete_LaserConfig + +# Register LaserConfig in _ydlidar: +_ydlidar.LaserConfig_swigregister(LaserConfig) +class LaserFan(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + stamp = property(_ydlidar.LaserFan_stamp_get, _ydlidar.LaserFan_stamp_set) + npoints = property(_ydlidar.LaserFan_npoints_get, _ydlidar.LaserFan_npoints_set) + points = property(_ydlidar.LaserFan_points_get, _ydlidar.LaserFan_points_set) + config = property(_ydlidar.LaserFan_config_get, _ydlidar.LaserFan_config_set) + + def __init__(self): + _ydlidar.LaserFan_swiginit(self, _ydlidar.new_LaserFan()) + __swig_destroy__ = _ydlidar.delete_LaserFan + +# Register LaserFan in _ydlidar: +_ydlidar.LaserFan_swigregister(LaserFan) +class string_t(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + data = property(_ydlidar.string_t_data_get, _ydlidar.string_t_data_set) + + def __init__(self): + _ydlidar.string_t_swiginit(self, _ydlidar.new_string_t()) + __swig_destroy__ = _ydlidar.delete_string_t + +# Register string_t in _ydlidar: +_ydlidar.string_t_swigregister(string_t) +class LidarPort(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + port = property(_ydlidar.LidarPort_port_get, _ydlidar.LidarPort_port_set) + + def __init__(self): + _ydlidar.LidarPort_swiginit(self, _ydlidar.new_LidarPort()) + __swig_destroy__ = _ydlidar.delete_LidarPort + +# Register LidarPort in _ydlidar: +_ydlidar.LidarPort_swigregister(LidarPort) +class LidarVersion(object): + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") + __repr__ = _swig_repr + hardware = property(_ydlidar.LidarVersion_hardware_get, _ydlidar.LidarVersion_hardware_set) + soft_major = property(_ydlidar.LidarVersion_soft_major_get, _ydlidar.LidarVersion_soft_major_set) + soft_minor = property(_ydlidar.LidarVersion_soft_minor_get, _ydlidar.LidarVersion_soft_minor_set) + soft_patch = property(_ydlidar.LidarVersion_soft_patch_get, _ydlidar.LidarVersion_soft_patch_set) + sn = property(_ydlidar.LidarVersion_sn_get, _ydlidar.LidarVersion_sn_set) + + def __init__(self): + _ydlidar.LidarVersion_swiginit(self, _ydlidar.new_LidarVersion()) + __swig_destroy__ = _ydlidar.delete_LidarVersion + +# Register LidarVersion in _ydlidar: +_ydlidar.LidarVersion_swigregister(LidarVersion) + +def LaserFanInit(to_init): + return _ydlidar.LaserFanInit(to_init) + +def LaserFanDestroy(to_destroy): + return _ydlidar.LaserFanDestroy(to_destroy) +