diff --git a/ansible/roles/microservices/files/robocar/car/deployments.yaml b/ansible/roles/microservices/files/robocar/car/deployments.yaml index 29c2da8..c739049 100644 --- a/ansible/roles/microservices/files/robocar/car/deployments.yaml +++ b/ansible/roles/microservices/files/robocar/car/deployments.yaml @@ -166,7 +166,7 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: pca9685 + name: pca9685-steering annotations: reloader.stakater.com/auto: "true" spec: @@ -184,19 +184,13 @@ spec: spec: containers: - name: pca9685 - image: docker.io/cyrilix/robocar-pca9685 + image: docker.io/cyrilix/robocar-pca9685-python args: - - "--mqtt-retain=false" - - "--throttle-channel=1" - - "--steering-channel=0" - - "--throttle-zero-pwm=378" - - "--throttle-min-pwm=250" - - "--throttle-max-pwm=500" - - "--steering-left-pwm=$(STEERING_LEFT_PWM)" - - "--steering-right-pwm=$(STEERING_RIGHT_PWM)" - - "--steering-center-pwm=$(STEERING_CENTER_PWM)" - - "--update-pwm-frequency=10" - - "--log=info" + - "--i2c-bus=1" + - "--i2c-address=40" + - "--pca9685-channel=0" + - "--left-pulse=$(STEERING_LEFT_PWM)" + - "--right-pulse=$(STEERING_RIGHT_PWM)" securityContext: runAsUser: 1234 runAsGroup: 998 # Set 998/i2c group to access to i2c device @@ -222,12 +216,7 @@ spec: name: mqtt-credentials - name: MQTT_CLIENT_ID value: rc-pca9685 - - name: MQTT_TOPIC_THROTTLE - valueFrom: - configMapKeyRef: - key: MQTT_TOPIC_THROTTLE - name: robocar - - name: MQTT_TOPIC_STEERING + - name: MQTT_TOPIC valueFrom: configMapKeyRef: key: MQTT_TOPIC_STEERING @@ -256,3 +245,72 @@ spec: hostPath: path: /dev/i2c-1 type: CharDevice +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pca9685-throttle + annotations: + reloader.stakater.com/auto: "true" +spec: + revisionHistoryLimit: 0 + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + component: pca9685 + template: + metadata: + labels: + component: pca9685 + spec: + containers: + - name: pca9685-steering + image: docker.io/cyrilix/robocar-pca9685-python + args: + - "--zero-pulse=378" + - "--min-pulse=250" + - "--max-pulse=500" + - "--i2c-bus=1" + - "--i2c-address=40" + - "--pca9685-channel=1" + securityContext: + runAsUser: 1234 + runAsGroup: 998 # Set 998/i2c group to access to i2c device + privileged: true + volumeMounts: + - mountPath: /dev/i2c-1 + name: i2c + env: + - name: MQTT_BROKER + valueFrom: + configMapKeyRef: + key: MQTT_BROKER + name: robocar + - name: MQTT_USERNAME + valueFrom: + secretKeyRef: + key: MQTT_USERNAME + name: mqtt-credentials + - name: MQTT_PASSWORD + valueFrom: + secretKeyRef: + key: MQTT_PASSWORD + name: mqtt-credentials + - name: MQTT_CLIENT_ID + value: rc-pca9685 + - name: MQTT_TOPIC + valueFrom: + configMapKeyRef: + key: MQTT_TOPIC_THROTTLE + name: robocar + - name: MQTT_QOS + value: "0" + - name: TZ + value: "Europe/Paris" + volumes: + - name: i2c + hostPath: + path: /dev/i2c-1 + type: CharDevice diff --git a/ansible/roles/microservices/files/robocar/car/kustomization.yaml b/ansible/roles/microservices/files/robocar/car/kustomization.yaml index 5ea6f01..edded8c 100644 --- a/ansible/roles/microservices/files/robocar/car/kustomization.yaml +++ b/ansible/roles/microservices/files/robocar/car/kustomization.yaml @@ -13,8 +13,8 @@ images: - name: docker.io/cyrilix/robocar-camera newTag: v0.3.0 - - name: docker.io/cyrilix/robocar-pca9685 - newTag: v0.5.0 + - name: docker.io/cyrilix/robocar-pca9685-python + newTag: v0.1.0 - name: docker.io/cyrilix/robocar-oak-camera newTag: v0.1.0 \ No newline at end of file