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

CI/Simulator: Add Metadrive test to CI #32352

Merged
merged 8 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/tools_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
run: |
${{ env.RUN }} "pytest tools/plotjuggler/"

simulator:
name: simulator
simulator_build:
name: simulator docker build
runs-on: ubuntu-latest
if: github.repository == 'commaai/openpilot'
timeout-minutes: 45
Expand All @@ -56,6 +56,28 @@ jobs:
run: |
selfdrive/test/docker_build.sh sim

simulator_driving:
name: simulator driving
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: git lfs pull
- uses: ./.github/workflows/setup-with-retry
- name: Build base docker image
run: eval "$BUILD"
- name: Build openpilot
run: |
${{ env.RUN }} "scons -j$(nproc)"
- name: Run bridge test
run: |
${{ env.RUN }} "export MAPBOX_TOKEN='pk.eyJ1Ijoiam5ld2IiLCJhIjoiY2xxNW8zZXprMGw1ZzJwbzZneHd2NHljbSJ9.gV7VPRfbXFetD-1OVF0XZg' && \
source selfdrive/test/setup_xvfb.sh && \
source selfdrive/test/setup_vsound.sh && \
CI=1 tools/sim/tests/test_metadrive_bridge.py"

devcontainer:
name: devcontainer
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion tools/sim/bridge/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, dual_camera, high_quality):
self.world: World | None = None

self.past_startup_engaged = False
self.startup_button_prev = True

def _on_shutdown(self, signal, frame):
self.shutdown()
Expand Down Expand Up @@ -161,7 +162,8 @@ def _run(self, q: Queue):

self.past_startup_engaged = True
elif not self.past_startup_engaged and controlsState.engageable:
self.simulator_state.cruise_button = CruiseButtons.DECEL_SET # force engagement on startup
self.simulator_state.cruise_button = CruiseButtons.DECEL_SET if self.startup_button_prev else CruiseButtons.MAIN # force engagement on startup
self.startup_button_prev = not self.startup_button_prev

throttle_out = throttle_op if self.simulator_state.is_engaged else throttle_manual
brake_out = brake_op if self.simulator_state.is_engaged else brake_manual
Expand Down
2 changes: 0 additions & 2 deletions tools/sim/tests/test_sim_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def test_engage(self):
while time.monotonic() < start_time + max_time_per_step:
sm.update()

q.put("cruise_down") # Try engaging

if sm.all_alive() and sm['controlsState'].active:
control_active += 1

Expand Down
Loading