Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3de948a
test commit
goldenhazard Jul 20, 2021
bfc141b
Merge branch 'support-no-symbolic' of https://github.com/ChoiJangho/C…
goldenhazard Jul 28, 2021
ec83b43
Branch open
goldenhazard Jul 29, 2021
c6e28e1
FL version support-no-symbolic
goldenhazard Jul 31, 2021
895fccf
temp
goldenhazard Jul 31, 2021
7d9263c
Trouble-shooting completed
goldenhazard Jul 31, 2021
0a80038
nonsymbolic support version - FL added
goldenhazard Jul 31, 2021
9892333
Merge branch 'support-no-symbolic' of https://github.com/ChoiJangho/C…
goldenhazard Aug 3, 2021
7d2217b
Rabbit CBF-CLF-Helper version 0 updated
goldenhazard Aug 11, 2021
077d804
model parameters integrated under anim folder
goldenhazard Aug 11, 2021
bae0d60
Settled animation issue
goldenhazard Aug 12, 2021
d9fb5ab
usage tutorial added
goldenhazard Aug 12, 2021
f0e7134
1. Deleted redundant directory
goldenhazard Aug 12, 2021
782b53a
1. Resolved the varargin, varargout issue
goldenhazard Sep 18, 2021
d532948
refactor controller function io and add general simulation interface.
ChoiJangho Oct 4, 2021
46f6554
1. rollout_controller_with_contact.m added
goldenhazard Oct 5, 2021
929b5ec
modify function headers and support vectorized input.
ChoiJangho Oct 8, 2021
ae4b6bb
version compatiblize
goldenhazard Oct 8, 2021
6dc074b
Rollout_controller with feedback linearized version updated
goldenhazard Oct 10, 2021
a8a46c3
Merge branch 'RABBIT' of https://github.com/ChoiJangho/CBF-CLF-Helper…
ChoiJangho Oct 12, 2021
a3318ea
change CtrlAffineSys controller function interface.
ChoiJangho Oct 12, 2021
8d37898
add macOS support for complied rabbit-helper functions.
ChoiJangho Oct 12, 2021
c745c82
refactor rollout interface for CtrlAffineSysFL and multiple reset sim…
ChoiJangho Oct 12, 2021
20d7d3b
fix bugs.
ChoiJangho Oct 13, 2021
bbb52e2
fix bugs.
ChoiJangho Oct 14, 2021
eec0a7e
1. rollout_controller_for_multiple_resets.m commented
goldenhazard Oct 14, 2021
5c93825
refactor weight handling (getting rid of params in default controller…
ChoiJangho Oct 19, 2021
8e01c88
support logging of extra fields in extraoutputs of the controllers.
ChoiJangho Oct 19, 2021
5d94e1c
Merge branch 'RABBIT' of https://github.com/ChoiJangho/CBF-CLF-Helper…
ChoiJangho Oct 19, 2021
b645c4c
1. get_force supports vector input now
goldenhazard Nov 15, 2021
6e57a09
flakes.
ChoiJangho Nov 19, 2021
a2059ce
mexa64 files added, recompiled
goldenhazard Nov 28, 2021
4010d95
flakes.
ChoiJangho Dec 20, 2021
289f39c
Merge branch 'RABBIT' of https://github.com/ChoiJangho/CBF-CLF-Helper…
ChoiJangho Dec 20, 2021
5d55479
version updated
goldenhazard Dec 29, 2021
e4a008b
version compatible
goldenhazard Jan 9, 2022
1336f74
perturb incorporated in RabbitBuiltIn Method
goldenhazard Jan 14, 2022
2691ab7
change file path.
ChoiJangho Jan 14, 2022
2553684
gen replaced separated in other file
goldenhazard Jan 16, 2022
076b188
trimmed
goldenhazard Jan 16, 2022
7150293
Merge branch 'RABBIT' of https://github.com/ChoiJangho/CBF-CLF-Helper…
ChoiJangho Jan 18, 2022
4bb3c61
rl-clf reviewed version
goldenhazard Jan 25, 2022
ac06093
Merge branch 'RABBIT' of https://github.com/ChoiJangho/CBF-CLF-Helper…
ChoiJangho Feb 2, 2022
d0021bb
remove dependency on 'params' and refactor 'ctrlClfQpFL'
ChoiJangho Feb 2, 2022
efc6079
fix small bugs.
ChoiJangho Feb 6, 2022
3de3342
add rabbit stepping stone demo.
ChoiJangho Feb 6, 2022
5baf467
add rabbit state history plot.
ChoiJangho Feb 6, 2022
a7eec07
Demurcated the cbf oriented params
goldenhazard Feb 13, 2022
2093439
add document.
ChoiJangho Feb 15, 2022
cd5581e
Merge branch 'RABBIT' of https://github.com/ChoiJangho/CBF-CLF-Helper…
ChoiJangho Feb 15, 2022
61316da
Update index.rst
ChoiJangho Feb 15, 2022
a91d262
Add documentation
jmonga-1675 Feb 15, 2022
48580d4
roll back accidental change
jmonga-1675 Feb 15, 2022
ee124a7
update docs
jmonga-1675 Feb 28, 2022
0173cb3
Kinematic Vehicle Added
goldenhazard Mar 27, 2022
eded84a
Added cartpole Quanser example. Corrected bug in init_sys
fercastaneda Apr 28, 2022
102a207
Added 2weights setting
fercastaneda May 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,166 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk

docs/_build/

.vscode/*

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
18 changes: 18 additions & 0 deletions demos/cart_pole/bo_loss_func.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function loss = bo_loss_func(y, x)
loss1 = -y^2;
loss2 = -(x(3)-pi)^2;
loss3 = -x(4)^2;
loss4 = -x(2)^2;
% fprintf("Loss: y_error: %.4f \t theta: %.4f \t dtheta: %.4f \t dx: %.4f \n", [loss1, loss2, loss3, loss4]);
% c1 = 1000;
c1 = 0;
% c2 = 1000;
% c2 = 200;
c2 = 100;
c3 = 1;
% c4 = 100;
c4 = 0;
fprintf("Loss: y_error: %.4f \t theta: %.4f \t dtheta: %.4f \t dx: %.4f \n", [c1 * loss1, c2 * loss2, c3 * loss3, c4 * loss4]);
loss = c1 * loss1 + c2 * loss2 + c3 * loss3 + c4 * loss4;

end
10 changes: 10 additions & 0 deletions demos/cart_pole/clip_theta.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function x_clipped = clip_theta(x)
x_clipped = x;
theta = x(3);
r = mod(theta, 2*pi);
if r > pi
x_clipped(3) = r - 2*pi;
else
x_clipped(3) = r;
end
end
52 changes: 52 additions & 0 deletions demos/cart_pole/init_settings_cart_pole.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
clear all;
close all;
dt = 0.01;

%% Direct CLF without FL works for these parameters.
% params.l = 1.0; % [m] length of pendulum
% params.m = 1.0; % [kg] mass of pendulum
% params.M = 1.0; % [kg] mass of cart
% params.g = 9.81; % [m/s^2] acceleration of gravity
% params.b = 0.1; % [s*Nm/rad] friction coefficient

params.l = 0.5; % [m] length of pendulum
params.m = 0.5; % [kg] mass of pendulum
params.M = 2.0; % [kg] mass of cart
params.g = 9.81; % [m/s^2] acceleration of gravity
params.b = 0.1; % [s*Nm/rad] friction coefficient

params.cbf.rate = 1;

u_bound = 50;
params.u_max = u_bound;
params.u_min = -u_bound;

params.ratio_u_diff = 0;
params.weight.slack = 1000;
%params.weight.input = eye(params.udim); % tune this to allocate different
%weight in each u coordinate
params.clf.rate = 1;

%% Feedback linearization specific params.
params.bezier = [-0.0630040307234950, ...
-2.94395202983077, ...
4.23655180750478, ...
-10.8954633332227, ...
13.3619387476085, ...
-13.4630778220299, ...
9.93449615595792, ...
-3.07150993759866, ...
3.86268687914481, ...
2.72221821558065, ...
3.15006153603993];
params.phase_max = 1;
params.phase_min = 0;
params.epsilon_FL = 0.015;
params.Kp_FL = 0.99;
params.Kd_FL = 2.0;

control_sys = CartPole(params);

plant_sys = CartPole(params);

settings.dt = dt;
21 changes: 21 additions & 0 deletions demos/cart_pole/main_cart_pole.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
init_settings_cart_pole;
verbose = 0;

with_slack = 1;
% initial state
% x0 = [0; 0; pi - 0.1; 0;];
x0 = [0; 0; 0.1; 0;];
% simulation time
sim_t = 3;


[xs, us, ts, Vs, ~, ~, ~, ~] = rollout_lyapunov_controller( ...
x0, plant_sys, control_sys, @control_sys.ctrlClfQp, dt, sim_t, with_slack, [], verbose);
results.vanilla.trajectory = xs;
results.vanilla.controls = us;
results.vanilla.stamps = ts;

draw_rollout(results.vanilla, 0, dt, plant_sys, control_sys, "Vanilla")

figure;
plot(ts, Vs);
Loading