{"id":22063150,"url":"https://github.com/sshane/opparams","last_synced_at":"2025-05-12T23:05:22.243Z","repository":{"id":117899696,"uuid":"234846927","full_name":"sshane/opParams","owner":"sshane","description":"A parameter manager for openpilot supporting live updating and a tuning interface","archived":false,"fork":false,"pushed_at":"2021-05-03T03:18:30.000Z","size":1012,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T23:05:11.041Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sshane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-19T05:42:42.000Z","updated_at":"2025-04-22T18:02:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"57a520b7-c7b6-40f5-b78f-2962cc0824ed","html_url":"https://github.com/sshane/opParams","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshane%2FopParams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshane%2FopParams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshane%2FopParams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshane%2FopParams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshane","download_url":"https://codeload.github.com/sshane/opParams/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253837405,"owners_count":21971983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T18:29:32.609Z","updated_at":"2025-05-12T23:05:22.231Z","avatar_url":"https://github.com/sshane.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opParams parameter manager\n\nThis repo is just a backup of op_params. To install into your own fork, just grab the files in the [`openpilot`](/openpilot) folder and place them into your repository in their respective directories.\n\n1. Make sure you add your new parameter to [`op_params.py`](/openpilot/common/op_params.py) filling out the `default`, `allowed_types`, and `live` keys. **(Update: allowed types, description, and live are no longer required but recommended if you want to give your users the ability to change parameters safely and easily. Live is assumed to be False by default if not specified. `default` is still required!)**\n   * You can also change the read, or update frequency in that file for live tuning.\n2. In the file you want to receive updates, use this code in place of the variable you want to use.\n   * So for camera offset, we can do this in `lane_planner.py`:\n   ```python\n   from common.op_params import opParams\n   op_params = opParams()\n   CAMERA_OFFSET = op_params.get('camera_offset')\n   ```\n3. Param class arguments explaination:\n   - `Param(1., NUMBER)`: No matter how often you use opParams's `.get()` function on this param, it will update only once per 10 seconds (customizable in the base `Param` class).\n   - `Param(1., NUMBER, live=True)`: Same thing as above, but the update frequency is reduced to 1 second. It also will show up in opEdit in the special **live!** menu.\n   - `Param(False, bool, static=True)`: Only specifying `static=True` tells opParams to never refresh its value from the file it's stored in. Great for a toggle used on openpilot startup. It's only read on opParams initialization.\n4. **Important**: for variables you want to be live tunable, you need to use the `op_params.get()` function to set the variable on each update. So for example, with classes, you need to initialize opParams and the variable in the `__init__` function, and then in the class's update function, set it again at the top. Here's a fake example for longcontrol.py:\n```python\nfrom common.op_params import opParams\n\n\nclass LongControl():\n  def __init__():\n    self.op_params = opParams()  # always init opParams first\n    self.your_live_tunable_variable = self.op_params.get('whatever_param')  # initializes the variable\n  \n  def update(stuff...):\n    self.your_live_tunable_variable = self.op_params.get('whatever_param')  # and this updates it as you tune. will not update live if you don't occasionally call .get() on your parameter.\n    \n    # then we use the variable down here...\n```\n\n4. Now to change live parameters over ssh, you can connect to your EON with your WiFi hotspot, then change directory to `/data/openpilot` and run `python op_edit.py` (which now fully supports live tuning). It's important to make sure you set `'live'` to `True` for any parameters you want to be live.\n   * Here's an ***old*** gif of the tuner:\n\n\u003cimg src=\"gifs/op_tune.gif?raw=true\" width=\"600\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshane%2Fopparams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshane%2Fopparams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshane%2Fopparams/lists"}