Skip to content

Commit 35e2064

Browse files
committed
Remove old dependencies. Prepare further removals
1 parent b371579 commit 35e2064

File tree

13 files changed

+27
-33
lines changed

13 files changed

+27
-33
lines changed

.github/workflows/kaggle.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ jobs:
2727
init-shell: bash
2828
create-args: python=3.8
2929
cache-environment: true
30-
- run: pip install .[rl,test]
31-
shell: micromamba-shell {0}
32-
- run: pip install kaggle
30+
- run: pip install .[online_submission,test]
3331
shell: micromamba-shell {0}
3432
- name: Install cffirmware
3533
run: |

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ You can also install the extended dependencies with
108108
```bash
109109
conda activate race
110110
cd ~/repos/lsy_drone_racing
111-
pip install -e .[rl, test]
111+
pip install -e .[test]
112112
```
113113
and check if all tests complete with
114114
```bash

docker/Deploy.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ WORKDIR /home/lsy_drone_racing
3636
COPY pyproject.toml ./
3737
# Install dependencies and cache the build step (only rebuilds when pyproject.toml changes)
3838
RUN pip install build
39-
RUN pip install --no-cache-dir .[test,rl]
39+
RUN pip install --no-cache-dir .[test]
4040
# Copy the rest of the application
4141
COPY . .
42-
RUN pip install --no-cache-dir -e .[test,rl]
42+
RUN pip install --no-cache-dir -e .[test]
4343

4444
CMD bash -c "source /home/crazyswarm/ros_ws/devel/setup.bash && python /home/lsy_drone_racing/scripts/deploy.py"

docker/Sim.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ WORKDIR /home/lsy_drone_racing
1919
COPY pyproject.toml ./
2020
# Install dependencies and cache the build step (only rebuilds when pyproject.toml changes)
2121
RUN pip install build
22-
RUN pip install --no-cache-dir .[test,rl]
22+
RUN pip install --no-cache-dir .[test]
2323
# Copy the rest of the application
2424
COPY . .
25-
RUN pip install -e .[test,rl]
25+
RUN pip install -e .[test]
2626

2727
ENTRYPOINT ["python", "/home/lsy_drone_racing/scripts/sim.py", "--gui", "False"]

docs/getting_started/setup.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ If everything is installed correctly, this will open the simulator and simulate
9191
Extended Dependencies
9292
---------------------
9393

94-
To install extended dependencies for reinforcement learning and testing:
94+
To install extended dependencies for testing:
9595

9696
.. code-block:: bash
9797
9898
conda activate race
9999
cd ~/repos/lsy_drone_racing
100-
pip install -e .[rl, test]
100+
pip install -e .[test]
101101
102102
You can then run the tests to ensure everything is working:
103103

lsy_drone_racing/envs/drone_racing_deploy_env.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from lsy_drone_racing.vicon import Vicon
4141

4242
if TYPE_CHECKING:
43-
from munch import Munch
43+
from ml_collections import ConfigDict
4444
from numpy.typing import NDArray
4545

4646
logger = logging.getLogger(__name__)
@@ -70,7 +70,7 @@ class DroneRacingDeployEnv(gymnasium.Env):
7070

7171
CONTROLLER = "mellinger"
7272

73-
def __init__(self, config: dict | Munch):
73+
def __init__(self, config: dict | ConfigDict):
7474
"""Initialize the crazyflie drone and the motion capture system.
7575
7676
Args:
@@ -281,7 +281,7 @@ class DroneRacingAttitudeDeployEnv(DroneRacingDeployEnv):
281281
real-world hardware (Crazyflie drone and Vicon motion capture system) instead of a simulation.
282282
"""
283283

284-
def __init__(self, config: dict | Munch):
284+
def __init__(self, config: dict | ConfigDict):
285285
"""Initialize the crazyflie drone and the motion capture system.
286286
287287
Args:

lsy_drone_racing/utils/ros_utils.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
from lsy_drone_racing.vicon import Vicon
1212

1313
if TYPE_CHECKING:
14-
from munch import Munch
14+
from ml_collections import ConfigDict
1515

1616
logger = logging.getLogger("rosout." + __name__)
1717

1818

19-
def check_race_track(config: Munch):
19+
def check_race_track(config: ConfigDict):
2020
"""Check if the race track's gates and obstacles are within tolerances.
2121
2222
Args:
@@ -33,13 +33,13 @@ def check_race_track(config: Munch):
3333
assert rng_info.gate_pos.type == "uniform", "Race track checks expect uniform distributions"
3434
assert rng_info.obstacle_pos.type == "uniform", "Race track checks expect uniform distributions"
3535
for i, gate in enumerate(config.env.track.gates):
36-
name = f"gate{i+1}"
36+
name = f"gate{i + 1}"
3737
gate_pos, gate_rot = vicon.pos[name], R.from_euler("xyz", vicon.rpy[name])
3838
check_bounds(name, gate_pos, gate.pos, rng_info.gate_pos.low, rng_info.gate_pos.high)
3939
check_rotation(name, gate_rot, R.from_euler("xyz", gate.rpy), ang_tol)
4040

4141
for i, obstacle in enumerate(config.env.track.obstacles):
42-
name = f"obstacle{i+1}"
42+
name = f"obstacle{i + 1}"
4343
low, high = rng_info.obstacle_pos.low, rng_info.obstacle_pos.high
4444
check_bounds(name, vicon.pos[name][:2], obstacle.pos[:2], low[:2], high[:2])
4545

@@ -66,7 +66,7 @@ def check_rotation(name: str, actual_rot: R, desired_rot: R, ang_tol: float):
6666
raise RuntimeError(f"{name} exceeds rotation tolerances ({ang_tol})")
6767

6868

69-
def check_drone_start_pos(config: Munch):
69+
def check_drone_start_pos(config: ConfigDict):
7070
"""Check if the real drone start position matches the settings.
7171
7272
Args:

lsy_drone_racing/utils/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def load_config(path: Path) -> ConfigDict:
7070
path: Path to the config file.
7171
7272
Returns:
73-
The munchified config dict.
73+
The configuration.
7474
"""
7575
assert path.exists(), f"Configuration file not found: {path}"
7676
assert path.suffix == ".toml", f"Configuration file has to be a TOML file: {path}"

lsy_drone_racing/vicon.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(
5252
... # ROS node is already running which is fine for us
5353
self.drone_name = None
5454
self.auto_track_drone = auto_track_drone
55-
if auto_track_drone:
55+
if auto_track_drone: # TODO: Remove crazyswarm dependency
5656
with open(get_ros_package_path("crazyswarm") / "launch/crazyflies.yaml", "r") as f:
5757
config = yaml.load(f, yaml.SafeLoader)
5858
assert len(config["crazyflies"]) == 1, "Only one crazyfly allowed at a time!"

pyproject.toml

+4-8
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,18 @@ classifiers = [
1919

2020
dependencies = [
2121
"fire >= 0.6.0",
22-
"munch >= 4.0.0",
2322
"numpy >= 1.24.1, < 2.0.0",
24-
"pandas >= 2.0.3",
25-
"pybullet >= 3.2.6",
26-
"PyYAML >= 6.0.1",
27-
"rospkg >= 1.5.1",
23+
"PyYAML >= 6.0.1", # TODO: Remove after removing crazyswarm dependency
24+
"rospkg >= 1.5.1", # TODO: Remove after moving to cflib
2825
"scipy >= 1.10.1",
2926
"gymnasium >= 1.0.0",
3027
"toml >= 0.10.2",
31-
"casadi >= 3.6.5",
28+
"ml_collections >= 1.0",
3229
]
3330

3431
[project.optional-dependencies]
3532
test = ["pytest>=8.0.0"]
36-
rl = ["stable-baselines3"]
37-
33+
online_submission = ["pandas", "kaggle"]
3834

3935
[tool.setuptools.packages]
4036
find = {}

scripts/deploy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
Usage:
55
6-
python deploy.py <path/to/controller.py> <path/to/config.yaml>
6+
python deploy.py <path/to/controller.py> <path/to/config.toml>
77
88
"""
99

scripts/multi_sim.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from lsy_drone_racing.utils import load_config, load_controller
2121

2222
if TYPE_CHECKING:
23-
from munch import Munch
23+
from ml_collections import ConfigDict
2424

2525
from lsy_drone_racing.control.controller import BaseController
2626
from lsy_drone_racing.envs.multi_drone_race import MultiDroneRacingEnv
@@ -105,7 +105,7 @@ def simulate(
105105
env.close()
106106

107107

108-
def log_episode_stats(obs: dict, info: dict, config: Munch, curr_time: float):
108+
def log_episode_stats(obs: dict, info: dict, config: ConfigDict, curr_time: float):
109109
"""Log the statistics of a single episode."""
110110
gates_passed = obs["target_gate"]
111111
finished = gates_passed == -1

scripts/sim.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lsy_drone_racing.utils import load_config, load_controller
2020

2121
if TYPE_CHECKING:
22-
from munch import Munch
22+
from ml_collections import ConfigDict
2323

2424
from lsy_drone_racing.control.controller import BaseController
2525
from lsy_drone_racing.envs.drone_race import DroneRaceEnv
@@ -103,7 +103,7 @@ def simulate(
103103
return ep_times
104104

105105

106-
def log_episode_stats(obs: dict, info: dict, config: Munch, curr_time: float):
106+
def log_episode_stats(obs: dict, info: dict, config: ConfigDict, curr_time: float):
107107
"""Log the statistics of a single episode."""
108108
gates_passed = obs["target_gate"]
109109
if gates_passed == -1: # The drone has passed the final gate

0 commit comments

Comments
 (0)