Skip to content

Commit

Permalink
Updated with world info generation directly from unreal engine (#305)
Browse files Browse the repository at this point in the history
* Merge main

* Delete src/scenic/simulators/airsim directory

* Delete examples/airsim directory

* fixed

* fixed1

* added new files

* added docs

* Update docs/simulators.rst

Co-authored-by: Daniel Fremont <[email protected]>

* Update docs/simulators.rst

Co-authored-by: Daniel Fremont <[email protected]>

* Update docs/simulators.rst

Co-authored-by: Daniel Fremont <[email protected]>

* Update docs/simulators.rst

Co-authored-by: Daniel Fremont <[email protected]>

* resolved issues

---------

Co-authored-by: Daniel Fremont <[email protected]>
Co-authored-by: Daniel He <[email protected]>
  • Loading branch information
3 people authored Oct 8, 2024
1 parent 86d2945 commit 524b391
Show file tree
Hide file tree
Showing 132 changed files with 6,260 additions and 2,316 deletions.
9 changes: 8 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# .coveragerc to control coverage.py
[run]
branch = True
omit =
src/scenic/simulators/webots/WBT*.py
src/scenic/simulators/carla/*
src/scenic/simulators/gta/*
src/scenic/simulators/lgsvl/*
src/scenic/simulators/webots/*
src/scenic/simulators/xplane/*

[report]
# Regexes for lines to exclude from consideration
Expand All @@ -20,3 +25,5 @@ exclude_lines =
@(abc\.)?abstractmethod

ignore_errors = True
show_missing = True
precision = 2
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# .git-blame-ignore-revs
# Ran isort and black on the whole codebase
360c67fab09d172498b3014510ee3658643d12da
# Ran black with 2024 stable style
c6c83f95ff370b75c3ee7130dbd8071bfe8b285a
# Cleaned up test quote spacing
995cd182924dc9e3dbbc941c5b75454ea0cdaaca
76 changes: 76 additions & 0 deletions .github/ISSUE_TEMPLATE/1-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Bug Report
description: Create a report to help us reproduce and fix a bug
labels:
- "type: bug"
- "status: triage"

body:
- type: markdown
attributes:
value: >
#### Thank you for contributing! Before reporting a bug, please make sure it has no duplicate and has not already been addressed by searching through [the existing and past issues](https://github.com/BerkeleyLearnVerify/Scenic/issues)
- type: textarea
attributes:
label: System Details
description: |
Please provide the following system information to help us diagnose the bug.
1. Python Version (e.g. Python 3.11.7)
2. Scenic Version (e.g. Scenic 3.0.0b2)
3. Operating System / Platform (e.g. Apple M2 Pro macOS Sonoma 14.2.1)
4. Simulator Version (Optional, only applies if bug is simulator specific) (e.g. CARLA 0.9.14)
placeholder: |
1. Python Version: `python --version`
2. Scenic Version: `scenic --version`
3. Operating System / Platform: get from system preferences
4. Simulator Version: simulator version
validations:
required: true

- type: textarea
attributes:
label: Detailed Description
description: |
Please provide a clear and concise description of what the bug is and paste the error log below.
1. Clear and concise description of the bug
2. `scenic` command you ran locally (e.g. `scenic test.scenic --count 1 -b`, etc.). Please rerun your simulation error with the **`-b`** parameter for a full stack trace.
3. Error log. It helps improving readability if the error log is wrapped in ```triple quotes blocks```.
placeholder: |
1. Scenic has a bug
2. `scenic test.scenic -b`
3. Error Log
```
# error full stack trace
```
validations:
required: true

- type: textarea
attributes:
label: Steps To Reproduce
description: |
Please provide a minimal example to help us reproduce the bug. Code should be wrapped with ```triple quotes blocks``` to improve readability.
If it is not possible to reproduce the bug with a short self-contained Scenic or Python file, for example if a specific mesh is required, you can attach any required files below or include a link to them.
If possible/applicable, please specify a seed that will reproduce the issue by running scenic with the seed argument: `scenic -s SEED, --seed SEED random seed`
placeholder: |
1. First step to reproduce bug
2. Second step, etc
...
```
# sample code to reproduce the bug
```
validations:
required: true

- type: checkboxes
attributes:
label: Issue Submission Checklist
options:
- label: I am reporting an issue, not asking a question
required: true
- label: I checked the open and closed issues, forum, etc. and have not found any solution
- label: I have provided all necessary code, etc. to reproduce the issue
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/2-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Documentation
description: Report an issue or enhancement related to https://docs.scenic-lang.org/
labels:
- "type: documentation"
- "status: triage"

body:
- type: markdown
attributes:
value: >
#### Thank you for contributing! Before submitting a doc issue, please make sure it has no duplicate and has not already been addressed by searching through [the existing and past open and closed issues](https://github.com/BerkeleyLearnVerify/Scenic/issues)
- type: textarea
attributes:
label: Describe the doc issue or enhancement
description: >
Please provide a clear and concise description of what content in https://docs.scenic-lang.org/ has an issue or needs enhancement.
placeholder: |
Link to location in the docs: https://docs.scenic-lang.org/
validations:
required: true

- type: textarea
attributes:
label: Fix suggestion
description: >
Tell us how we could improve the documentation in this regard.
- type: checkboxes
attributes:
label: Issue Submission Checklist
options:
- label: I am reporting an issue, not asking a question
required: true
- label: I checked the open and closed issues, forum, etc. and have not found any solution
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/3-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Feature Request
description: Submit a request for new Scenic features
labels:
- "type: feature"
- "status: triage"

body:
- type: markdown
attributes:
value: >
#### Thank you for contributing! Before submitting a feature request, please make sure it has no duplicate and has not already been addressed by searching through [the existing and past open and closed issues](https://github.com/BerkeleyLearnVerify/Scenic/issues)
- type: textarea
attributes:
label: Describe the feature and motivation
description: |
Please provide a clear and concise proposal of the feature and outline the motivation.
validations:
required: true

- type: textarea
attributes:
label: Additional context
description: |
Add any other context, such as pseudo code, links, diagrams, screenshots, to help the community better understand the feature request.
- type: checkboxes
attributes:
label: Issue Submission Checklist
options:
- label: I checked the open and closed issues, forum, etc. and have not found any solution
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Questions
url: https://forum.scenic-lang.org/
about: Post your questions on our community forum
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Description
<!-- Provide a brief description of the changes introduced by this pull request -->

### Issue Link
<!-- Provide a link to the related issue on GitHub or another issue tracking system -->

### Checklist
- [ ] I have tested the changes locally via `pytest` and/or other means
- [ ] I have added or updated relevant documentation
- [ ] I have autoformatted the code with black and isort
- [ ] I have added test cases (if applicable)

### Additional Notes
<!-- Add any additional information or context about the pull request -->
<!-- Optionally reference a Jira ticket using the following format: [SCENIC-123] -->
49 changes: 49 additions & 0 deletions .github/check_latest_simulators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import os
import re

import requests

SIMULATORS = ["carla", "webots"]
SIMULATOR_URLS = {
"carla": "https://github.com/carla-simulator/carla/releases/latest",
"webots": "https://github.com/cyberbotics/webots/releases/latest",
}
SIMULATORS_REGEXES = {
"carla": 'carla-simulator/carla/releases/tag/([^"]+)',
"webots": 'cyberbotics/webots/releases/tag/([^"]+)',
}


def check_path_exists(version, simulator):
path = f"/software/{simulator}{version}"
if os.path.exists(path):
print(f"Latest {simulator} version {version} already present on the machine.\n")
else:
s = """
_
_ _____ ________ (_)__ ___ _
| |/|/ / _ `/ __/ _ \/ / _ \/ _ `/
|__,__/\_,_/_/ /_//_/_/_//_/\_, /
/___/
"""
print(s)
print(
f"A new {simulator} version ({version}) needs to be installed and tested in CI.\n"
)


def version_check(regex_match, sim_name):
try:
version = regex_match.group(1)
except AttributeError:
print(f"Error: Unable to find the latest {sim_name} version using regex.")
else:
check_path_exists(version, sim_name)


for sim in SIMULATORS:
print(f"Checking for {sim}...")
url = SIMULATOR_URLS[sim]
response = requests.get(url)
regex_match = re.search(SIMULATORS_REGEXES[sim], response.text)
version_check(regex_match, sim)
70 changes: 70 additions & 0 deletions .github/slack_oncall_reminder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import argparse

import requests
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError


def save_users(users_array):
users = {}
for user in users_array:
# NOTE: some apps, slackbots do not have emails to map to
profile = user["profile"]
if "email" in profile.keys():
user_email = profile["email"]
username = user_email.split("@")[0]
users[username] = user
return users


def grab_whos_on_call(OPS_GENIE_API_TOKEN, ROTATION_SCHEDULE_ID):
url = f"https://api.opsgenie.com/v2/schedules/{ROTATION_SCHEDULE_ID}/on-calls"
headers = {"Authorization": f"GenieKey {OPS_GENIE_API_TOKEN}"}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
else:
print(f"Request failed with status code {response.status_code}")
print("Response content:")
print(response.content.decode("utf-8"))
return data["data"]["onCallParticipants"][0]["name"].split("@")[0]


def postSlackMessage(client, CHANNEL_ID, OPS_GENIE_API_TOKEN, ROTATION_SCHEDULE_ID):
try:
result = client.users_list()
users = save_users(result["members"])
on_call = grab_whos_on_call(OPS_GENIE_API_TOKEN, ROTATION_SCHEDULE_ID)
slack_id = users[on_call]["id"]

result = client.chat_postMessage(
channel=CHANNEL_ID,
text=f"""🛠️Maintenance On-Call: <@{slack_id}>, you will be on-call for the next week. Resources:\n
📖 <https://https://scenic-lang.atlassian.net/l/cp/cnaQtVXY|On Call Best Practices>
🔍 <https://scenic-lang.atlassian.net/l/cp/jR0CifEf|Issue Triage Guide>
📊 <https://scenic-lang.atlassian.net/jira/software/projects/SCENIC/boards/1|Jira Board to monitor active workstreams>
📋 <https://scenic-lang.atlassian.net/jira/software/projects/SCENIC/boards/1/backlog?epics=visible|Jira Backlog to monitor issues that need triaging>
🔧 <https://github.com/BerkeleyLearnVerify/Scenic/issues|Scenic GitHub Issues>
""",
)
except SlackApiError as e:
print(f"SlackAPIError: {e}")


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Script that notifies on-call rotation daily"
)
parser.add_argument("--slack_api_token", required=True, type=str)
parser.add_argument("--ops_genie_api_token", required=True, type=str)
args = parser.parse_args()

SLACK_API_TOKEN = args.slack_api_token
OPS_GENIE_API_TOKEN = args.ops_genie_api_token
# NOTE: Feel free to grab the relevant channel ID to post the message to but ensure the App is installed within the channel
CHANNEL_ID = "C06N9KJHN2J"
# NOTE: Rotation schedule is grabbed directly from within the OpsGenie site
ROTATION_SCHEDULE_ID = "904cd122-f269-418d-8c29-3e6751716bae"

client = WebClient(token=SLACK_API_TOKEN)
postSlackMessage(client, CHANNEL_ID, OPS_GENIE_API_TOKEN, ROTATION_SCHEDULE_ID)
30 changes: 30 additions & 0 deletions .github/workflows/on-call-reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: on_call_reminder

on:
schedule:
- cron: '0 17 * * 3' # Runs every Wednesday at 9am PST (17:00 UTC)
workflow_dispatch: # Allows manual triggering of the workflow

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests slack_sdk argparse
- name: Run Python script
env:
SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
OPS_GENIE_API_TOKEN: ${{ secrets.OPS_GENIE_API_TOKEN }}
run: python .github/slack_oncall_reminder.py --slack_api_token $SLACK_API_TOKEN --ops_genie_api_token $OPS_GENIE_API_TOKEN
Loading

0 comments on commit 524b391

Please sign in to comment.