Skip to content

Commit

Permalink
Adding results when trajectory in y is restricted to -0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico-PizarroBejarano committed Feb 29, 2024
1 parent 98b5e8b commit 4bb6f47
Show file tree
Hide file tree
Showing 180 changed files with 2,491 additions and 25 deletions.
4 changes: 2 additions & 2 deletions experiments/crazyflie/config_overrides/crazyflie_track.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ task_config:
init_state_randomization_info:
init_x:
distrib: 'uniform'
low: -0.95
low: -0.5
high: 0.95
init_x_dot:
distrib: 'uniform'
Expand Down Expand Up @@ -121,7 +121,7 @@ task_config:
- 0.25
- 0.25
lower_bounds:
- -0.95
- -0.5
- -2
- -0.95
- -2
Expand Down
2 changes: 1 addition & 1 deletion experiments/crazyflie/crazyflie_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
'constrained_variable': 'state',
'active_dims': [0,1,2,3,6,7],
'upper_bounds': [0.95, 2, 0.95, 2, 0.25, 0.25],
'lower_bounds': [-0.95, -2, -0.95, -2, -0.25, -0.25]},
'lower_bounds': [-0.5, -2, -0.95, -2, -0.25, -0.25]},
{'constraint_form': 'default_constraint',
'constrained_variable': 'input',
}
Expand Down
2 changes: 1 addition & 1 deletion experiments/crazyflie/crazyflie_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def calc_error(CTRL_FREQ, TEST=0, CERTIFIED=False, MODEL='none'):
reward = np.sum(np.exp(-dist))

print('Model Errors: ', np.linalg.norm(errors))
print('NUM ERRORS POS: ', np.sum(np.abs(states[:, [0,2]]) >= 0.95))
print('NUM ERRORS POS: ', np.sum(states[:, [0,2]] >= 0.95) + np.sum(states[:, [0,2]] <= [-0.5, -0.95]))
print('NUM ERRORS VEL: ', np.sum(np.abs(states[:, [1,3]]) >= 2))
print('NUM ERRORS ANGLE: ', np.sum(np.abs(states[:, [6,7]]) >= 0.25))
print('Rate of change (inputs): ', np.linalg.norm(get_discrete_derivative(actions.reshape(-1, 1), CTRL_FREQ)))
Expand Down
246 changes: 246 additions & 0 deletions experiments/crazyflie/models/rl_models/ppo/mpsf_0.1_dm_t1/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
algo: ppo
algo_config:
activation: tanh
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: 12500
eval_save_best: true
filter_train_actions: true
gae_lambda: 0.95
gamma: 0.99
hidden_dim: 128
log_interval: 12500
max_env_steps: 250000
max_grad_norm: 0.5
mini_batch_size: 256
norm_obs: false
norm_reward: false
num_checkpoints: 0
num_workers: 1
opt_epochs: 20
penalize_sf_diff: true
rollout_batch_size: 1
rollout_steps: 1000
save_interval: 0
sf_penalty: 0.1
target_kl: 0.01
tensorboard: false
training: true
use_clipped_value: false
use_gae: true
use_safe_reset: true
device: cpu
kv_overrides:
- sf_config.cost_function=one_step_cost
- algo_config.filter_train_actions=True
- algo_config.penalize_sf_diff=True
- algo_config.use_safe_reset=True
- algo_config.sf_penalty=0.1
- task_config.use_constraint_penalty=False
output_dir: ./models/rl_models/ppo/mpsf_0.1_dm_t1
overrides:
- ./config_overrides/crazyflie_track.yaml
- ./config_overrides/ppo_crazyflie.yaml
- ./config_overrides/nl_mpsc.yaml
restore: null
safety_filter: nl_mpsc
seed: null
sf_config:
cost_function: one_step_cost
decay_factor: 0.85
horizon: 10
integration_algo: rk4
mpsc_cost_horizon: 5
n_samples: 600
prior_info:
prior_prop: null
prior_prop_rand_info: null
randomize_prior_prop: false
q_lin:
- 0.008
- 1.85
- 0.008
- 1.85
- 10
- 10
r_lin:
- 2
use_acados: true
use_terminal_set: false
warmstart: true
tag: temp
task: quadrotor
task_config:
adversary_disturbance: null
adversary_disturbance_offset: 0.0
adversary_disturbance_scale: 0.01
camera_view:
- 5
- -40
- -40
- 0.5
- -1
- 0.5
constraint_penalty: -1
constraints:
- active_dims:
- 0
- 1
- 2
- 3
- 6
- 7
constrained_variable: state
constraint_form: bounded_constraint
lower_bounds:
- -0.5
- -2
- -0.95
- -2
- -0.25
- -0.25
upper_bounds:
- 0.95
- 2
- 0.95
- 2
- 0.25
- 0.25
- constrained_variable: input
constraint_form: default_constraint
cost: quadratic
ctrl_freq: 500
disturbances:
dynamics:
- disturbance_func: white_noise
std: 0.2
observation:
- disturbance_func: white_noise
std: 0.002
done_on_out_of_bound: true
done_on_violation: false
episode_len_sec: 15
gui: false
inertial_prop:
Ixx: 1.4e-05
Iyy: 1.4e-05
Izz: 2.17e-05
M: 0.0345
inertial_prop_randomization_info:
Ixx:
distrib: uniform
high: 1.0e-06
low: -1.0e-06
Iyy:
distrib: uniform
high: 1.0e-06
low: -1.0e-06
Izz:
distrib: uniform
high: 1.0e-06
low: -1.0e-06
M:
distrib: uniform
high: 0.0025
low: -0.0025
info_in_reset: true
init_state:
init_p: 0
init_phi: 0
init_psi: 0
init_q: 0
init_r: 0
init_theta: 0
init_x: 0
init_x_dot: 0
init_y: 0
init_y_dot: 0
init_z: 1
init_z_dot: 0
init_state_randomization_info:
init_p:
distrib: uniform
high: 0.5
low: -0.5
init_phi:
distrib: uniform
high: 0.25
low: -0.25
init_psi:
distrib: uniform
high: 0
low: 0
init_q:
distrib: uniform
high: 0.5
low: -0.5
init_r:
distrib: uniform
high: 0
low: 0
init_theta:
distrib: uniform
high: 0.25
low: -0.25
init_x:
distrib: uniform
high: 0.95
low: -0.5
init_x_dot:
distrib: uniform
high: 2
low: -2
init_y:
distrib: uniform
high: 0.95
low: -0.95
init_y_dot:
distrib: uniform
high: 2
low: -2
init_z:
distrib: uniform
high: 1
low: 1
init_z_dot:
distrib: uniform
high: 0
low: 0
norm_act_scale: 0.1
normalized_rl_action_space: false
obs_goal_horizon: 0
physics: pyb
pyb_freq: 1000
quad_type: 3
randomized_inertial_prop: true
randomized_init: false
rew_act_weight: 0.0001
rew_exponential: true
rew_state_weight: 1.0
seed: 1337
task: traj_tracking
task_info:
num_cycles: 1
proj_normal:
- 0
- 1
- 1
proj_point:
- 0
- 0
- 0.5
trajectory_plane: xz
trajectory_position_offset:
- 0
- 1
trajectory_scale: 1
trajectory_type: figure8
use_constraint_penalty: false
verbose: false
use_gpu: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,loss/approx_kl
25000,0.015373280962618687
50000,0.005466316675301641
75000,0.007334801884523281
100000,0.008855676196981221
125000,0.007131252387383333
150000,0.016024184126096467
175000,0.02016867712372914
200000,0.014259486020697903
225000,0.027465859936395037
250000,0.018274522332164148
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,loss/entropy_loss
25000,-1.9422575136025746
50000,-1.9314473847548168
75000,-1.718100424607595
100000,-1.6027250786622367
125000,-1.4119963268438975
150000,-1.5207090298334758
175000,-1.4677082558472954
200000,-1.476611814896266
225000,-1.4850205163160959
250000,-1.5199606776237486
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,loss/policy_loss
25000,-0.008487398050761605
50000,-0.00880940280480252
75000,-0.009933911955918398
100000,-0.005607683146801758
125000,-0.004757624400151668
150000,-0.003386248358056189
175000,-0.002005064096720082
200000,-0.005854441330401723
225000,0.004003693091684401
250000,-0.010062139415958049
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,loss/value_loss
25000,7.793937429077428
50000,13.893374047401428
75000,23.89295015323139
100000,19.281110565347028
125000,27.118762816218055
150000,12.193586144909709
175000,18.288683568642096
200000,11.609428511226813
225000,5.738791902706543
250000,4.967841796357956
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,stat/ep_constraint_violation
25000,309.5
50000,126.5
75000,100.5
100000,105.5
125000,219.0
150000,31.5
175000,34.5
200000,31.5
225000,18.5
250000,12.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,stat/ep_length
25000,375.0
50000,375.0
75000,375.0
100000,375.0
125000,375.0
150000,375.0
175000,375.0
200000,375.0
225000,375.0
250000,375.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,stat/ep_return
25000,98.29296866306379
50000,204.49077267324304
75000,231.51700314647044
100000,244.08289157053508
125000,204.9318586508445
150000,267.52341422784
175000,279.615252885838
200000,282.54841177443075
225000,291.78329345184795
250000,277.8975227464764
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,stat/ep_reward
25000,0.26211458310150343
50000,0.5453087271286481
75000,0.6173786750572545
100000,0.6508877108547602
125000,0.546484956402252
150000,0.71339577127424
175000,0.7456406743622347
200000,0.7534624313984821
225000,0.7780887825382612
250000,0.7410600606572704
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
step,stat_eval/constraint_violation
25000,313.8
50000,149.9
75000,77.5
100000,49.6
125000,81.0
150000,54.2
175000,14.0
200000,20.4
225000,6.3
250000,8.9
Loading

0 comments on commit 4bb6f47

Please sign in to comment.