Skip to content

Commit

Permalink
Updating configs and cleaning up nl_mpsc
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico-PizarroBejarano committed Dec 6, 2024
1 parent 076393f commit 01fc8d1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
algo: ppo
algo_config:
# model args
hidden_dim: 128
activation: tanh
hidden_dim: 64
activation: relu

# loss args
gamma: 0.98
Expand All @@ -19,7 +19,7 @@ algo_config:
critic_lr: 0.001

# runner args
max_env_steps: 2640000
max_env_steps: 660000
rollout_batch_size: 1
rollout_steps: 660
eval_batch_size: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,10 @@ task_config:
# RL Reward
rew_state_weight: [10, 0.1, 10, 0.1, 0.1, 0.001]
rew_act_weight: [0.1, 0.1]
info_mse_metric_state_weight: [1, 0, 1, 0, 0, 0]
rew_exponential: True

# disturbances:
# observation:
# - disturbance_func: white_noise
# std: [5.6e-05, 1.5e-04, 2.9e-05, 8.0e-04, 1.3e-04, 3.6e-04, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

constraints:
- constraint_form: default_constraint
constrained_variable: state
upper_bounds: [ 0.9, 2, 1.45, 2, 0.75, 3]
lower_bounds: [-0.9, -2, 0.55, -2, -0.75, -3]
- constraint_form: default_constraint
constrained_variable: input

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

# loss args
gamma: 0.98
Expand All @@ -19,7 +19,7 @@ algo_config:
critic_lr: 0.001

# runner args
max_env_steps: 2640000
max_env_steps: 660000
rollout_batch_size: 1
rollout_steps: 660
eval_batch_size: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ task_config:
# RL Reward
rew_state_weight: [10, 0.1, 10, 0.1, 0.1, 0.001]
rew_act_weight: [0.1, 0.1]
info_mse_metric_state_weight: [1, 0, 1, 0, 0, 0]
rew_exponential: True

# disturbances:
# observation:
# - disturbance_func: white_noise
# std: [5.6e-05, 1.5e-04, 2.9e-05, 8.0e-04, 1.3e-04, 3.6e-04, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

constraints:
- constraint_form: default_constraint
constrained_variable: state
Expand Down
6 changes: 0 additions & 6 deletions safe_control_gym/safety_filters/mpsc/nl_mpsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,26 +990,20 @@ def setup_acados_optimizer(self):

# set cost module
ocp.cost.cost_type = 'LINEAR_LS'
ocp.cost.cost_type_e = 'LINEAR_LS'

Q_mat = np.zeros((nx, nx))
ocp.cost.W_e = np.zeros((nx, nx))
R_mat = np.eye(nu)
ocp.cost.W = block_diag(Q_mat, R_mat)

ocp.cost.Vx = np.zeros((ny, nx))
ocp.cost.Vu = np.zeros((ny, nu))
ocp.cost.Vu[nx:nx + nu, :] = np.eye(nu)
ocp.cost.Vx_e = np.eye(nx)

# Updated on each iteration
ocp.cost.yref = np.concatenate((self.model.X_EQ, self.model.U_EQ))
ocp.cost.yref_e = self.model.X_EQ

# set constraints
ocp.constraints.constr_type = 'BGH'
ocp.constraints.constr_type_e = 'BGH'

ocp.constraints.x0 = self.model.X_EQ
ocp.constraints.C = self.L_x
ocp.constraints.D = self.L_u
Expand Down

0 comments on commit 01fc8d1

Please sign in to comment.