You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Common Service: LiDAR & Weight Sensor Microservice
2
-
This microservice manages **both LiDAR and Weight sensors** in a single container. It publishes sensor data over **MQTT** , **Kafka** , or **HTTP** (or any combination), controlled entirely by environment variables.
This microservice manages **Barcode, LiDAR, and Weight sensors** in a single container. It publishes sensor data over **MQTT** , **Kafka** , or **HTTP** (or any combination), controlled entirely by environment variables.
3
+
## 1. Overview
5
4
6
5
-**Sensors**
7
-
-LiDAR & Weight support in the same codebase.
6
+
- Barcode, LiDAR, & Weight support in the same codebase.
8
7
9
-
- Configuration for each sensor (e.g., ID, port, mock mode, intervals).
8
+
- Configuration for each sensor (e.g., ID, port, mock mode, intervals).
10
9
11
10
-**Publishing**
12
-
-`publisher.py` handles publishing to one or more protocols:
13
-
- **MQTT**
14
-
15
-
- **Kafka**
16
-
17
-
- **HTTP**
11
+
-`publisher.py` handles publishing to one or more protocols:
12
+
-**MQTT**
13
+
14
+
-**Kafka**
15
+
16
+
-**HTTP**
18
17
19
18
-**Apps**
20
-
- Two main modules:
21
-
- `lidar_app.py`
22
-
23
-
- `weight_app.py`
19
+
- Three main modules:
20
+
-`barcode_app.py`
21
+
22
+
-`lidar_app.py`
24
23
25
-
- Each uses shared methods from `publisher.py` & `config.py`.
24
+
-`weight_app.py`
25
+
26
+
- Each uses shared methods from `publisher.py` & `config.py`.
26
27
27
-
## Environment Variables
28
+
## 2. Environment Variables
28
29
All settings are defined in `docker-compose.yml` under the `asc_common_service` section. Key variables include:
29
30
### LiDAR
30
31
| Variable | Description | Example |
@@ -60,29 +61,46 @@ All settings are defined in `docker-compose.yml` under the `asc_common_service`
60
61
| WEIGHT_PUBLISH_INTERVAL | Interval (in seconds) for Weight data publishing | 1.0 |
> **Note:** Change `"true"` or `"false"` to enable or disable each protocol. Adjust intervals, logging levels, or sensor counts as needed.
64
-
## Usage
81
+
## 3. Usage
65
82
66
83
1.**Build and Run**
67
84
68
-
```bash
69
-
make run-demo
70
-
```
71
-
This spins up the `asc_common_service` container (and related services like Mosquitto or Kafka, depending on your configuration).
85
+
```bash
86
+
make build-sensors
87
+
make run-sensors
88
+
```
89
+
This spins up the `asc_common_service` container (and related services like Mosquitto or Kafka, depending on your configuration).
72
90
73
91
2.**Data Flow**
74
-
- By default, LiDAR publishes to `lidar/data` (MQTT, if enabled) or `lidar-data` (Kafka), or an HTTP endpoint if configured.
92
+
- By default, LiDAR publishes to `lidar/data` (MQTT, if enabled) or `lidar-data` (Kafka), or an HTTP endpoint if configured.
75
93
76
-
- Weight sensor similarly publishes to `weight/data` or `weight-data`.
94
+
- Weight sensor similarly publishes to `weight/data` or `weight-data`.
77
95
78
96
3.**Mock Mode**
79
-
- Setting `LIDAR_MOCK_1="true"` (or `WEIGHT_MOCK_1="true"`) forces the sensor to generate **random** data rather than reading from actual hardware.
97
+
- Setting `LIDAR_MOCK_1="true"` (or `WEIGHT_MOCK_1="true"`) forces the sensor to generate **random** data rather than reading from actual hardware.
80
98
81
-
## Testing
99
+
## 4. Testing
82
100
83
101
### A. MQTT
84
102
85
-
- **Grafana**: A pre-loaded dashboard named *Sensor-Analytics* is available at [http://localhost:3000](http://localhost:3000/) (default credentials `admin`/`admin`).
103
+
-**Grafana** : A pre-loaded dashboard named *Retail Analytics Dashboard* is available at [http://localhost:3000](http://localhost:3000/) (default credentials `admin`/`admin`).
86
104
87
105
- Check that the MQTT data source in Grafana points to `tcp://mqtt-broker_1:1883` (or `tcp://mqtt-broker:1883`, depending on the network).
88
106
@@ -92,38 +110,38 @@ All settings are defined in `docker-compose.yml` under the `asc_common_service`
0 commit comments