autorope / donkeycar

Open source hardware and software platform to build a small scale self driving car.
http://www.donkeycar.com
MIT License
3.05k stars 1.28k forks source link

The WebUI's steering and throttle bars should update in autopilot modes and when using a bluetooth game controller in user mode. #1188

Open Ezward opened 3 weeks ago

Ezward commented 3 weeks ago

The throttle and steering bars on the webui update in realtime when in using the on-screen joystick or a web-connected game controller, but NOT when using a bluetooth game controller and NOT in auto-pilot or auto-steering mode. I think there are two things that need to change to make the steering and throttle bars update correctly in all modes:

  1. The javascript UpdateUI() function currently only updates the bars with the throttle and steering values generated by the on-screen joypad or a browser-connected game controller.
    • WebsocketDriveApi needs to accept changes in throttle and steering and use those values to set self.angle and self.throttle with changes from the server. NOTE: It already does this.
    • UpdateUI must be changed to get the steering and throttle values from self.angle and self.throttle respectively, rather than directly from the on-screen joypad.
  2. The server python code must send steering and throttle updates to websocket clients.
    • The LocalWebController.run_threaded() method must accept the throttle and steering values (the final values chosen based on the drive mode) so it can send changes to the connected websocket clients.
    • The place where the LocalWebController is added must be updated to include the inputs throttle and steering as output by DriveMode so that the values are passed to the run_threaded() method when it is called.