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 + Testing + Bugfixes for path + misc. fixes + linting #81

Merged
merged 35 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c0fe133
Added tests
nandantumu Jun 19, 2023
7095945
Package architecture and setup fixes.
nandantumu Jun 23, 2023
461392c
Create lint.yml
nandantumu Jul 5, 2023
5d77c85
Update ci.yml
nandantumu Jul 5, 2023
fd0cd71
Update lint.yml
nandantumu Jul 5, 2023
075171f
Updated workflows to run on dev branches, added Pipfiles
nandantumu Jul 6, 2023
9e8c9c0
Formatting changes to tests
nandantumu Jul 6, 2023
9acf40d
refactored tests
nandantumu Jul 6, 2023
432b135
Update README.md
nandantumu Jul 8, 2023
b5e30bf
Update lint.yml
nandantumu Jul 8, 2023
1a75e4a
Merge remote-tracking branch 'origin/v1.0.0' into dev_ci_testing
nandantumu Aug 22, 2023
49ad609
Merge remote-tracking branch 'origin/v1.0.0' into dev_ci_testing
nandantumu Aug 22, 2023
2c3136c
Merge branch 'dev_ci_testing' of https://github.com/f1tenth/f1tenth_g…
nandantumu Aug 22, 2023
9886855
Updated tests to run headless
nandantumu Aug 22, 2023
4b0a126
Updated Dependencies
nandantumu Aug 22, 2023
3bfc1d9
Deleted duplicated tests
nandantumu Aug 22, 2023
cac50b9
Updated for linting.
nandantumu Aug 22, 2023
6fbd313
Updated requirements
nandantumu Aug 23, 2023
1a2a5c9
Fixed requirements, updated imports
nandantumu Aug 23, 2023
20231d2
Fixing some numba bugs
nandantumu Sep 28, 2023
6b68e7e
Fixed temp file access on windows. Now platform-agnostic.
nandantumu Sep 28, 2023
71bbf08
Fixed tests for track directory
nandantumu Sep 28, 2023
910f9a7
Linting changes
nandantumu Sep 28, 2023
81f069c
Fixed all linting errors.
nandantumu Sep 28, 2023
8e2b639
Only single track model error remains.
nandantumu Sep 28, 2023
69705d4
Tightened up testing matrices
nandantumu Sep 28, 2023
242b59b
Linting update
nandantumu Sep 28, 2023
46409e3
Update to install OpenGL on GH Actions
nandantumu Sep 28, 2023
927a59b
Fix CI render test
nandantumu Sep 28, 2023
8cfc9e6
Fixing test bug.
nandantumu Sep 28, 2023
63720d8
Fix bug on unix platforms.
nandantumu Sep 28, 2023
454eff7
remove script which do not contain any test
luigiberducci Oct 6, 2023
389e94a
remove duplicate utilities which shadow actual utilities to test
luigiberducci Oct 6, 2023
c9363c8
remove duplicate utilities which shadow actual utilities to test
luigiberducci Oct 6, 2023
bc3d6f2
Changes requested to PR #81:
nandantumu Oct 20, 2023
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
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: CI

on:
push:
branches: [ main ]
branches: [ main , 'v*', 'dev*']
pull_request:
branches: [ main ]
branches: [ main , 'v*' ]

permissions:
contents: read

jobs:
build:
Expand All @@ -13,17 +16,31 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9"]
python-version: ["3.9", "3.10", "3.11"]

steps:
- name: Install openGL
run: sudo apt install freeglut3-dev

- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Install
run: |
python -m pip install --upgrade pip
pip install -e .

- name: Test with pytest
run: |
pytest

44 changes: 44 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Linting Checks

on:
push:
branches: [ main , 'v*', 'dev_*']
pull_request:
branches: [ main , 'v*' ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Install
run: |
python -m pip install --upgrade pip
pip install -e .

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --statistics --exit-zero
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2020 Joseph Auckley, Matthew O'Kelly, Aman Sinha, Hongrui Zheng
Copyright (c) 2023 Hongrui Zheng, Renukanandan Tumu, Luigi Berducci, Ahmad Amine

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 32 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
gymnasium = "*"
numpy = "<1.25"
pillow = ">=9.0.1"
scipy = ">=1.7.3"
pyglet = "<1.5"
pyyaml = ">=5.3.1"
yamldataclassconfig = "*"
requests = "*"
pyopengl = "*"
numba = "*"
shapely = "*"
opencv-python = "*"
f110-gym = {file = "."}

[dev-packages]
flake8 = "*"
black = "*"
ipykernel = "*"
pytest = "*"
isort = "*"
autoflake = "*"
matplotlib = "*"

[requires]
python_version = "3.10"
python_full_version = "3.10.11"
1,380 changes: 1,380 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
![Python 3.8 3.9](https://github.com/f1tenth/f1tenth_gym/actions/workflows/ci.yml/badge.svg)
![Docker](https://github.com/f1tenth/f1tenth_gym/actions/workflows/docker.yml/badge.svg)
![Code Style](https://github.com/f1tenth/f1tenth_gym/actions/workflows/lint.yml/badge.svg)

# The F1TENTH Gym environment

This is the repository of the F1TENTH Gym environment.
Expand Down
72 changes: 33 additions & 39 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,88 +1,82 @@
# flake8: noqa
import os
import sys

import sphinx_rtd_theme

source_suffix = '.rst'
source_encoding = 'utf-8-sig'
source_suffix = ".rst"
source_encoding = "utf-8-sig"

# -- Language ----------------------------------------------------------------
env_tags = os.getenv('SPHINX_TAGS')
if env_tags != None:
for tag in env_tags.split(','):
print('Adding Sphinx tag: %s' % tag.strip())
env_tags = os.getenv("SPHINX_TAGS")
if env_tags is not None:
for tag in env_tags.split(","):
print("Adding Sphinx tag: %s" % tag.strip())
tags.add(tag.strip())

language = os.getenv('READTHEDOCS_LANGUAGE', 'en')
is_i18n = tags.has('i18n')
language = os.getenv("READTHEDOCS_LANGUAGE", "en")
is_i18n = tags.has("i18n")

# -- Theme -------------------------------------------------------------------
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
html_theme = 'sphinx_rtd_theme'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
if on_rtd:
using_rtd_theme = True
html_theme_options = {
# 'typekit_id': 'hiw1hhg',
# 'analytics_id': '',
# 'sticky_navigation': True # Set to False to disable the sticky nav while scrolling.
'logo_only': False, # if we have a html_logo below, this shows /only/ the logo with no title text
'collapse_navigation': False, # Collapse navigation (False makes it tree-like)
'prev_next_buttons_location': 'bottom',
"logo_only": False, # if we have a html_logo below, this shows /only/ the logo with no title text
"collapse_navigation": False, # Collapse navigation (False makes it tree-like)
"prev_next_buttons_location": "bottom",
# 'display_version': True, # Display the docs version
# 'navigation_depth': 4, # Depth of the headers shown in the navigation bar
}
html_context = {
"display_github": not is_i18n, # Integrate GitHub
"github_user": "f1tenth", # Username
"github_repo": "f1tenth_gym", # Repo name
"github_version": "exp_py", # Version
"conf_py_path": "/docs/", # Path in the checkout to the docs root
"display_github": not is_i18n, # Integrate GitHub
"github_user": "f1tenth", # Username
"github_repo": "f1tenth_gym", # Repo name
"github_version": "exp_py", # Version
"conf_py_path": "/docs/", # Path in the checkout to the docs root
}

html_favicon = 'assets/f1_stickers_02.png'
html_favicon = "assets/f1_stickers_02.png"

html_css_files = [
'css/custom.css'
]
html_css_files = ["css/custom.css"]

html_js_files = [
'css/custom.js'
]
html_logo = 'assets/f1tenth_gym.svg'
html_js_files = ["css/custom.js"]
html_logo = "assets/f1tenth_gym.svg"

# -- Project information -----------------------------------------------------

project = 'f1tenth_gym'
project = "f1tenth_gym"
copyright = "2021, Hongrui Zheng, Matthew O'Kelly, Aman Sinha"
author = 'Hongrui Zheng'
author = "Hongrui Zheng"

# The full version, including alpha/beta/rc tags
release = 'latest'
version = 'latest'
release = "latest"
version = "latest"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [ "breathe", "sphinx_rtd_theme", "sphinx.ext.autosectionlabel"
]
extensions = ["breathe", "sphinx_rtd_theme", "sphinx.ext.autosectionlabel"]

# Breathe configuration
breathe_projects = {
"f1tenth_gym":"./xml"
}
breathe_projects = {"f1tenth_gym": "./xml"}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
8 changes: 4 additions & 4 deletions examples/random_trackgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
- shapely
- opencv-python
"""
import math
import pathlib

import cv2
import math
import matplotlib.pyplot as plt
import numpy as np
import shapely.geometry as shp
import matplotlib.pyplot as plt


def main(args):
Expand All @@ -54,7 +54,7 @@ def main(args):
track, track_int, track_ext = create_track()
convert_track(track, track_int, track_ext, i, outdir)
print(f"[info] saved track {i} in {outdir}/")
except:
except Exception as _: # noqa: F841
print("[error] failed to create track. Retrying...")
continue
print()
Expand Down Expand Up @@ -162,7 +162,7 @@ def create_track():
assert i1 != -1
assert i2 != -1

track = track[i1 : i2 - 1]
track = track[i1: i2 - 1]
first_beta = track[0][1]
first_perp_x = math.cos(first_beta)
first_perp_y = math.sin(first_beta)
Expand Down
7 changes: 2 additions & 5 deletions examples/waypoint_follow.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import time
import yaml

import gymnasium as gym
import numpy as np
from argparse import Namespace

from numba import njit

from pyglet.gl import GL_POINTS

"""
Expand Down Expand Up @@ -233,7 +230,7 @@ def _get_current_waypoint(self, waypoints, lookahead_distance, position, theta):
lookahead_point, i2, t2 = first_point_on_trajectory_intersecting_circle(
position, lookahead_distance, wpts, t1, wrap=True
)
if i2 == None:
if i2 is None:
return None
current_waypoint = np.empty((3,), dtype=np.float32)
# x, y
Expand Down
7 changes: 1 addition & 6 deletions gym/f110_gym/envs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
from f110_gym.envs.integrator import *
from f110_gym.envs.dynamic_models import *
from f110_gym.envs.f110_env import F110Env
from f110_gym.envs.laser_models import *
from f110_gym.envs.base_classes import *
from f110_gym.envs.collision_models import *
from .f110_env import F110Env # noqa: F401 This is needed to make easy imports work
2 changes: 1 addition & 1 deletion gym/f110_gym/envs/action.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import abstractmethod
from enum import Enum
from typing import Any, Tuple, Dict
from typing import Any, Dict, Tuple

import gymnasium as gym
import numpy as np
Expand Down
9 changes: 3 additions & 6 deletions gym/f110_gym/envs/base_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@
Author: Hongrui Zheng
"""
import numpy as np

from f110_gym.envs import DynamicModel
from f110_gym.envs.dynamic_models import DynamicModel
from f110_gym.envs.action import CarAction
from f110_gym.envs.collision_models import collision_multiple, get_vertices
from f110_gym.envs.integrator import EulerIntegrator, IntegratorType
from f110_gym.envs.laser_models import ScanSimulator2D, check_ttc_jit, ray_cast
from f110_gym.envs.collision_models import get_vertices, collision_multiple


class RaceCar(object):
Expand Down Expand Up @@ -496,8 +495,6 @@ def step(self, control_inputs):
observations (dict): dictionary for observations: poses of agents, current laser scan of each agent, collision indicators, etc.
"""

agent_scans = []

# looping over agents
for i, agent in enumerate(self.agents):
# update each agent's pose
Expand All @@ -513,7 +510,7 @@ def step(self, control_inputs):
for i, agent in enumerate(self.agents):
# update agent's information on other agents
opp_poses = np.concatenate(
(self.agent_poses[0:i, :], self.agent_poses[i + 1 :, :]), axis=0
(self.agent_poses[0:i, :], self.agent_poses[i + 1:, :]), axis=0
)
agent.update_opp_poses(opp_poses)

Expand Down
Loading
Loading