Skip to content

Commit

Permalink
Whole-Body-Controllers Release 2.5.1 (#108)
Browse files Browse the repository at this point in the history
* added a new momentum-velocity controller

* cleanup of the WCB simulink library

* improvements in velocity controller (#104)

* improvements in velocity controller

* added new line at the end of the files

* Velocity Controller-Relax Momentum Constraint  (#107)

* fixes centroidalTransformaion and ComputeReferencesController

* fixed some typos, removed hardcoded variables, clean up

* fixed indeces for velocity limits

* minor fixes

Co-authored-by: Giuseppe <[email protected]>
Co-authored-by: CarlottaSartore <[email protected]>
  • Loading branch information
3 people authored Mar 26, 2021
1 parent e505003 commit 6e9a676
Show file tree
Hide file tree
Showing 32 changed files with 3,604 additions and 10,304 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ slprj/
# Simulink slx
*.slxc
*.slx
!/library/simulink-library/*.slx
!/library/simulink-library/*/*.slx

# Matlab binary .mat files
*.mat
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The repository contains `Simulink-based whole-body controllers` developed to con
This repository depends upon the following Software:

- [CMake](https://cmake.org/), at least version **3.5**.
- [Matlab/Simulink](https://it.mathworks.com/products/matlab.html), default version **R2017b**.
- [Matlab/Simulink](https://it.mathworks.com/products/matlab.html), default version **R2019b**.
- [WB-Toolbox](https://github.com/robotology/WB-Toolbox) and [blockfactory](https://github.com/robotology/blockfactory).
- [Gazebo Simulator](http://gazebosim.org/), default version **9.0**.
- [gazebo-yarp-plugins](https://github.com/robotology/gazebo-yarp-plugins).
Expand Down
46 changes: 38 additions & 8 deletions config/export_WBC.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
%% export_WBC.m
%
% Export Simulink models to a previous supported version. Currently,
% the default version is MATLAB 2017b. IF YOU OWE A MATLAB VERSION GREATER
% THAN 2017B, REMEMBER TO EXPORT ALL MODELS TO THE DEFAULT SUPPORTED
% the default version is MATLAB 2019b. IF YOU OWE A MATLAB VERSION GREATER
% THAN 2019B, REMEMBER TO EXPORT ALL MODELS TO THE DEFAULT SUPPORTED
% VERSION BEFORE PUBLISHING ANY MODIFICATIONS, OTHERWISE OTHER USERS MAY
% NOT BE ABLE TO USE THE MODELS!
%
Expand All @@ -12,6 +12,7 @@

fprintf('\nwhole-body-controllers\n');
fprintf('\nExport project to a previous Matlab version\n');
fprintf('\nWBC Default version: R2019b\n');
fprintf('\nOldest supported version: R2014a\n');

fprintf('\n######################################################\n');
Expand All @@ -21,19 +22,20 @@
fprintf('\nmay still not work properly.\n');
fprintf('\n######################################################\n\n');

% list of all simulink models (in this repo only .mdl are allowed) in the project
% list of all simulink mdl and slx in the project
mdlList = dir('../**/*.mdl');
slxList = dir('../**/*.slx');

% matlab version to which export all models
matlabVer = input('Specify the Matlab version to export models (format: R20XXx) ','s');

%% Verify matlab version

% latest version: R2018a
matlabVer_list = {'R2014a','R2014b','R2015a','R2015b','R2016a','R2016b','R2017a','R2017b','R2018a'};
% latest version: R2019b
matlabVer_list = {'R2014a','R2014b','R2015a','R2015b','R2016a','R2016b','R2017a','R2017b','R2018a','R2018b','R2019a','R2019b'};

% associated Simulink version
simulinkVer_number = {'8.3','8.4','8.5','8.6','8.7','8.8','8.9','9.0','9.1'};
simulinkVer_number = {'8.3','8.4','8.5','8.6','8.7','8.8','8.9','9.0','9.1','9.2','9.3','10.0'};

% installed Simulink version
currentSimulinkVer = ver('Simulink');
Expand Down Expand Up @@ -65,14 +67,15 @@
end

%% Load the Simulink models and export to previous versions
mdlVer_list = {'R2014A_MDL','R2014B_MDL','R2015A_MDL','R2015B_MDL','R2016A_MDL','R2016B_MDL','R2017A_MDL','R2017B_MDL','R2018A_MDL'};
mdlVer_list = {'R2014A_MDL','R2014B_MDL','R2015A_MDL','R2015B_MDL','R2016A_MDL','R2016B_MDL','R2017A_MDL','R2017B_MDL','R2018A_MDL','R2018B_MDL','R2019A_MDL','R2019B_MDL'};
slxVer_list = {'R2014A_SLX','R2014B_SLX','R2015A_SLX','R2015B_SLX','R2016A_SLX','R2016B_SLX','R2017A_SLX','R2017B_SLX','R2018A_SLX','R2018B_SLX','R2019A_SLX','R2019B_SLX'};

% close all open models (if there is any)
close_system('',0)

for k = 1:length(mdlList)

fprintf(['\nLOADED MODEL: ' mdlList(k).name '\n']);
fprintf(['\nLOADED MDL FILE: ' mdlList(k).name '\n']);
open_system([mdlList(k).folder,'/',mdlList(k).name],'loadonly');

% save the model in a temporary copy. Then, export the copy into
Expand All @@ -97,5 +100,32 @@
% delete the temporary model
delete([mdlList(k).folder,'/',mdlList(k).name(1:end-4),'_temp.mdl'])
end
for k = 1:length(slxList)

fprintf(['\nLOADED SLX FILE: ' slxList(k).name '\n']);
open_system([slxList(k).folder,'/',slxList(k).name],'loadonly');

% save the model in a temporary copy. Then, export the copy into
% the previous version, by overwriting the original model
fprintf('\n saving a temporary copy of the model \n\n');
save_system([slxList(k).folder,'/',slxList(k).name], [slxList(k).folder,'/',slxList(k).name(1:end-4),'_temp.slx']);
close_system([slxList(k).folder,'/',slxList(k).name],0);
open_system([slxList(k).folder,'/',slxList(k).name(1:end-4),'_temp.slx'],'loadonly');

% do not export if simulink models are already at the required version
if str2double(simulinkVer_number{matlabVer_found}) == str2double(currentSimulinkVer.Version)

fprintf('\n model is already at the required version. \n');
else
save_system([slxList(k).folder,'/',slxList(k).name(1:end-4),'_temp.slx'], [slxList(k).folder,'/',slxList(k).name], 'ExportToVersion', slxVer_list{matlabVer_found});
end

% closing the temporary model
fprintf('\n closing the model \n');
close_system([slxList(k).folder,'/',slxList(k).name(1:end-4),'_temp.slx']);

% delete the temporary model
delete([slxList(k).folder,'/',slxList(k).name(1:end-4),'_temp.slx'])
end

fprintf('\nDone.\n');
7 changes: 7 additions & 0 deletions config/startup_WBC.m.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ pathToInstallDir = '@CMAKE_INSTALL_PREFIX@';

% path to the matlab-wbc library
pathToLibrary = [pathToInstallDir, filesep, 'mex'];
pathToSimLib = [pathToInstallDir, filesep, 'mex/+wbc/simulink'];

if exist(pathToLibrary, 'dir')

addpath(pathToLibrary);
else
error('Path to the "+wbc" library not found or not correct.')
end
if exist(pathToSimLib, 'dir')

addpath(pathToSimLib);
else
error('Path to the "+wbc/simulink" library not found or not correct.')
end

% Path to the Matlab userpath
pathToUserpath = userpath;
Expand Down
Loading

0 comments on commit 6e9a676

Please sign in to comment.