joystickd: split into joystickd and joystick_control (#33632)

* Split joystickd into joystickd and joystick_control

* Update process config

* Undeprecate testJoystick

* Static analysis fixes

* Mark as +x

* Update README

* Add testJoystick back to services

* reset if testJoystick not received

* Fix quotes

* Remove self

* Add a send thread instead

* Add joystick_control into process config

* Add main

* Add additional condition

* Fix imports
This commit is contained in:
Kacper Rączy
2024-09-23 20:47:28 -07:00
committed by GitHub
parent 251e2e9400
commit d82c4509ea
7 changed files with 185 additions and 138 deletions
+10 -2
View File
@@ -1,4 +1,5 @@
import os
import operator
from cereal import car
from openpilot.common.params import Params
@@ -53,6 +54,12 @@ def only_onroad(started: bool, params, CP: car.CarParams) -> bool:
def only_offroad(started, params, CP: car.CarParams) -> bool:
return not started
def or_(*fns):
return lambda *args: operator.or_(*(fn(*args) for fn in fns))
def and_(*fns):
return lambda *args: operator.and_(*(fn(*args) for fn in fns))
procs = [
DaemonProcess("manage_athenad", "system.athena.manage_athenad", "AthenadPid"),
@@ -75,8 +82,8 @@ procs = [
NativeProcess("pandad", "selfdrive/pandad", ["./pandad"], always_run, enabled=False),
PythonProcess("calibrationd", "selfdrive.locationd.calibrationd", only_onroad),
PythonProcess("torqued", "selfdrive.locationd.torqued", only_onroad),
PythonProcess("controlsd", "selfdrive.controls.controlsd", not_joystick),
PythonProcess("joystickd", "tools.joystick.joystickd", joystick),
PythonProcess("controlsd", "selfdrive.controls.controlsd", and_(not_joystick, iscar)),
PythonProcess("joystickd", "tools.joystick.joystickd", or_(joystick, notcar)),
PythonProcess("selfdrived", "selfdrive.selfdrived.selfdrived", only_onroad),
PythonProcess("card", "selfdrive.car.card", only_onroad),
PythonProcess("deleter", "system.loggerd.deleter", always_run),
@@ -100,6 +107,7 @@ procs = [
NativeProcess("bridge", "cereal/messaging", ["./bridge"], notcar),
PythonProcess("webrtcd", "system.webrtc.webrtcd", notcar),
PythonProcess("webjoystick", "tools.bodyteleop.web", notcar),
PythonProcess("joystick", "tools.joystick.joystick_control", and_(joystick, iscar)),
]
managed_processes = {p.name: p for p in procs}
+1 -1
View File
@@ -50,7 +50,7 @@ class TestStreamSession:
tested_msgs = [
{"type": "customReservedRawData0", "data": "test"}, # primitive
{"type": "can", "data": [{"address": 0, "dat": "", "src": 0}]}, # list
{"type": "testJoystickDEPRECATED", "data": {"axes": [0, 0], "buttons": [False]}}, # dict
{"type": "testJoystick", "data": {"axes": [0, 0], "buttons": [False]}}, # dict
]
mocked_pubmaster = mocker.MagicMock(spec=messaging.PubMaster)