Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

970 enable rc controller in webui #985

Merged
merged 10 commits into from Feb 1, 2022
Merged

Conversation

Ezward
Copy link
Contributor

@Ezward Ezward commented Jan 23, 2022

Addresses Issue #973 and Issue #972

For issue #973:

  • the web, RC and game controllers now the the user/mode and recording state as inputs and use them as defaults for their own internal state.
  • the controllers also latch any changes they make to that state in their background thread, so it can be applied to outputs in the foreground thread (in run_threaded())
  • those change synchronize changes between those controller in the server. However, we also needed to make those changes get reflected in the browser ui. So the local web controller was change to send any changes in state to the browser client via the websocket, so the web client and apply them and update the web ui.

For Issue #972:

  • I updated the drive mode selections to User, Full Auto and Auto Steering. I chose not to use the suggest of Auto Steering and Manual Throttle because it was too long for the ui.

In addition I added an explanation of the keyboard shortcuts for change the drive mode and recording in the web ui to the model help popup.

Ezward and others added 8 commits January 14, 2022 18:48
#973
Now controllers take mode and recording as inputs
and use those as defaults.  The idea is that if
one of the controllers get's user input that
changes that state, then it get's propagated
to the next controller via these defaults.
- web.py will send websocket message with changes to the client
- client will iterate through the changes and update fields in state
- If state actually changed then client we redraw the UI
- The python code uses 3 modes; 'local', 'user', 'local_angle'
- The web code has the same functional modes, but calls
  them 'auto', 'user', 'auto_angle'.
- So when the server sends a mode change to the javascript
  client it does not sync correctly because of the name
  differences.  This commit makes them match.
- the mode change in the controller was getting overridden by the pass-through default
- now we latch the change in the controller and if the latch has a value in run_threaded, then we use that rather than the pass-through default.
- this change fixes the process that changes the webui when the user changes the mode with a controller button.
- added code to latch changes in the background thread
  and then commit them in run_threaded().

- added code to send only changed state from web to server,
  so we are not overwriting unchanged state.

- now the drive mode can be changes with either the web ui
  or the game controller and it will be correctly syncronized
  and reflected in the webui.

- added help for user mode shortcut keys in web controller.
Copy link
Contributor

@DocGarbanzo DocGarbanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, only minor comment

logger.debug(f"Updating web client: {data_str}")
wsclient.write_message(data_str)
except Exception as e:
print(e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a logger error.

Copy link
Contributor

@DocGarbanzo DocGarbanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you.

@DocGarbanzo DocGarbanzo merged commit a0eb5df into dev Feb 1, 2022
@Ezward Ezward deleted the 970-enable-RC-controller-in-webui branch February 28, 2022 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants