examples/a121/basic.py#
1# Copyright (c) Acconeer AB, 2022-2024
2# All rights reserved
3
4from acconeer.exptool import a121
5
6
7# Client is an object that is used to interact with the sensor.
8client = a121.Client.open(
9 # ip_address="<ip address of host (like a RPi). E.g. 192.168.XXX.YYY>",
10 # or
11 # serial_port="<serial port of module. E.g. COM3 or /dev/ttyUSBx for Window/Linux>",
12 # or
13 # usb_device=True,
14 # or
15 # mock=True,
16)
17
18# Once the client is connected, information about the server can be accessed.
19print("Server Info:")
20print(client.server_info)
21
22# In order to get radar data from the server, we need to start a session.
23
24# To be able to start a session, we must first configure the session
25sensor_config = a121.SensorConfig()
26sensor_config.num_points = 6
27sensor_config.sweeps_per_frame = 4
28sensor_config.hwaas = 16
29client.setup_session(sensor_config)
30
31# Now we are ready to start it:
32client.start_session()
33
34n = 5
35for i in range(n):
36 # Data is retrieved from the sensor with "get_next".
37 result = client.get_next()
38
39 print(f"Result {i + 1}:")
40 print(result)
41
42# When we are done, we should close the connection to the server.
43client.close()
View this example on GitHub: acconeer/acconeer-python-exploration