-
Notifications
You must be signed in to change notification settings - Fork 11k
remote body teleop from connect support #38011
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
Merged
+102
−21
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
00107b5
athenad and webrtcd updates
stefpi fe36daf
remove feature stream services from webrtcd split
stefpi 49af84c
remove cors
stefpi ab7795e
clean
stefpi d3ff632
remove unused
stefpi 503b085
remove extra try except
stefpi e860431
add back exception trace
stefpi cc0a8c0
clean diff
stefpi 0f38abe
clean diff
stefpi 1c32d41
add testJoystick only on body
stefpi be391a1
fix camera list
stefpi 2170f6b
remove reference to future service
stefpi 2606a4f
Merge branch 'master' into split/athenad-webrtcd
stefpi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ | |
| create_connection) | ||
|
|
||
| import cereal.messaging as messaging | ||
| from cereal import log | ||
| from cereal import car, log | ||
| from cereal.services import SERVICE_LIST | ||
| from openpilot.common.api import Api, get_key_pair | ||
| from openpilot.common.utils import CallbackReader, get_upload_stream | ||
|
|
@@ -44,6 +44,7 @@ | |
| ATHENA_HOST = os.getenv('ATHENA_HOST', 'wss://athena.comma.ai') | ||
| HANDLER_THREADS = int(os.getenv('HANDLER_THREADS', "4")) | ||
| LOCAL_PORT_WHITELIST = {22, } # SSH | ||
| WEBRTCD_PORT = 5001 | ||
|
|
||
| LOG_ATTR_NAME = 'user.upload' | ||
| LOG_ATTR_VALUE_MAX_UNIX_TIME = int.to_bytes(2147483647, 4, sys.byteorder) | ||
|
|
@@ -536,6 +537,16 @@ def getSshAuthorizedKeys() -> str: | |
| def getGithubUsername() -> str: | ||
| return cast(str, Params().get("GithubUsername") or "") | ||
|
|
||
|
|
||
| @dispatcher.add_method | ||
| def getNotCar() -> bool: | ||
|
Comment on lines
+541
to
+542
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. side note: we should probably come up with a better name than notCar... at the very least the negative is confusing |
||
| cp_bytes = Params().get("CarParamsPersistent") | ||
| if cp_bytes is not None: | ||
| with car.CarParams.from_bytes(cp_bytes) as CP: | ||
| return CP.notCar | ||
| return False | ||
|
|
||
|
|
||
| @dispatcher.add_method | ||
| def getSimInfo(): | ||
| return HARDWARE.get_sim_info() | ||
|
|
@@ -557,6 +568,35 @@ def getNetworks(): | |
| return HARDWARE.get_networks() | ||
|
|
||
|
|
||
| @dispatcher.add_method | ||
| def startStream(sdp: str) -> dict: | ||
| from openpilot.system.webrtc.webrtcd import StreamRequestBody | ||
| bridge_services_in = [] | ||
|
|
||
| # get live car params to avoid stale notCar edge case | ||
| cp_bytes = Params().get("CarParams") | ||
| if cp_bytes is not None: | ||
| with car.CarParams.from_bytes(cp_bytes) as CP: | ||
| if CP.notCar: | ||
| bridge_services_in.append("testJoystick") | ||
|
|
||
| body = StreamRequestBody(sdp, ["driver"], bridge_services_in, ["carState"]) | ||
| try: | ||
| resp = requests.post(f"http://localhost:{WEBRTCD_PORT}/stream", | ||
| json=asdict(body), timeout=10) | ||
| if not resp.ok: | ||
| try: | ||
| error_body = resp.json() | ||
| raise Exception(error_body.get("message", f"webrtcd returned {resp.status_code}")) | ||
| except ValueError: | ||
| resp.raise_for_status() | ||
| return resp.json() | ||
| except requests.ConnectTimeout as e: | ||
| raise Exception("webrtc took too long to respond. is it on?") from e | ||
| except requests.ConnectionError as e: | ||
| raise Exception("webrtc is not running. turn on comma body ignition.") from e | ||
|
|
||
|
|
||
| @dispatcher.add_method | ||
| def takeSnapshot() -> str | dict[str, str] | None: | ||
| from openpilot.system.camerad.snapshot import jpeg_write, snapshot | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.