controlsd: require joystick mode param for the body (#30680)

* Update joystick mode in step

* Stop putting the body in joystick mode by default

* Toggle JoystickDebugMode by default for notCars in process_replay

* Remove subsection about web joystick

* Update param only in non-cars

* Make joystickDebug non-static event, and add it in a loop

* Add comment
old-commit-hash: e62756596b
chrysler-long2
Kacper Rączy 1 year ago committed by GitHub
parent f10d6d5738
commit 214b38bc69
  1. 15
      selfdrive/controls/controlsd.py
  2. 3
      selfdrive/test/process_replay/process_replay.py
  3. 11
      tools/joystick/README.md

@ -93,8 +93,7 @@ class Controls:
else:
self.CI, self.CP = CI, CI.CP
self.joystick_enabled = self.params.get_bool("JoystickDebugMode")
self.joystick_mode = self.joystick_enabled or self.CP.notCar
self.joystick_mode = self.params.get_bool("JoystickDebugMode")
# set alternative experiences from parameters
self.disengage_on_accelerator = self.params.get_bool("DisengageOnAccelerator")
@ -192,9 +191,6 @@ class Controls:
set_offroad_alert("Offroad_NoFirmware", True)
elif self.CP.passive:
self.events.add(EventName.dashcamMode, static=True)
elif self.joystick_mode:
self.events.add(EventName.joystickDebug, static=True)
self.startup_event = None
# controlsd is driven by can recv, expected at 100Hz
self.rk = Ratekeeper(100, print_delay_threshold=None)
@ -215,6 +211,11 @@ class Controls:
self.events.clear()
# Add joystick event, static on cars, dynamic on nonCars
if self.joystick_mode:
self.events.add(EventName.joystickDebug)
self.startup_event = None
# Add startup event
if self.startup_event is not None:
self.events.add(self.startup_event)
@ -371,7 +372,7 @@ class Controls:
else:
self.logged_comm_issue = None
if not (self.CP.notCar and self.joystick_enabled):
if not (self.CP.notCar and self.joystick_mode):
if not self.sm['lateralPlan'].mpcSolutionValid:
self.events.add(EventName.plannerError)
if not self.sm['liveLocationKalman'].posenetOK:
@ -853,6 +854,8 @@ class Controls:
self.is_metric = self.params.get_bool("IsMetric")
self.experimental_mode = self.params.get_bool("ExperimentalMode") and self.CP.openpilotLongitudinalControl
if self.CP.notCar:
self.joystick_mode = self.params.get_bool("JoystickDebugMode")
# Sample data from sockets and get a carState
CS = self.data_sample()

@ -749,6 +749,9 @@ def generate_params_config(lr=None, CP=None, fingerprint=None, custom_params=Non
if CP.openpilotLongitudinalControl:
params_dict["ExperimentalLongitudinalEnabled"] = True
if CP.notCar:
params_dict["JoystickDebugMode"] = True
return params_dict

@ -45,17 +45,6 @@ In order to use a joystick over the network, we need to run joystickd locally fr
tools/joystick/joystickd.py
```
### Web joystick on your mobile device
A browser-based virtual joystick designed for touch screens. Starts automatically when installed on comma body (non-car robotics platform).
For cars, start the web joystick service manually via SSH before starting the car.
```shell
tools/joystick/web.py
```
After starting the car/body, open the web joystick app at this URL: `http://[comma three IP address]:5000`
---
Now start your car and openpilot should go into joystick mode with an alert on startup! The status of the axes will display on the alert, while button statuses print in the shell.

Loading…
Cancel
Save