new car config

This commit is contained in:
Cyrille Nofficial 2022-09-04 18:05:32 +02:00
parent 6759304b25
commit e446025e76
6 changed files with 170 additions and 87 deletions

View File

@ -0,0 +1,20 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: robocar-pca9685-pwm
data:
############################
# STEERING PWM - PCA9685 #
############################
STEERING_PCA9685_LEFT_PWM: "995"
STEERING_PCA9685_RIGHT_PWM: "2017"
STEERING_PCA9685_CENTER_PWM: "1440"
###########################
# THROTTLE PWM - PCA9685 #
############################
THROTTLE_PCA9685_MIN_PWM: "994"
THROTTLE_PCA9685_MAX_PWM: "1975"
THROTTLE_PCA9685_ZERO_PWM: "1420"

View File

@ -107,6 +107,7 @@ spec:
args: args:
- "--image-width=$(CAMERA_WIDTH)" - "--image-width=$(CAMERA_WIDTH)"
- "--image-height=$(CAMERA_HEIGHT)" - "--image-height=$(CAMERA_HEIGHT)"
- "--objects-threshold=$(THRESHOLD_OBJECTS)"
securityContext: securityContext:
runAsUser: 1234 runAsUser: 1234
privileged: true privileged: true
@ -135,6 +136,16 @@ spec:
configMapKeyRef: configMapKeyRef:
key: MQTT_TOPIC_CAMERA_OAK_COLOR key: MQTT_TOPIC_CAMERA_OAK_COLOR
name: robocar name: robocar
- name: MQTT_TOPIC_OBJECTS
valueFrom:
configMapKeyRef:
key: MQTT_TOPIC_OBJECTS
name: robocar
- name: THRESHOLD_OBJECTS
valueFrom:
configMapKeyRef:
key: THRESHOLD
name: robocar-objects
- name: CAMERA_WIDTH - name: CAMERA_WIDTH
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
@ -186,13 +197,13 @@ spec:
- "--mqtt-retain=false" - "--mqtt-retain=false"
- "--throttle-channel=15" - "--throttle-channel=15"
- "--steering-channel=14" - "--steering-channel=14"
- "--throttle-zero-pwm=$(THROTTLE_ZERO_PWM)" - "--throttle-zero-pwm=$(THROTTLE_PCA9685_ZERO_PWM)"
- "--throttle-min-pwm=$(THROTTLE_MIN_PWM)" - "--throttle-min-pwm=$(THROTTLE_PCA9685_MIN_PWM)"
- "--throttle-max-pwm=$(THROTTLE_MAX_PWM)" - "--throttle-max-pwm=$(THROTTLE_PCA9685_MAX_PWM)"
- "--steering-left-pwm=$(STEERING_LEFT_PWM)" - "--steering-left-pwm=$(STEERING_PCA9685_LEFT_PWM)"
- "--steering-right-pwm=$(STEERING_RIGHT_PWM)" - "--steering-right-pwm=$(STEERING_PCA9685_RIGHT_PWM)"
- "--steering-center-pwm=$(STEERING_CENTER_PWM)" - "--steering-center-pwm=$(STEERING_PCA9685_CENTER_PWM)"
- "--pwm-freq=60" - "--pwm-freq=50"
- "--update-pwm-frequency=25" - "--update-pwm-frequency=25"
- "--log=info" - "--log=info"
securityContext: securityContext:
@ -202,6 +213,9 @@ spec:
volumeMounts: volumeMounts:
- mountPath: /dev/i2c-1 - mountPath: /dev/i2c-1
name: i2c name: i2c
envFrom:
- configMapRef:
name: robocar-pca9685-pwm
env: env:
- name: MQTT_BROKER - name: MQTT_BROKER
valueFrom: valueFrom:
@ -232,36 +246,6 @@ spec:
name: robocar name: robocar
- name: MQTT_QOS - name: MQTT_QOS
value: "0" value: "0"
- name: STEERING_LEFT_PWM
valueFrom:
configMapKeyRef:
name: robocar-steering-pwm
key: STEERING_LEFT_PWM
- name: STEERING_RIGHT_PWM
valueFrom:
configMapKeyRef:
name: robocar-steering-pwm
key: STEERING_RIGHT_PWM
- name: STEERING_CENTER_PWM
valueFrom:
configMapKeyRef:
name: robocar-steering-pwm
key: STEERING_CENTER_PWM
- name: THROTTLE_MIN_PWM
valueFrom:
configMapKeyRef:
name: robocar-throttle-pwm
key: THROTTLE_MIN_PWM
- name: THROTTLE_MAX_PWM
valueFrom:
configMapKeyRef:
name: robocar-throttle-pwm
key: THROTTLE_MAX_PWM
- name: THROTTLE_ZERO_PWM
valueFrom:
configMapKeyRef:
name: robocar-throttle-pwm
key: THROTTLE_ZERO_PWM
- name: TZ - name: TZ
value: "Europe/Paris" value: "Europe/Paris"
volumes: volumes:

View File

@ -7,6 +7,7 @@ namespace: robocar
resources: resources:
- ../common - ../common
- deployments.yaml - deployments.yaml
- configmap.yaml
images: images:
- name: docker.io/cyrilix/robocar-camera - name: docker.io/cyrilix/robocar-camera
@ -16,4 +17,4 @@ images:
newTag: v0.6.4 newTag: v0.6.4
- name: docker.io/cyrilix/robocar-oak-camera - name: docker.io/cyrilix/robocar-oak-camera
newTag: v0.1.0 newTag: v0.1.0-2-g52c3808

View File

@ -11,6 +11,8 @@ data:
MQTT_TOPIC_CAMERA: car/satanas/part/camera/color MQTT_TOPIC_CAMERA: car/satanas/part/camera/color
MQTT_TOPIC_CAMERA_OAK_COLOR: car/satanas/part/camera/color MQTT_TOPIC_CAMERA_OAK_COLOR: car/satanas/part/camera/color
# Objects detection
MQTT_TOPIC_OBJECTS: car/satanas/part/objects
# Radio command # Radio command
MQTT_TOPIC_RC_THROTTLE: car/satanas/part/rc/throttle MQTT_TOPIC_RC_THROTTLE: car/satanas/part/rc/throttle
@ -31,6 +33,9 @@ data:
# Records topic # Records topic
MQTT_TOPIC_RECORDS: car/satanas/part/records MQTT_TOPIC_RECORDS: car/satanas/part/records
# Feedbacks
MQTT_TOPIC_THROTTLE_FEEDBACK: car/satanas/part/feedback/throttle
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -40,13 +45,8 @@ data:
############ ############
# Throttle # # Throttle #
############ ############
# Min value to start is 0.12 THROTTLE_MIN: "0.2"
# Good value for manual: 0.15 THROTTLE_MAX: "0.3"
#THROTTLE_MIN: "0.15"
#THROTTLE_MAX: "0.15"
THROTTLE_MIN: "0.19"
THROTTLE_MAX: "0.19"
--- ---
@ -58,9 +58,17 @@ data:
################ ################
# STEERING PWM # # STEERING PWM #
################ ################
STEERING_LEFT_PWM: "1002" STEERING_LEFT_PWM: "1000"
STEERING_RIGHT_PWM: "1985" STEERING_RIGHT_PWM: "1985"
STEERING_CENTER_PWM: "1491" STEERING_CENTER_PWM: "1492"
############################
# STEERING PWM - SECOND RC #
############################
STEERING_SECONDARY_LEFT_PWM: "1119"
STEERING_SECONDARY_RIGHT_PWM: "2141"
STEERING_SECONDARY_CENTER_PWM: "1641"
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -70,12 +78,17 @@ data:
################ ################
# THROTTLE PWM # # THROTTLE PWM #
################ ################
#THROTTLE_MIN_PWM: "1092" THROTTLE_MIN_PWM: "994"
#THROTTLE_MAX_PWM: "1986" THROTTLE_MAX_PWM: "1979"
#THROTTLE_ZERO_PWM: "1583" THROTTLE_ZERO_PWM: "1484"
THROTTLE_MIN_PWM: "960"
THROTTLE_MAX_PWM: "1949" ###########################
THROTTLE_ZERO_PWM: "1452" # THROTTLE PWM - SECOND RC #
############################
THROTTLE_SECONDARY_MIN_PWM: "994"
THROTTLE_SECONDARY_MAX_PWM: "1975"
THROTTLE_SECONDARY_ZERO_PWM: "1506"
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -123,3 +136,48 @@ metadata:
name: robocar-road name: robocar-road
data: data:
HORIZON: "20" HORIZON: "20"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: steering
data:
grid.json: |
{
"steering_steps": [ -1, -0.66, -0.33, 0, 0.33, 0.66, 1],
"distance_steps": [ 0, 0.3, 0.4, 0.5, 0.8, 1],
"data": [
[ 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0],
[ 0, 0, 0.25, -0.25, 0, 0],
[ 0, 0.25, 0.5, -0.5, -0.25, 0],
[ 0.25, 0.5, 1, -1, -0.5, -0.25]
]
}
"omf.json": |
{
"steering_steps":[-1, -0.66, -0.33, 0, 0.33, 0.66, 1],
"distance_steps": [0, 0.2, 0.4, 0.6, 0.8, 1],
"data": [
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0.25, 0, 0, -0.25, 0],
[0.5, 0.25, 0, 0, -0.5, -0.25]
]
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: android
data:
thresholds.json: |
{
"threshold_steps": [ 0.07, 0.08, 0.09, 0.1, 0.125, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 ],
"min_valid": 500,
"data": [ 8700, 4800, 3500, 2550, 1850, 1387, 992, 840, 750, 700, 655, 620, 590, 570, 553, 549, 548 ]
}

View File

@ -28,17 +28,31 @@ spec:
- "--steering-left-pwm=$(STEERING_LEFT_PWM)" - "--steering-left-pwm=$(STEERING_LEFT_PWM)"
- "--steering-right-pwm=$(STEERING_RIGHT_PWM)" - "--steering-right-pwm=$(STEERING_RIGHT_PWM)"
- "--steering-center-pwm=$(STEERING_CENTER_PWM)" - "--steering-center-pwm=$(STEERING_CENTER_PWM)"
- "--throttle-zero-pwm=$(THROTTLE_ZERO_PWM)" - "--steering-secondary-left-pwm=$(STEERING_SECONDARY_LEFT_PWM)"
- "--steering-secondary-right-pwm=$(STEERING_SECONDARY_RIGHT_PWM)"
- "--steering-secondary-center-pwm=$(STEERING_SECONDARY_CENTER_PWM)"
- "--throttle-min-pwm=$(THROTTLE_MIN_PWM)" - "--throttle-min-pwm=$(THROTTLE_MIN_PWM)"
- "--throttle-max-pwm=$(THROTTLE_MAX_PWM)" - "--throttle-max-pwm=$(THROTTLE_MAX_PWM)"
- "--throttle-center-pwm=$(THROTTLE_ZERO_PWM)"
- "--throttle-secondary-min-pwm=$(THROTTLE_SECONDARY_MIN_PWM)"
- "--throttle-secondary-max-pwm=$(THROTTLE_SECONDARY_MAX_PWM)"
- "--throttle-secondary-center-pwm=$(THROTTLE_SECONDARY_ZERO_PWM)"
- '--throttle-feedback-config=/etc/robocar/thresholds.json'
- "-log=info" - "-log=info"
volumeMounts: volumeMounts:
- mountPath: "/dev/ttyAMA0" - mountPath: "/dev/ttyAMA0"
name: serial name: serial
- mountPath: "/etc/robocar"
name: robocar
securityContext: securityContext:
privileged: true privileged: true
runAsUser: 1234 runAsUser: 1234
runAsGroup: 20 # Set 20/dialout group to access to serial device runAsGroup: 20 # Set 20/dialout group to access to serial device
envFrom:
- configMapRef:
name: robocar-throttle-pwm
- configMapRef:
name: robocar-steering-pwm
env: env:
- name: MQTT_BROKER - name: MQTT_BROKER
valueFrom: valueFrom:
@ -77,39 +91,13 @@ spec:
configMapKeyRef: configMapKeyRef:
key: MQTT_TOPIC_RC_SWITCH_RECORD key: MQTT_TOPIC_RC_SWITCH_RECORD
name: robocar name: robocar
- name: MQTT_TOPIC_THROTTLE_FEEDBACK
valueFrom:
configMapKeyRef:
name: robocar
key: MQTT_TOPIC_THROTTLE_FEEDBACK
- name: MQTT_QOS - name: MQTT_QOS
value: "0" value: "0"
- name: STEERING_LEFT_PWM
valueFrom:
configMapKeyRef:
name: robocar-steering-pwm
key: STEERING_LEFT_PWM
- name: STEERING_RIGHT_PWM
valueFrom:
configMapKeyRef:
name: robocar-steering-pwm
key: STEERING_RIGHT_PWM
- name: STEERING_CENTER_PWM
valueFrom:
configMapKeyRef:
name: robocar-steering-pwm
key: STEERING_CENTER_PWM
- name: THROTTLE_MIN_PWM
valueFrom:
configMapKeyRef:
name: robocar-throttle-pwm
key: THROTTLE_MIN_PWM
- name: THROTTLE_MAX_PWM
valueFrom:
configMapKeyRef:
name: robocar-throttle-pwm
key: THROTTLE_MAX_PWM
- name: THROTTLE_ZERO_PWM
valueFrom:
configMapKeyRef:
name: robocar-throttle-pwm
key: THROTTLE_ZERO_PWM
- name: TZ - name: TZ
value: "Europe/Paris" value: "Europe/Paris"
volumes: volumes:
@ -117,6 +105,9 @@ spec:
hostPath: hostPath:
path: /dev/ttyAMA0 path: /dev/ttyAMA0
type: CharDevice type: CharDevice
- name: robocar
configMap:
name: android
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
@ -328,6 +319,13 @@ spec:
image: docker.io/cyrilix/robocar-steering image: docker.io/cyrilix/robocar-steering
args: args:
- "-mqtt-retain=false" - "-mqtt-retain=false"
- "--image-width=$(IMAGE_WIDTH)"
- "--image-height=$(IMAGE_HEIGHT)"
- "--enable-objects-correction=true"
- "--enable-objects-correction-user=false"
- "--grid-map-config=/etc/robocar/grid.json"
- "--objects-move-factors-config=/etc/robocar/omf.json"
- "--delta-middle=0.1"
- "-log=info" - "-log=info"
securityContext: securityContext:
runAsUser: 1234 runAsUser: 1234
@ -370,10 +368,32 @@ spec:
configMapKeyRef: configMapKeyRef:
key: MQTT_TOPIC_RC_DRIVE_MODE key: MQTT_TOPIC_RC_DRIVE_MODE
name: robocar name: robocar
- name: MQTT_TOPIC_OBJECTS
valueFrom:
configMapKeyRef:
key: MQTT_TOPIC_OBJECTS
name: robocar
- name: MQTT_QOS - name: MQTT_QOS
value: "0" value: "0"
- name: IMAGE_WIDTH
valueFrom:
configMapKeyRef:
key: CAMERA_WIDTH
name: robocar-camera
- name: IMAGE_HEIGHT
valueFrom:
configMapKeyRef:
key: CAMERA_HEIGHT
name: robocar-camera
- name: TZ - name: TZ
value: "Europe/Paris" value: "Europe/Paris"
volumeMounts:
- mountPath: /etc/robocar
name: robocar-configs
volumes:
- name: robocar-configs
configMap:
name: steering
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment

View File

@ -10,7 +10,7 @@ resources:
images: images:
- name: docker.io/cyrilix/robocar-arduino - name: docker.io/cyrilix/robocar-arduino
newTag: v0.8.0 newTag: v0.8.0-6-gadb38c3
- name: docker.io/cyrilix/robocar-led - name: docker.io/cyrilix/robocar-led
newTag: v0.5.1 newTag: v0.5.1
@ -29,7 +29,7 @@ images:
newTag: v0.2.1 newTag: v0.2.1
- name: docker.io/cyrilix/robocar-steering - name: docker.io/cyrilix/robocar-steering
newTag: v0.5.1 newTag: v0.5.1-24-g424b697
- name: docker.io/cyrilix/robocar-road - name: docker.io/cyrilix/robocar-road
newTag: v0.2.0 newTag: v0.2.0