Skip to content

Commit

Permalink
cleanup & working quadrotor_2d_attitude
Browse files Browse the repository at this point in the history
  • Loading branch information
svsawant committed Jun 6, 2024
1 parent 50f8872 commit bf9adae
Show file tree
Hide file tree
Showing 676 changed files with 5,992 additions and 38,116 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,5 @@ c_generated_code
acados_ocp_nlp.json
safe_control_gym/experiments/arxiv/quadrotor_performance/config_overrides/gpmpc_acados_quadrotor_data_eff.yaml
safe_control_gym/experiments/arxiv/cartpole_performance/config_overrides/gp_mpc_cartpole_stabilization.yaml

.idea/
4 changes: 2 additions & 2 deletions examples/rl/config_overrides/cartpole/cartpole_stab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ task_config:
constraints:
- constraint_form: default_constraint
constrained_variable: state
upper_bounds: [10, 10, 5, 10]
lower_bounds: [-10, -10, -5, -10]
upper_bounds: [10, 10, 0.2, 0.2]
lower_bounds: [-10, -10, -0.2, -0.2]
- constraint_form: default_constraint
constrained_variable: input
upper_bounds: [10]
Expand Down
4 changes: 2 additions & 2 deletions examples/rl/config_overrides/cartpole/sac_cartpole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ algo_config:
entropy_lr: 0.001

# runner args
max_env_steps: 10000
max_env_steps: 50000
warm_up_steps: 100
rollout_batch_size: 4
num_workers: 1
max_buffer_size: 10000
max_buffer_size: 50000
deque_size: 10
eval_batch_size: 10

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
algo: ppo
algo_config:
# model args
hidden_dim: 128
activation: "relu"

# loss args
use_gae: True
entropy_coef: 0.01

# optim args
opt_epochs: 20
mini_batch_size: 256
actor_lr: 0.001
critic_lr: 0.001

# runner args
max_env_steps: 200000
rollout_batch_size: 4
rollout_steps: 1000

# misc
log_interval: 2000
save_interval: 0
num_checkpoints: 0
eval_interval: 2000
eval_save_best: True
tensorboard: False
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
task_config:
seed: 1337
info_in_reset: True
ctrl_freq: 60
pyb_freq: 1200
physics: pyb
quad_type: 4
normalized_rl_action_space: False

init_state:
init_x: 0
init_x_dot: 0
init_z: 1.15
init_z_dot: 0
init_theta: 0
randomized_init: True
randomized_inertial_prop: False

init_state_randomization_info:
init_x:
distrib: 'uniform'
low: -0.01
high: 0.01
init_x_dot:
distrib: 'uniform'
low: -0.01
high: 0.01
init_z:
distrib: 'uniform'
low: 1.15
high: 1.15
init_z_dot:
distrib: 'uniform'
low: -0.01
high: 0.01
init_theta:
distrib: 'uniform'
low: -0.02
high: 0.02

task: traj_tracking
task_info:
trajectory_type: figure8
num_cycles: 1
trajectory_plane: 'xz'
trajectory_position_offset: [0, 1.2]
trajectory_scale: 0.5

inertial_prop:
M: 0.027
Iyy: 1.4e-05

episode_len_sec: 10
cost: rl_reward
obs_goal_horizon: 1

# RL Reward
rew_state_weight: [10.0, 1.0, 10.0, 1.0, 1.0]
rew_act_weight: 2.0
rew_exponential: True

constraints:
- constraint_form: default_constraint
constrained_variable: state
upper_bounds:
- 2
- 1
- 2
- 1
- 0.2
lower_bounds:
- -2
- -1
- 0
- -1
- -0.2
- constraint_form: default_constraint
constrained_variable: input
upper_bounds:
- 0.58
- 0.8
lower_bounds:
- 0.06
- -0.8
done_on_out_of_bound: False
done_on_violation: False
880 changes: 880 additions & 0 deletions examples/rl/data_analysis.ipynb

Large diffs are not rendered by default.

Binary file added examples/rl/models/model_latest_ppo.pt
Binary file not shown.
Binary file added examples/rl/models/model_latest_sac.pt
Binary file not shown.
Binary file not shown.
140 changes: 140 additions & 0 deletions examples/rl/ppo_data/0/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
algo: ppo
algo_config:
activation: relu
actor_lr: 0.001
clip_obs: 10
clip_param: 0.2
clip_reward: 10
critic_lr: 0.001
deque_size: 10
entropy_coef: 0.01
eval_batch_size: 10
eval_interval: 2000
eval_save_best: true
gae_lambda: 0.95
gamma: 0.99
hidden_dim: 128
log_interval: 2000
max_env_steps: 200000
max_grad_norm: 0.5
mini_batch_size: 256
norm_obs: false
norm_reward: false
num_checkpoints: 0
num_workers: 1
opt_epochs: 20
rollout_batch_size: 4
rollout_steps: 1000
save_interval: 0
target_kl: 0.01
tensorboard: false
training: true
use_clipped_value: false
use_gae: true
device: cpu
kv_overrides:
- task_config.randomized_init=True
output_dir: ./ppo_data/0/
overrides:
- ./config_overrides/quadrotor_2D_attitude/ppo_quadrotor_2D_attitude.yaml
- ./config_overrides/quadrotor_2D_attitude/quadrotor_2D_attitude_track.yaml
restore: null
seed: 0
tag: temp
task: quadrotor
task_config:
adversary_disturbance: null
adversary_disturbance_offset: 0.0
adversary_disturbance_scale: 0.01
constraint_penalty: -1
constraints:
- constrained_variable: state
constraint_form: default_constraint
lower_bounds:
- -2
- -1
- 0
- -1
- -0.2
upper_bounds:
- 2
- 1
- 2
- 1
- 0.2
- constrained_variable: input
constraint_form: default_constraint
lower_bounds:
- 0.06
- -0.8
upper_bounds:
- 0.58
- 0.8
cost: rl_reward
ctrl_freq: 60
disturbances: null
done_on_out_of_bound: false
done_on_violation: false
episode_len_sec: 10
gui: false
inertial_prop:
Iyy: 1.4e-05
M: 0.027
inertial_prop_randomization_info: null
info_in_reset: true
init_state:
init_theta: 0
init_x: 0
init_x_dot: 0
init_z: 1.15
init_z_dot: 0
init_state_randomization_info:
init_theta:
distrib: uniform
high: 0.02
low: -0.02
init_x:
distrib: uniform
high: 0.01
low: -0.01
init_x_dot:
distrib: uniform
high: 0.01
low: -0.01
init_z:
distrib: uniform
high: 1.15
low: 1.15
init_z_dot:
distrib: uniform
high: 0.01
low: -0.01
norm_act_scale: 0.1
normalized_rl_action_space: false
obs_goal_horizon: 1
physics: pyb
pyb_freq: 1200
quad_type: 4
randomized_inertial_prop: false
randomized_init: true
rew_act_weight: 2.0
rew_exponential: true
rew_state_weight:
- 10.0
- 1.0
- 10.0
- 1.0
- 1.0
seed: 1337
task: traj_tracking
task_info:
num_cycles: 1
trajectory_plane: xz
trajectory_position_offset:
- 0
- 1.2
trajectory_scale: 0.5
trajectory_type: figure8
use_constraint_penalty: false
verbose: false
use_gpu: false
Binary file added examples/rl/ppo_data/0/model_best.pt
Binary file not shown.
Binary file added examples/rl/ppo_data/0/model_latest.pt
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/rl/ppo_data/0/plots/-stat-ep_length.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/rl/ppo_data/0/plots/-stat-ep_return.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/rl/ppo_data/0/plots/-stat-ep_reward.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/rl/ppo_data/0/plots/-stat_eval-mse.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/rl/ppo_data/0/plots/-time-progress.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/rl/ppo_data/0/plots/-time-step.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/rl/ppo_data/0/plots/-time-step_time.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bf9adae

Please sign in to comment.