Skip to content

Commit 0822050

Browse files
committed
Move to ConfigDict. Rename ThrustEnv to AttitudeEnv.
1 parent 82a70b6 commit 0822050

File tree

16 files changed

+221
-196
lines changed

16 files changed

+221
-196
lines changed

benchmarks/config/test.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[sim]
22
physics = "analytical"
33
camera_view = [5.0, -40.0, -40.0, 0.5, -1.0, 0.5]
4-
sim_freq = 500 # Simulation frequency, in Hz
4+
freq = 500 # Simulation frequency, in Hz
55
attitude_freq = 500 # Controller frequency, in Hz. This frequency is used to simulate the onboard controller, NOT for the environment's step function
66
gui = false # Enable/disable PyBullet's GUI
77

@@ -53,38 +53,38 @@ fn = "uniform"
5353
minval = [-0.1, -0.1, -0.1]
5454
maxval = [0.1, 0.1, 0.1]
5555

56-
[env.randomization.drone_pos]
56+
[env.randomizations.drone_pos]
5757
type = "uniform" # Everything that can be used as a distribution in numpy.random
5858
# Kwargs that are permissable in the np random function
5959
low = [-0.1, -0.1, 0.0]
6060
high = [0.1, 0.1, 0.02]
6161

62-
[env.randomization.drone_rpy]
62+
[env.randomizations.drone_rpy]
6363
type = "uniform"
6464
low = [-0.1, -0.1, -0.1]
6565
high = [0.1, 0.1, 0.1]
6666

67-
[env.randomization.drone_mass]
67+
[env.randomizations.drone_mass]
6868
type = "uniform"
6969
low = -0.01
7070
high = 0.01
7171

72-
[env.randomization.drone_inertia]
72+
[env.randomizations.drone_inertia]
7373
type = "uniform"
7474
low = [-0.000001, -0.000001, -0.000001]
7575
high = [0.000001, 0.000001, 0.000001]
7676

77-
[env.randomization.gate_pos]
77+
[env.randomizations.gate_pos]
7878
type = "uniform"
7979
low = [-0.1, -0.1, 0.0]
8080
high = [0.1, 0.1, 0.0]
8181

82-
[env.randomization.gate_rpy]
82+
[env.randomizations.gate_rpy]
8383
type = "uniform"
8484
low = [0.0, 0.0, -0.1]
8585
high = [0.0, 0.0, 0.1]
8686

87-
[env.randomization.obstacle_pos]
87+
[env.randomizations.obstacle_pos]
8888
type = "uniform"
8989
low = [-0.1, -0.1, 0.0]
9090
high = [0.1, 0.1, 0.0]

benchmarks/sim.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
3333
import lsy_drone_racing
3434
35-
env = gymnasium.make('DroneRacingThrust-v0', config=config)
35+
env = gymnasium.make('DroneRacingAttitude-v0', config=config)
3636
env.reset()
3737
env.step(env.action_space.sample()) # JIT compile
3838
env.reset()

config/level0.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ practice_without_track_objects = false
2323
physics = "analytical"
2424

2525
camera_view = [5.0, -40.0, -40.0, 0.5, -1.0, 0.5]
26-
sim_freq = 500 # Simulation frequency, in Hz
26+
freq = 500 # Simulation frequency, in Hz
2727
attitude_freq = 500 # Controller frequency, in Hz. This frequency is used to simulate the onboard controller, NOT for the environment's step function
2828
gui = false # Enable/disable PyBullet's GUI
2929

@@ -37,7 +37,7 @@ low = [-0.1, -0.1, -0.1]
3737
high = [0.1, 0.1, 0.1]
3838

3939
[env]
40-
id = "DroneRacing-v0" # Either "DroneRacing-v0" or "DroneRacingThrust-v0". If using "DroneRacingThrust-v0", the drone will use the thrust controller instead of the position controller.
40+
id = "DroneRacing-v0" # Either "DroneRacing-v0" or "DroneRacingAttitude-v0". If using "DroneRacingAttitude-v0", the drone will use the attitude controller instead of the position controller.
4141
random_resets = false # Whether to re-seed the random number generator between episodes
4242
seed = 1337 # Random seed
4343
freq = 50 # Frequency of the environment's step function, in Hz

config/level1.toml

+10-10
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ practice_without_track_objects = false
1919
# Physics options: analytical, sys_id, mujoco
2020
physics = "analytical"
2121
camera_view = [5.0, -40.0, -40.0, 0.5, -1.0, 0.5]
22-
sim_freq = 500 # Simulation frequency, in Hz
22+
freq = 500 # Simulation frequency, in Hz
2323
attitude_freq = 500 # Controller frequency, in Hz. This frequency is used to simulate the onboard controller, NOT for the environment's step function
2424
gui = false # Enable/disable PyBullet's GUI
2525

2626
[env]
27-
id = "DroneRacing-v0" # Either "DroneRacing-v0" or "DroneRacingThrust-v0". If using "DroneRacingThrust-v0", the drone will use the thrust controller instead of the position controller.
27+
id = "DroneRacing-v0" # Either "DroneRacing-v0" or "DroneRacingAttitude-v0". If using "DroneRacingAttitude-v0", the drone will use the attitude controller instead of the position controller.
2828
random_resets = false # Whether to re-seed the random number generator between episodes
2929
seed = 1337 # Random seed
3030
freq = 50 # Frequency of the environment's step function, in Hz
@@ -73,26 +73,26 @@ fn = "uniform"
7373
minval = [-0.1, -0.1, -0.1]
7474
maxval = [0.1, 0.1, 0.1]
7575

76-
[env.randomization.drone_pos]
76+
[env.randomizations.drone_pos]
7777
fn = "uniform"
78-
[env.randomization.drone_pos.kwargs]
78+
[env.randomizations.drone_pos.kwargs]
7979
minval = [-0.1, -0.1, 0.0]
8080
maxval = [0.1, 0.1, 0.02]
8181

82-
[env.randomization.drone_rpy]
82+
[env.randomizations.drone_rpy]
8383
fn = "uniform"
84-
[env.randomization.drone_rpy.kwargs]
84+
[env.randomizations.drone_rpy.kwargs]
8585
minval = [-0.1, -0.1, -0.1]
8686
maxval = [0.1, 0.1, 0.1]
8787

88-
[env.randomization.drone_mass]
88+
[env.randomizations.drone_mass]
8989
fn = "uniform"
90-
[env.randomization.drone_mass.kwargs]
90+
[env.randomizations.drone_mass.kwargs]
9191
minval = -0.01
9292
maxval = 0.01
9393

94-
[env.randomization.drone_inertia]
94+
[env.randomizations.drone_inertia]
9595
fn = "uniform"
96-
[env.randomization.drone_inertia.kwargs]
96+
[env.randomizations.drone_inertia.kwargs]
9797
minval = [-0.000001, -0.000001, -0.000001]
9898
maxval = [0.000001, 0.000001, 0.000001]

config/level2.toml

+16-16
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ practice_without_track_objects = false
1919
# Physics options: analytical, sys_id, mujoco
2020
physics = "analytical"
2121
camera_view = [5.0, -40.0, -40.0, 0.5, -1.0, 0.5]
22-
sim_freq = 500 # Simulation frequency, in Hz
22+
freq = 500 # Simulation frequency, in Hz
2323
attitude_freq = 500 # Controller frequency, in Hz. This frequency is used to simulate the onboard controller, NOT for the environment's step function
2424
gui = false # Enable/disable PyBullet's GUI
2525

2626
[env]
27-
id = "DroneRacing-v0" # Either "DroneRacing-v0" or "DroneRacingThrust-v0". If using "DroneRacingThrust-v0", the drone will use the thrust controller instead of the position controller.
27+
id = "DroneRacing-v0" # Either "DroneRacing-v0" or "DroneRacingAttitude-v0". If using "DroneRacingAttitude-v0", the drone will use the attitude controller instead of the position controller.
2828
random_resets = false # Whether to re-seed the random number generator between episodes
2929
seed = 1337 # Random seed
3030
freq = 50 # Frequency of the environment's step function, in Hz
@@ -73,44 +73,44 @@ fn = "uniform"
7373
minval = [-0.1, -0.1, -0.1]
7474
maxval = [0.1, 0.1, 0.1]
7575

76-
[env.randomization.drone_pos]
76+
[env.randomizations.drone_pos]
7777
fn = "uniform"
78-
[env.randomization.drone_pos.kwargs]
78+
[env.randomizations.drone_pos.kwargs]
7979
minval = [-0.1, -0.1, 0.0]
8080
maxval = [0.1, 0.1, 0.02]
8181

82-
[env.randomization.drone_rpy]
82+
[env.randomizations.drone_rpy]
8383
fn = "uniform"
84-
[env.randomization.drone_rpy.kwargs]
84+
[env.randomizations.drone_rpy.kwargs]
8585
minval = [-0.1, -0.1, -0.1]
8686
maxval = [0.1, 0.1, 0.1]
8787

88-
[env.randomization.drone_mass]
88+
[env.randomizations.drone_mass]
8989
fn = "uniform"
90-
[env.randomization.drone_mass.kwargs]
90+
[env.randomizations.drone_mass.kwargs]
9191
minval = -0.01
9292
maxval = 0.01
9393

94-
[env.randomization.drone_inertia]
94+
[env.randomizations.drone_inertia]
9595
fn = "uniform"
96-
[env.randomization.drone_inertia.kwargs]
96+
[env.randomizations.drone_inertia.kwargs]
9797
minval = [-0.000001, -0.000001, -0.000001]
9898
maxval = [0.000001, 0.000001, 0.000001]
9999

100-
[env.randomization.gate_pos]
100+
[env.randomizations.gate_pos]
101101
fn = "uniform"
102-
[env.randomization.gate_pos.kwargs]
102+
[env.randomizations.gate_pos.kwargs]
103103
minval = [-0.15, -0.15, -0.1]
104104
maxval = [0.15, 0.15, 0.1]
105105

106-
[env.randomization.gate_rpy]
106+
[env.randomizations.gate_rpy]
107107
fn = "uniform"
108-
[env.randomization.gate_rpy.kwargs]
108+
[env.randomizations.gate_rpy.kwargs]
109109
minval = [0.0, 0.0, -0.1]
110110
maxval = [0.0, 0.0, 0.1]
111111

112-
[env.randomization.obstacle_pos]
112+
[env.randomizations.obstacle_pos]
113113
fn = "uniform"
114-
[env.randomization.obstacle_pos.kwargs]
114+
[env.randomizations.obstacle_pos.kwargs]
115115
minval = [-0.15, -0.15, -0.05]
116116
maxval = [0.15, 0.15, 0.05]

config/level3.toml

+16-16
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ practice_without_track_objects = false
1919
# Physics options: analytical, sys_id, mujoco
2020
physics = "analytical"
2121
camera_view = [5.0, -40.0, -40.0, 0.5, -1.0, 0.5]
22-
sim_freq = 500 # Simulation frequency, in Hz
22+
freq = 500 # Simulation frequency, in Hz
2323
attitude_freq = 500 # Controller frequency, in Hz. This frequency is used to simulate the onboard controller, NOT for the environment's step function
2424
gui = false # Enable/disable PyBullet's GUI
2525

2626
[env]
27-
id = "DroneRacing-v0" # Either "DroneRacing-v0" or "DroneRacingThrust-v0". If using "DroneRacingThrust-v0", the drone will use the thrust controller instead of the position controller.
27+
id = "DroneRacing-v0" # Either "DroneRacing-v0" or "DroneRacingAttitude-v0". If using "DroneRacingAttitude-v0", the drone will use the attitude controller instead of the position controller.
2828
random_resets = true # Whether to re-seed the random number generator between episodes
2929
seed = 1337 # Random seed
3030
freq = 50 # Frequency of the environment's step function, in Hz
@@ -73,44 +73,44 @@ fn = "uniform"
7373
minval = [-0.1, -0.1, -0.1]
7474
maxval = [0.1, 0.1, 0.1]
7575

76-
[env.randomization.drone_pos]
76+
[env.randomizations.drone_pos]
7777
fn = "uniform"
78-
[env.randomization.drone_pos.kwargs]
78+
[env.randomizations.drone_pos.kwargs]
7979
minval = [-0.1, -0.1, 0.0]
8080
maxval = [0.1, 0.1, 0.02]
8181

82-
[env.randomization.drone_rpy]
82+
[env.randomizations.drone_rpy]
8383
fn = "uniform"
84-
[env.randomization.drone_rpy.kwargs]
84+
[env.randomizations.drone_rpy.kwargs]
8585
minval = [-0.1, -0.1, -0.1]
8686
maxval = [0.1, 0.1, 0.1]
8787

88-
[env.randomization.drone_mass]
88+
[env.randomizations.drone_mass]
8989
fn = "uniform"
90-
[env.randomization.drone_mass.kwargs]
90+
[env.randomizations.drone_mass.kwargs]
9191
minval = -0.01
9292
maxval = 0.01
9393

94-
[env.randomization.drone_inertia]
94+
[env.randomizations.drone_inertia]
9595
fn = "uniform"
96-
[env.randomization.drone_inertia.kwargs]
96+
[env.randomizations.drone_inertia.kwargs]
9797
minval = [-0.000001, -0.000001, -0.000001]
9898
maxval = [0.000001, 0.000001, 0.000001]
9999

100-
[env.randomization.gate_pos]
100+
[env.randomizations.gate_pos]
101101
fn = "uniform"
102-
[env.randomization.gate_pos.kwargs]
102+
[env.randomizations.gate_pos.kwargs]
103103
minval = [-0.15, -0.15, -0.1]
104104
maxval = [0.15, 0.15, 0.1]
105105

106-
[env.randomization.gate_rpy]
106+
[env.randomizations.gate_rpy]
107107
fn = "uniform"
108-
[env.randomization.gate_rpy.kwargs]
108+
[env.randomizations.gate_rpy.kwargs]
109109
minval = [0.0, 0.0, -0.1]
110110
maxval = [0.0, 0.0, 0.1]
111111

112-
[env.randomization.obstacle_pos]
112+
[env.randomizations.obstacle_pos]
113113
fn = "uniform"
114-
[env.randomization.obstacle_pos.kwargs]
114+
[env.randomizations.obstacle_pos.kwargs]
115115
minval = [-0.15, -0.15, -0.05]
116116
maxval = [0.15, 0.15, 0.05]

lsy_drone_racing/envs/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
)
2828

2929
register(
30-
id="DroneRacingThrust-v0",
31-
entry_point="lsy_drone_racing.envs.drone_racing_env:DroneRacingThrustEnv",
30+
id="DroneRacingAttitude-v0",
31+
entry_point="lsy_drone_racing.envs.drone_racing_env:DroneRacingAttitudeEnv",
3232
max_episode_steps=1800,
3333
disable_env_checker=True,
3434
)
@@ -41,8 +41,8 @@
4141
)
4242

4343
register(
44-
id="DroneRacingThrustDeploy-v0",
45-
entry_point="lsy_drone_racing.envs.drone_racing_deploy_env:DroneRacingThrustDeployEnv",
44+
id="DroneRacingAttitudeDeploy-v0",
45+
entry_point="lsy_drone_racing.envs.drone_racing_deploy_env:DroneRacingAttitudeDeployEnv",
4646
max_episode_steps=1800,
4747
disable_env_checker=True,
4848
)

lsy_drone_racing/envs/drone_racing_deploy_env.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
99
* :class:`~.DroneRacingDeployEnv`: A Gymnasium environment for controlling a real Crazyflie drone in
1010
a physical race track, using Vicon motion capture for positioning.
11-
* :class:`~.DroneRacingThrustDeployEnv`: A variant of :class:`~.DroneRacingDeployEnv` that uses
11+
* :class:`~.DroneRacingAttitudeDeployEnv`: A variant of :class:`~.DroneRacingDeployEnv` that uses
1212
collective thrust and attitude commands for control.
1313
1414
These environments maintain consistent interfaces with their simulation counterparts
15-
(:class:`~.DroneRacingEnv` and :class:`~.DroneRacingThrustEnv`), allowing for seamless transition
15+
(:class:`~.DroneRacingEnv` and :class:`~.DroneRacingAttitudeEnv`), allowing for seamless transition
1616
from simulation to real-world deployment. They handle the complexities of interfacing with physical
1717
hardware while providing the same observation and action spaces as the simulation environments.
1818
@@ -273,11 +273,11 @@ def gate_passed(self, pos: NDArray[np.floating], prev_pos: NDArray[np.floating])
273273
return False
274274

275275

276-
class DroneRacingThrustDeployEnv(DroneRacingDeployEnv):
276+
class DroneRacingAttitudeDeployEnv(DroneRacingDeployEnv):
277277
"""A Gymnasium environment for deploying drone racing algorithms on real hardware.
278278
279279
This environment mirrors the functionality of the
280-
class:~lsy_drone_racing.envs.drone_racing_thrust_env.DroneRacingThrustEnv, but interfaces with
280+
class:~lsy_drone_racing.envs.drone_racing_thrust_env.DroneRacingAttitudeEnv, but interfaces with
281281
real-world hardware (Crazyflie drone and Vicon motion capture system) instead of a simulation.
282282
"""
283283

0 commit comments

Comments
 (0)