Compare commits

..

4 Commits

Author SHA1 Message Date
hasslesstech 15b8a7086f [P] Add second agent in docker-compose.yaml
Component testing / Hub testing (push) Successful in 23s
Component testing / Store testing (push) Successful in 29s
Component testing / Integration smoke testing (push) Failing after 2m37s
2026-03-25 23:00:26 +02:00
hasslesstech 2b8d042306 [P] Add GPS file selection to agent 2026-03-25 23:00:26 +02:00
hasslesstech 5ab16fec72 [P] Add TRACK_ID selection in MapView
Component testing / Hub testing (push) Successful in 25s
Component testing / Store testing (push) Successful in 31s
Component testing / Integration smoke testing (push) Successful in 2m26s
2026-03-25 22:58:23 +02:00
hasslesstech d633926a1a [P] Fix wrong row sending order
Component testing / Hub testing (push) Successful in 20s
Component testing / Store testing (push) Successful in 25s
Component testing / Integration smoke testing (push) Successful in 2m39s
2026-03-25 22:57:52 +02:00
6 changed files with 29 additions and 10 deletions
+2
View File
@@ -2,3 +2,5 @@ import os
STORE_HOST = os.environ.get("STORE_HOST") or "localhost"
STORE_PORT = os.environ.get("STORE_PORT") or 8000
TRACK_ID = int(os.environ.get("TID") or '1')
+2 -1
View File
@@ -4,6 +4,7 @@ from kivy_garden.mapview import MapMarker, MapView
from kivy.clock import Clock
from lineMapLayer import LineMapLayer
from datasource import Datasource
import config
line_layer_colors = [
[1, 0, 0, 1],
@@ -87,7 +88,7 @@ class MapViewApp(App):
self.car_markers[user_id].lat = lat
self.car_markers[user_id].lon = lon
if user_id == 1:
if user_id == config.TRACK_ID:
self.mapview.center_on(lat, lon)
def set_pothole_marker(self, point):
+3 -4
View File
@@ -1,18 +1,17 @@
import os
def try_parse(type, value: str):
try:
return type(value)
except Exception:
return None
USER_ID = try_parse(int, os.environ.get("USER_ID")) or 1
# MQTT config
MQTT_BROKER_HOST = os.environ.get("MQTT_BROKER_HOST") or "mqtt"
MQTT_BROKER_PORT = try_parse(int, os.environ.get("MQTT_BROKER_PORT")) or 1883
MQTT_TOPIC = os.environ.get("MQTT_TOPIC") or "agent"
# Delay for sending data to mqtt in seconds
# Data-related config
USER_ID = try_parse(int, os.environ.get("USER_ID")) or 1
DELAY = try_parse(float, os.environ.get("DELAY")) or 1
GPS_SOURCE = os.environ.get("GPS_SOURCE") or "data/gps.csv"
+1 -1
View File
@@ -42,7 +42,7 @@ def run():
# Prepare mqtt client
client = connect_mqtt(config.MQTT_BROKER_HOST, config.MQTT_BROKER_PORT)
# Prepare datasource
datasource = FileDatasource(16384.0, "data/accelerometer.csv", "data/gps.csv", "data/parking.csv")
datasource = FileDatasource(16384.0, "data/accelerometer.csv", config.GPS_SOURCE, "data/parking.csv")
# Infinity publish data
publish(client, config.MQTT_TOPIC, datasource)
+20 -3
View File
@@ -14,8 +14,7 @@ services:
mqtt_network:
fake_agent:
container_name: agent
agent1:
build:
context: .
dockerfile: agent/Dockerfile
@@ -26,7 +25,25 @@ services:
MQTT_BROKER_HOST: "mqtt"
MQTT_BROKER_PORT: 1883
MQTT_TOPIC: "agent_data_topic"
DELAY: 0.1
DELAY: 1.2
USER_ID: 2
networks:
mqtt_network:
agent2:
build:
context: .
dockerfile: agent/Dockerfile
depends_on:
- mqtt
environment:
PYTHONUNBUFFERED: 1
MQTT_BROKER_HOST: "mqtt"
MQTT_BROKER_PORT: 1883
MQTT_TOPIC: "agent_data_topic"
GPS_SOURCE: "data/route2.csv"
DELAY: 1.0
USER_ID: 3
networks:
mqtt_network:
+1 -1
View File
@@ -45,7 +45,7 @@ async def websocket_endpoint(websocket: WebSocket, user_id: int):
try:
# send already available data
r = processed_agent_data.select().order_by(processed_agent_data.c.timestamp)
r = processed_agent_data.select()
stored_data = SessionLocal().execute(r).fetchall()
jsonable_data = [{c.name: getattr(i, c.name) for c in processed_agent_data.columns} for i in stored_data]