Skip to content

Commit

Permalink
[wip,broken,debug] Investigate slow performance on reset
Browse files Browse the repository at this point in the history
  • Loading branch information
amacati committed Jan 17, 2025
1 parent 9205213 commit 4ee7f35
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 109 deletions.
3 changes: 2 additions & 1 deletion benchmarks/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
import lsy_drone_racing
env = gymnasium.make('MultiDroneRacing-v0',
n_envs=1, # TODO: Remove this for single-world envs
n_envs=1000, # TODO: Remove this for single-world envs
n_drones=config.env.n_drones,
freq=config.env.freq,
sim_config=config.sim,
Expand All @@ -87,6 +87,7 @@
randomizations=config.env.get("randomizations"),
random_resets=config.env.random_resets,
seed=config.env.seed,
device='gpu',
)
env.reset()
env.step(env.action_space.sample()) # JIT compile
Expand Down
9 changes: 0 additions & 9 deletions config/multi_level0.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ freq = 500 # Simulation frequency, in Hz
attitude_freq = 500 # Controller frequency, in Hz. This frequency is used to simulate the onboard controller, NOT for the environment's step function
gui = false # Enable/disable PyBullet's GUI

[sim.disturbances.action]
type = "GaussianNoise"
std = 0.001

[sim.disturbances.dynamics]
type = "UniformNoise"
low = [-0.1, -0.1, -0.1]
high = [0.1, 0.1, 0.1]

[env]
id = "MultiDroneRacing-v0" # Either "MultiDroneRacingEnv-v0" or "MultiDroneRacingAttitude-v0". If using "MultiDroneRacingAttitude-v0", the drone will use the attitude controller instead of the position controller.
n_drones = 2 # Number of drones has to match the track configuration for drones
Expand Down
121 changes: 121 additions & 0 deletions config/multi_level3.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Level 0

# | Evaluation Scenario | Rand. Inertial Properties | Randomized Obstacles, Gates | Rand. Between Episodes | Notes |
# | :-----------------: | :-----------------------: | :-------------------------: | :--------------------: | :---------------: |
# | `level0.toml` | *No* | *No* | *No* | Perfect knowledge |
[controller]
file = "trajectory_controller.py" # Put your controller file name here. Specifying a controller as argument to scripts will override this setting. Controllers are located in `lsy_drone_racing/control/`

[deploy]
### Settings only relevant for deployment
# Whether to check if gate and obstacle positions observed by vicon are within the limits defined down below.
check_race_track = true
# Whether to check if the drone start position is within the limits specified down below.
check_drone_start_pos = true
# Lets you practice your controller without putting up gates & obstacles, assumes nominal positions given below.
practice_without_track_objects = false

[sim]
# Physics options:
# "analytical": Analytical, simplified dynamics model
# "mujoco": Mujoco dynamics. May take longer to compile at startup.
# "sys_id": System identification model.
physics = "analytical"

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

[env]
id = "MultiDroneRacing-v0" # Either "MultiDroneRacingEnv-v0" or "MultiDroneRacingAttitude-v0". If using "MultiDroneRacingAttitude-v0", the drone will use the attitude controller instead of the position controller.
n_drones = 2 # Number of drones has to match the track configuration for drones
random_resets = true # Whether to re-seed the random number generator between episodes
seed = 1337 # Random seed
freq = 50 # Frequency of the environment's step function, in Hz
symbolic = false # Whether to include symbolic expressions in the info dict. Note: This can interfere with multiprocessing! If you want to parallelize your training, set this to false.
sensor_range = 0.45 # Range at which the exact location of gates and obstacles become visible to the drone. Objects that are not in the drone's sensor range report their nominal position.

[env.track]
# Tall gates: 1.0m height. Short gates: 0.525m height. Height is measured from the ground to the
# center of the gate.
[[env.track.gates]]
pos = [0.45, -1.0, 0.56]
rpy = [0.0, 0.0, 2.35]
[[env.track.gates]]
pos = [1.0, -1.55, 1.11]
rpy = [0.0, 0.0, -0.78]
[[env.track.gates]]
pos = [0.0, 0.5, 0.56]
rpy = [0.0, 0.0, 0.0]
[[env.track.gates]]
pos = [-0.5, -0.5, 1.11]
rpy = [0.0, 0.0, 3.14]

# Obstacle height: 1.4m. Height is measured from the ground to the top of the obstacle.
[[env.track.obstacles]]
pos = [1.0, -0.5, 1.4]
[[env.track.obstacles]]
pos = [0.5, -1.5, 1.4]
[[env.track.obstacles]]
pos = [-0.5, 0.0, 1.4]
[[env.track.obstacles]]
pos = [0.0, 1.0, 1.4]

[env.track.drone]
pos = [[1.0, 1.0, 0.05], [1.2, 1.0, 0.05]]
rpy = [[0, 0, 0], [0, 0, 0]]
vel = [[0, 0, 0], [0, 0, 0]]
rpy_rates = [[0, 0, 0], [0, 0, 0]]

[env.disturbances.action]
fn = "normal"
scale = 0.001

[env.disturbances.dynamics]
fn = "uniform"
[env.disturbances.dynamics.kwargs]
minval = [-0.1, -0.1, -0.1]
maxval = [0.1, 0.1, 0.1]

[env.randomizations.drone_pos]
fn = "uniform"
[env.randomizations.drone_pos.kwargs]
minval = [-0.1, -0.1, 0.0]
maxval = [0.1, 0.1, 0.02]

[env.randomizations.drone_rpy]
fn = "uniform"
[env.randomizations.drone_rpy.kwargs]
minval = [-0.1, -0.1, -0.1]
maxval = [0.1, 0.1, 0.1]

[env.randomizations.drone_mass]
fn = "uniform"
[env.randomizations.drone_mass.kwargs]
minval = -0.01
maxval = 0.01

[env.randomizations.drone_inertia]
fn = "uniform"
[env.randomizations.drone_inertia.kwargs]
minval = [-0.000001, -0.000001, -0.000001]
maxval = [0.000001, 0.000001, 0.000001]

[env.randomizations.gate_pos]
fn = "uniform"
[env.randomizations.gate_pos.kwargs]
minval = [-0.15, -0.15, -0.1]
maxval = [0.15, 0.15, 0.1]

[env.randomizations.gate_rpy]
fn = "uniform"
[env.randomizations.gate_rpy.kwargs]
minval = [0.0, 0.0, -0.1]
maxval = [0.0, 0.0, 0.1]

[env.randomizations.obstacle_pos]
fn = "uniform"
[env.randomizations.obstacle_pos.kwargs]
minval = [-0.15, -0.15, -0.05]
maxval = [0.15, 0.15, 0.05]
Loading

0 comments on commit 4ee7f35

Please sign in to comment.