Open ggjj11 opened 4 years ago
X2 cannot adjust the scanning frequency through sdk, it needs external pwm. The serial port DRT of the lidar adapter board is connected to the M_SCTR of the lidar. The DTR has two states, high and low, and the frequency of the fixed lidar is only two states.
How can I stop the lidar (X2L) over the USB- adapter ? I couldn't find any command in the API. when I switsch off, the lidar rotates with that high frequency, which is really not healthy.
i saw datasheet. x2 interface is only send to PC. no input(receive).
Thank you again for your nice product and software! I am trying to get the X2 do what I want :)
I noticed that the X2 rotates extremely fast (probably around 20 Hz, but surely above 10 Hz, although I only measured it "by eye") when plugging in the USB-C cable (and not running a program in the beginning). It rotates so fast that I wonder whether this is healthy for the X2. However, when starting a python script or (one of the provided programs in the SDK) which reads lidar data, the rotation speed is reduced to roughly 6Hz +/-1 Hz (standard deviation). I tried increasing/decreasing the speed of rotation via increasing the ROTATION_FREQ, e.g. to 10 [Hz]
but having a look at two successive 'scan.stamp' times (in nanoseconds) only showed that I cannot really adapt the scanning frequencies like this: The scanning frequencies remained 6Hz +/-1 Hz (standard deviation).
Below you find the example script which I adapted from the example in this repository:
''''
import os import ydlidar import time import sys import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np
ROTATION_FREQ=10 # in Hertz
fig = plt.figure() fig.canvas.set_window_title('YDLidar LIDAR Monitor') ax = plt.subplot() ax.autoscale_view(False,False,False) ax.grid(True) ports = ydlidar.lidarPortList(); port = "com3" for key, value in ports.items(): port = value;
laser = ydlidar.CYdLidar(); laser.setlidaropt(ydlidar.LidarPropSerialPort, port); laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 115200) #115200 laser.setlidaropt(ydlidar.LidarPropLidarType, ydlidar.TYPE_TRIANGLE); laser.setlidaropt(ydlidar.LidarPropDeviceType, ydlidar.YDLIDAR_TYPE_SERIAL); laser.setlidaropt(ydlidar.LidarPropScanFrequency, ROTATION_FREQ); laser.setlidaropt(ydlidar.LidarPropSampleRate, 3); laser.setlidaropt(ydlidar.LidarPropSingleChannel, True); scan = ydlidar.LaserScan()
scan_times=[]
def animate(num):
ret = laser.initialize(); if ret: ret = laser.turnOn(); if ret: ani = animation.FuncAnimation(fig, animate, interval=10) plt.show() laser.turnOff(); laser.disconnecting(); plt.close();
''''
This is maybe related to: https://github.com/YDLIDAR/ydlidar_ros/issues/1
Why can't I perform scans at this initial rotation frequency? This would be awesome! For the SLAM application I have in mind, it would be beneficial to have high frequency updates of measurements.