1
1
# Python client for the Ouster Lidar OS-1
2
2
3
- Compatible with Firmware Version 1.6.0 and python 3
4
- > Your milage may vary with other versions, it was tested against a device running 1.6.0
3
+ Compatible with Firmware Version 1.10.0 and python 3
4
+ > Your milage may vary with other versions, it was tested against a device OS1-16
5
+ > device running 1.10.0
5
6
6
7
## Installing
7
8
` pip install ouster-os1 `
@@ -20,18 +21,19 @@ def handler(raw_packet):
20
21
f.write(" {} \n " .format(' ,' .join(coords)))
21
22
22
23
23
- os1 = OS1(' 10.0.0.3' , ' 10.0.0.1' ) # OS1 sensor IP and destination IP
24
+ os1 = OS1(' 10.0.0.3' , ' 10.0.0.1' , mode = ' 1024x10 ' ) # OS1 sensor IP, destination IP, and resolution
24
25
# Inform the sensor of the destination host and reintialize it
25
26
os1.start()
26
27
# Start the loop which will handle and dispatch each packet to the handler
27
28
# function for processing
28
29
os1.run_forever(handler)
29
30
```
30
31
31
- > You run the server as threaded with ` os1.run_forever(handler, threaded=True) `
32
+ > You can run the server as threaded with ` os1.run_forever(handler, threaded=True) `
32
33
33
34
## Recipes
34
- Generally speed is a concern since the OS1 is sending 12,608 bytes/packet at a rate of 1280 packets/sec.
35
+ Generally speed is a concern since the OS1 is sending 12,608 bytes/packet at a
36
+ rate of 1280 packets/sec (in 1024x20 or 2048x10 mode).
35
37
So a multiprocessing producer consumer model works well.
36
38
``` python
37
39
import json
@@ -72,10 +74,29 @@ def spawn_workers(n, worker, *args, **kwargs):
72
74
73
75
74
76
os1 = OS1(OS1_IP , HOST_IP )
75
- beam_intrinsics = json.loads(os1.api. get_beam_intrinsics())
77
+ beam_intrinsics = json.loads(os1.get_beam_intrinsics())
76
78
beam_alt_angles = beam_intrinsics[' beam_altitude_angles' ]
77
79
beam_az_angles = beam_intrinsics[' beam_azimuth_angles' ]
78
- spawn_workers(4 , worker, unprocessed_packets, beam_alt_angles, beam_az_angles)
80
+ workers = spawn_workers(4 , worker, unprocessed_packets, beam_alt_angles, beam_az_angles)
79
81
os1.start()
80
- os1.run_forever(handler)
82
+ try :
83
+ os1.run_forever(handler)
84
+ except KeyboardInterrupt :
85
+ for w in workers:
86
+ w.terminate()
81
87
```
88
+
89
+ ## TCP API Commands
90
+
91
+ The TCP API commands can be accessed through an instance of the ` OS1 ` object.
92
+
93
+ The following methods are supported:
94
+
95
+ * ` get_config_txt `
96
+ * ` get_sensor_info `
97
+ * ` get_beam_intrinsics `
98
+ * ` get_imu_intrinsics `
99
+ * ` get_lidar_intrinsics `
100
+ * ` get_config_param ` - Supports querying active and staged parameters. Example: ` os1.get_config_param('active', 'udp_ip') `
101
+ * ` set_config_param ` - Supports settings parameters to be staged. Example: ` os1.set_config_param('udp_ip', '10.0.0.1') `
102
+ * ` reinitialize ` - Will reinitialize the sensor and apply all staged parameters to be active.
0 commit comments