MCPcopy Create free account
hub / github.com/YDLIDAR/YDLidar-SDK / Main

Method Main

csharp/examples/Program.cs:7–43  ·  view source on GitHub ↗
(string[] args)

Source from the content-addressed store, hash-verified

5 class Program
6 {
7 static void Main(string[] args)
8 {
9 ydlidar.os_init();
10 CYdLidar lidarClass = new CYdLidar();
11 string port = "COM7";
12 int optname = (int)LidarProperty.LidarPropSerialPort;
13 lidarClass.setlidaropt(optname, port);
14 optname = (int)LidarProperty.LidarPropSerialBaudrate;
15 lidarClass.setlidaropt(optname, 512000);
16
17 optname = (int)LidarProperty.LidarPropLidarType;
18
19 int lidarType = (int)LidarTypeID.TYPE_TOF;
20 lidarClass.setlidaropt(optname, lidarType);
21
22
23 bool ret = lidarClass.initialize();
24 if(ret)
25 {
26 ret = lidarClass.turnOn();
27 } else
28 {
29 Console.WriteLine("error:" + lidarClass.DescribeError());
30 }
31 LaserScan scan = new LaserScan();
32 while (ret && ydlidar.os_isOk())
33 {
34 if(lidarClass.doProcessSimple(scan))
35 {
36 Console.WriteLine("stamp: "+ scan.stamp + ", size: " + scan.points.Count);
37 }
38 }
39 lidarClass.turnOff();
40 lidarClass.disconnecting();
41 lidarClass.Dispose();
42
43 }
44 }
45}

Callers

nothing calls this directly

Calls 7

setlidaroptMethod · 0.80
initializeMethod · 0.80
turnOnMethod · 0.80
doProcessSimpleMethod · 0.80
turnOffMethod · 0.80
disconnectingMethod · 0.80
DescribeErrorMethod · 0.45

Tested by

no test coverage detected