Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
jgillis committed Feb 23, 2025
1 parent 8aeb007 commit 3dd9d52
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
exclude:
- os: "macos-14"
python-version: "3.8"
exclude:
- os: "macos-13"
python-version: "3.13" # 'torch' unavailable
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -26,7 +29,7 @@ jobs:
channels: conda-forge,defaults
use-only-tar-bz2: true

- name: Activate conda environment
- name: Activate conda environment (non-Windows)
shell: bash -l {0}
run: |
conda create -n workshop_dirac python=${{ matrix.python-version }} -y --channel=defaults --override-channels
Expand All @@ -35,7 +38,7 @@ jobs:
echo "Conda environment activated"
if: "!contains(matrix.os, 'windows')"

- name: Activate conda environment
- name: Activate conda environment (Windows)
shell: bash -l {0}
run: |
conda create -n workshop_dirac python=${{ matrix.python-version }} -y --channel=defaults --override-channels
Expand Down
7 changes: 6 additions & 1 deletion NN_MPC/nnmpc_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
import rockit
import impact

import rockit

rockit.GlobalOptions.set_cmake_flags(['-G','Ninja','-DCMAKE_C_COMPILER=clang','-DCMAKE_CXX_COMPILER=clang'])

import Controllers
import Utility
importlib.reload(Controllers)
Expand Down Expand Up @@ -57,7 +61,7 @@
# Options
generate_mpc_data = True # generate new MPC data, if False load saved ones
train_nn = True # train new NNMPC, if False load saved one
save_outputs = True # save outputs simulations and NN model
save_outputs = False # save outputs simulations and NN model

# parameters for mass-spring-damper
model_name = 'spring_mass_damper' # name of the model (corresponding yaml file must be in the models folder)
Expand All @@ -84,6 +88,7 @@
# Init
sims_path = "results/"+model_name+"_MPC_sims.npz"
NN_path = "results/"+model_name+"_NNMPC"
os.makedirs("results",exist_ok=True)

mpc = Controllers.MPC()
model = mpc.add_model(model_name, "models/"+model_name+".yaml")
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Tutorial on Impact
casadi>=3.6.7
rockit-meco==0.6.0
impact-meco==0.4.1

# NN-MPC
pandas
torch
plotly
Expand Down

0 comments on commit 3dd9d52

Please sign in to comment.