Skip to content

Commit

Permalink
precommitted
Browse files Browse the repository at this point in the history
  • Loading branch information
jet-sony committed Sep 4, 2024
1 parent 139d241 commit d73a51f
Show file tree
Hide file tree
Showing 52 changed files with 60 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.3.0
hooks:
- id: codespell
args:
- --ignore-words-list=null
exclude: docs/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.6.3
hooks:
- id: ruff
args: [ --fix ]
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Class implementations for creating custom UAVs in the PyBullet simulation environment."""

from .aviary import Aviary
from .utils.load_objs import loadOBJ, obj_collision, obj_visual
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Abstractions for PyFlyt drones."""

from .base_controller import ControlClass
from .base_drone import DroneClass
from .base_wind_field import WindFieldClass
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/base_controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines a basic controller class to inherit from when building custom controllers."""

from abc import ABC, abstractmethod

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/base_drone.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic Drone class for all drone models to inherit from."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/base_wind_field.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines a basic wind field class to inherit from when implementing custom wind field models."""

from __future__ import annotations

from abc import ABC, abstractmethod
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/boosters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A component to simulate an array of boosters on vehicle."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/boring_bodies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A component to simulate bodies moving through the air."""

from __future__ import annotations

from typing import Sequence
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/camera.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A component to simulate a camera on a vehicle."""

from __future__ import annotations

import math
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/gimbals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A component to simulate an array of gimbals on vehicle."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/lifting_surfaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A component to simulate lifting surfaces vehicle."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/motors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A component to simulate an array of electric propeller motors on vehicle."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/abstractions/pid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A simple class implementing the PID algorithm that works on numpy arrays."""

import numba as nb
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/aviary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Aviary class, the core of how PyFlyt handles UAVs in the PyBullet simulation environment."""

from __future__ import annotations

import time
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/drones/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementations of default drone models."""

from .fixedwing import Fixedwing
from .quadx import QuadX
from .rocket import Rocket
1 change: 1 addition & 0 deletions PyFlyt/core/drones/fixedwing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of a Fixedwing UAV."""

from __future__ import annotations

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/drones/quadx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of a CrazyFlie 2.x UAV."""

from __future__ import annotations

import math
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/drones/rocket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of a 1:10 scale SpaceX Rocket UAV."""

from __future__ import annotations

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/utils/compile_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Common checks."""

import warnings
from typing import Callable

Expand Down
1 change: 1 addition & 0 deletions PyFlyt/core/utils/load_objs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convenience function to load an obj into the pybullet environment."""

from __future__ import annotations

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/gym_envs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Registers PyFlyt environments into Gymnasium."""

from gymnasium.envs.registration import register

from PyFlyt.gym_envs.utils.flatten_waypoint_env import FlattenWaypointEnv
Expand Down
3 changes: 2 additions & 1 deletion PyFlyt/gym_envs/fixedwing_envs/fixedwing_base_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base PyFlyt Environment for the Fixedwing model using the Gymnasim API."""

from __future__ import annotations

from typing import Any, Literal
Expand Down Expand Up @@ -295,7 +296,7 @@ def step(self, action: np.ndarray) -> tuple[Any, float, bool, bool, dict]:
return self.state, self.reward, self.termination, self.truncation, self.info

def render(self) -> np.ndarray:
"""render."""
"""Render."""
check_numpy()
if self.render_mode is None:
raise ValueError(
Expand Down
3 changes: 2 additions & 1 deletion PyFlyt/gym_envs/fixedwing_envs/fixedwing_waypoints_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixedwing Waypoints Environment."""

from __future__ import annotations

from typing import Any, Literal
Expand Down Expand Up @@ -171,7 +172,7 @@ def compute_state(self) -> None:
self.state: dict[Literal["attitude", "target_deltas"], np.ndarray] = new_state

def compute_term_trunc_reward(self) -> None:
"""Computes the termination, trunction, and reward of the current timestep."""
"""Computes the termination, truncation, and reward of the current timestep."""
super().compute_base_term_trunc_reward()

# bonus reward if we are not sparse
Expand Down
3 changes: 2 additions & 1 deletion PyFlyt/gym_envs/quadx_envs/quadx_base_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base PyFlyt Environment for the QuadX model using the Gymnasim API."""

from __future__ import annotations

from typing import Any, Literal
Expand Down Expand Up @@ -305,7 +306,7 @@ def step(self, action: np.ndarray) -> tuple[Any, float, bool, bool, dict[str, An
return self.state, self.reward, self.termination, self.truncation, self.info

def render(self) -> np.ndarray:
"""render."""
"""Render."""
check_numpy()
if self.render_mode is None:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/gym_envs/quadx_envs/quadx_gates_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""QuadX Gates Environment."""

from __future__ import annotations

import copy
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/gym_envs/quadx_envs/quadx_hover_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""QuadX Hover Environment."""

from __future__ import annotations

from typing import Any, Literal
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/gym_envs/quadx_envs/quadx_pole_balance_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""QuadX Pole Balance Environment."""

from __future__ import annotations

from typing import Any, Literal
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/gym_envs/quadx_envs/quadx_pole_waypoints_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""QuadX Pole Waypoints Environment."""

from __future__ import annotations

from typing import Any, Literal
Expand Down
3 changes: 2 additions & 1 deletion PyFlyt/gym_envs/quadx_envs/quadx_waypoints_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""QuadX Waypoints Environment."""

from __future__ import annotations

from typing import Any, Literal
Expand Down Expand Up @@ -177,7 +178,7 @@ def compute_state(self) -> None:
self.state: dict[Literal["attitude", "target_deltas"], np.ndarray] = new_state

def compute_term_trunc_reward(self) -> None:
"""Computes the termination, trunction, and reward of the current timestep."""
"""Computes the termination, truncation, and reward of the current timestep."""
super().compute_base_term_trunc_reward()

# bonus reward if we are not sparse
Expand Down
3 changes: 2 additions & 1 deletion PyFlyt/gym_envs/rocket_envs/rocket_base_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base PyFlyt Environment for the Rocket model using the Gymnasim API."""

from __future__ import annotations

from typing import Any, Literal
Expand Down Expand Up @@ -348,7 +349,7 @@ def step(self, action: np.ndarray):
return self.state, self.reward, self.termination, self.truncation, self.info

def render(self):
"""render."""
"""Render."""
check_numpy()
if self.render_mode is None:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/gym_envs/rocket_envs/rocket_landing_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Rocket Landing Environment."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/gym_envs/utils/flatten_waypoint_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wrapper class for flattening the waypoint envs to use homogeneous observation spaces."""

from __future__ import annotations

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/gym_envs/utils/waypoint_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Handler for Waypoints in the environments."""

from __future__ import annotations

import math
Expand Down
1 change: 1 addition & 0 deletions PyFlyt/pz_envs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Imports all PZ envs."""

from .fixedwing_envs.ma_fixedwing_dogfight_env import MAFixedwingDogfightEnv
from .quadx_envs.ma_quadx_hover_env import MAQuadXHoverEnv
3 changes: 2 additions & 1 deletion PyFlyt/pz_envs/fixedwing_envs/ma_fixedwing_base_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base Multiagent Fixedwing Environment."""

from __future__ import annotations

from copy import deepcopy
Expand Down Expand Up @@ -152,7 +153,7 @@ def action_space(self, agent: Any = None) -> spaces.Box:
return self._action_space

def close(self) -> None:
"""close."""
"""Close."""
if hasattr(self, "aviary"):
self.aviary.disconnect()

Expand Down
1 change: 1 addition & 0 deletions PyFlyt/pz_envs/fixedwing_envs/ma_fixedwing_dogfight_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Multiagent Fixedwing Dogfighting Environment."""

from __future__ import annotations

from typing import Any
Expand Down
3 changes: 2 additions & 1 deletion PyFlyt/pz_envs/quadx_envs/ma_quadx_base_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base Multiagent QuadX Environment."""

from __future__ import annotations

from copy import deepcopy
Expand Down Expand Up @@ -179,7 +180,7 @@ def action_space(self, agent: Any = None) -> spaces.Box:
return self._action_space

def close(self) -> None:
"""close."""
"""Close."""
if hasattr(self, "aviary"):
self.aviary.disconnect()

Expand Down
1 change: 1 addition & 0 deletions PyFlyt/pz_envs/quadx_envs/ma_quadx_hover_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Multiagent QuadX Hover Environment."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions examples/core/01_single_drone.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Spawn a single drone on x=0, y=0, z=1, with 0 rpy."""

import numpy as np

from PyFlyt.core import Aviary
Expand Down
1 change: 1 addition & 0 deletions examples/core/02_multi_drone.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Spawns three drones, then sets all drones to have different control looprates."""

import numpy as np

from PyFlyt.core import Aviary
Expand Down
1 change: 1 addition & 0 deletions examples/core/03_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Spawn a single drone, then command it to go to two setpoints consecutively, and plots the xyz output."""

import matplotlib.pyplot as plt
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions examples/core/04_camera.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Spawn a single drone and get its camera image."""

import matplotlib.pyplot as plt
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions examples/core/05_custom_controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement a controller that only wants the drone to be at x=1, y=1, z=1, while constantly spinning at yawrate=0.5, building off mode 6."""

import numpy as np

from PyFlyt.core import Aviary
Expand Down
1 change: 1 addition & 0 deletions examples/core/06_spawning_objects.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Spawn a duck object above the drone."""

import numpy as np

from PyFlyt.core import Aviary, loadOBJ, obj_collision, obj_visual
Expand Down
1 change: 1 addition & 0 deletions examples/core/07_custom_uav.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements a custom UAV in the Aviary."""

import numpy as np
from custom_uavs.rocket_brick import RocketBrick

Expand Down
1 change: 1 addition & 0 deletions examples/core/08_mixed_drones.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Spawns three different types of drones, then gets all their states."""

import numpy as np

from PyFlyt.core import Aviary
Expand Down
1 change: 1 addition & 0 deletions examples/core/09_simple_wind.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements a simple time invariant, stateless wind model."""

import numpy as np

from PyFlyt.core import Aviary
Expand Down
1 change: 1 addition & 0 deletions examples/core/10_custom_wind.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements a custom stateful wind model."""

import numpy as np

from PyFlyt.core import Aviary
Expand Down
1 change: 1 addition & 0 deletions examples/core/custom_uavs/rocket_brick.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements a custom brick with a booster attached."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests the the core API functionality."""

from __future__ import annotations

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_gym_envs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests the API compatibility of all PyFlyt Gymnasium Envs."""

import itertools
import warnings

Expand Down
1 change: 1 addition & 0 deletions tests/test_pz_envs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests the API compatibility of all PyFlyt Pettingzoo Environments."""

from __future__ import annotations

import warnings
Expand Down

0 comments on commit d73a51f

Please sign in to comment.