Compare commits

...

2 Commits

Author SHA1 Message Date
c6f5f8a185 feat: detect objects 2022-10-07 14:43:05 +02:00
220162f6f4 feat: replace rabbitmq with nats 2022-10-07 14:42:25 +02:00
12 changed files with 180 additions and 26 deletions

View File

@ -117,8 +117,10 @@ spec:
- name: dev
mountPath: /dev
env:
- name: MQTT_BROKER
- name: MQTT_BROKER_HOST
value: localhost # because use host network
- name: MQTT_BROKER_PORT
value: "30183"
- name: MQTT_USERNAME
valueFrom:
secretKeyRef:

View File

@ -17,4 +17,4 @@ images:
newTag: v0.6.4
- name: docker.io/cyrilix/robocar-oak-camera
newTag: v0.1.0-2-g52c3808
newTag: v0.2.0

View File

@ -4,8 +4,9 @@ metadata:
name: robocar
data:
# Broker configuration
MQTT_BROKER_HOST: mqtt.robocar.svc.cluster.local
MQTT_BROKER: "tcp://mqtt.robocar.svc.cluster.local:1883"
MQTT_BROKER_HOST: nats-server.nats.svc.cluster.local
#MQTT_BROKER: "tcp://mqtt.robocar.svc.cluster.local:1883"
MQTT_BROKER: "tcp://nats-server.nats.svc.cluster.local:1883"
# Camera
MQTT_TOPIC_CAMERA: car/satanas/part/camera/color
@ -114,7 +115,6 @@ metadata:
data:
# model to use for steering
MODEL_STEERING: model_categorical_160x120h0_edgetpu.tflite
#MODEL_STEERING: model_categorical_160x120h0_edgetpu.tflite
#MODEL_STEERING: model_linear_160x120h40_edgetpu.tflite
@ -181,3 +181,14 @@ data:
"min_valid": 500,
"data": [ 8700, 4800, 3500, 2550, 1850, 1387, 992, 840, 750, 700, 655, 620, 590, 570, 553, 549, 548 ]
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: throttle
data:
brake.json: |
{
"delta_steps": [ 0.05, 0.3, 0.5 ],
"data": [ -0.1, -0.5, -1.0 ]
}

View File

@ -418,8 +418,10 @@ spec:
- name: throttle
image: docker.io/cyrilix/robocar-throttle
args:
- "-mqtt-retain=false"
- "-log=info"
- "--mqtt-retain=false"
- "--enable-brake-feature=true"
- "--brake-configuration=/etc/robocar/brake.json"
- "--log=info"
securityContext:
runAsUser: 1234
runAsGroup: 1234
@ -456,6 +458,16 @@ spec:
configMapKeyRef:
key: MQTT_TOPIC_RC_DRIVE_MODE
name: robocar
- name: MQTT_TOPIC_THROTTLE_FEEDBACK
valueFrom:
configMapKeyRef:
name: robocar
key: MQTT_TOPIC_THROTTLE_FEEDBACK
- name: MQTT_TOPIC_STEERING
valueFrom:
configMapKeyRef:
key: MQTT_TOPIC_STEERING
name: robocar
- name: THROTTLE_MIN
valueFrom:
configMapKeyRef:
@ -470,6 +482,13 @@ spec:
value: "0"
- name: TZ
value: "Europe/Paris"
volumeMounts:
- mountPath: /etc/robocar
name: throttle-config
volumes:
- name: throttle-config
configMap:
name: throttle
---
apiVersion: apps/v1
kind: Deployment

View File

@ -1,13 +0,0 @@
---
apiVersion: v1
kind: Endpoints
metadata:
name: mqtt
labels:
app: mqtt
subsets:
- addresses:
- ip: 192.168.2.221
# - ip: 192.168.217.19
ports:
- port: 1883

View File

@ -4,23 +4,21 @@ kind: Kustomization
resources:
- deployments.yaml
- endpoints.yaml
- services.yaml
- configmap.yaml
images:
- name: docker.io/cyrilix/robocar-arduino
newTag: v0.8.0-6-gadb38c3
newTag: v0.9.0
- name: docker.io/cyrilix/robocar-led
newTag: v0.5.1
- name: docker.io/cyrilix/robocar-steering-tflite-edgetpu
#newTag: v0.5.0
newTag: v0.5.0-1-gbc90193
newTag: v0.5.3
- name: docker.io/cyrilix/robocar-throttle
newTag: v0.5.0
newTag: v0.6.0
- name: docker.io/cyrilix/robocar-record
newTag: v0.5.1
@ -29,7 +27,7 @@ images:
newTag: v0.2.1
- name: docker.io/cyrilix/robocar-steering
newTag: v0.5.1-24-g424b697
newTag: v0.6.0
- name: docker.io/cyrilix/robocar-road
newTag: v0.2.0

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nats
data:
standalone.conf: |
server_name: nats
http: 0.0.0.0:8222
jetstream {
store_dir: /data/datastore
}
mqtt {
listen: 0.0.0.0:1883
}
authorization: {
user: satanas,
password: satanas
}

View File

@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: nats
resources:
- namespace.yaml
- serviceaccount.yaml
- configmaps.yaml
- statefulset.yaml
- services.yaml

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: nats

View File

@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: nats-server
automountServiceAccountToken: false

View File

@ -0,0 +1,41 @@
apiVersion: v1
kind: Service
metadata:
name: nats-server-ext
spec:
type: NodePort
ports:
- port: 4222
name: tcp-nats-client
targetPort: tcp-nats-client
nodePort: 30422
- name: http-monitoring
port: 8222
targetPort: http-monitoring
nodePort: 30822
- name: tcp-mqtt
port: 1883
targetPort: tcp-mqtt
nodePort: 30183
selector:
appli: nats-server
---
apiVersion: v1
kind: Service
metadata:
name: nats-server
spec:
type: ClusterIP
ports:
- port: 4222
name: tcp-nats-client
targetPort: tcp-nats-client
- name: http-monitoring
port: 8222
targetPort: http-monitoring
- name: tcp-mqtt
port: 1883
targetPort: tcp-mqtt
selector:
appli: nats-server

View File

@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nats-server
annotations:
reloader.stakater.com/auto: "true"
spec:
selector:
matchLabels:
appli: nats-server
serviceName: nats
replicas: 1
revisionHistoryLimit: 0
template:
metadata:
name: nats-server
labels:
appli: nats-server
spec:
serviceAccountName: nats-server
containers:
- name: nats-server
image: docker.io/library/nats:latest
args:
- --http_port=8222
- --config=/etc/nats/standalone.conf
ports:
- containerPort: 4222
name: tcp-nats-client
- name: http-monitoring
containerPort: 8222
- name: tcp-mqtt
containerPort: 1883
volumeMounts:
- mountPath: /etc/nats
name: nats-config
- name: nats-data
mountPath: /data
securityContext:
runAsUser: 1234
runAsGroup: 1234
fsGroup: 1234
fsGroupChangePolicy: Always
volumes:
- name: nats-config
configMap:
name: nats
volumeClaimTemplates:
- metadata:
name: nats-data
spec:
resources:
requests:
storage: 1Gi
storageClassName: local-path
accessModes:
- ReadWriteOnce