-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathstartup_robotology_superbuild.m.in
51 lines (42 loc) · 2.25 KB
/
startup_robotology_superbuild.m.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
%% startup_robotology_superbuild.m
%
% Run this script only once to permanently add the required folders for using
% MATLAB toolbox (e.g. WBToolbox, whole-body-controllers, matlab-whole-body-simulator) to your MATLAB path.
fprintf('\nMATLAB Toolbox\n');
installDir = '@YCM_EP_INSTALL_DIR@';
mexDir = [installDir, filesep, 'mex'];
simLibDir = [installDir, filesep, 'mex/+wbc/simulink'];
simLibMomVelDir = [installDir, filesep, 'mex/+wbc/simulink/MomentumVelocityControl'];
simModDir = [installDir, filesep, 'mex/+wbc/examples'];
shareDir = [installDir, filesep, 'share/WBToolbox'];
imgDir = [shareDir, filesep, 'images'];
mujocoDir = [installDir, filesep, 'mex/mujoco_simulink_blockset'];
for dirPath = {mexDir,simLibDir,simLibMomVelDir,simModDir,shareDir,imgDir,mujocoDir}
if exist(dirPath{1}, 'dir')
addpath(dirPath{1});
end
end
fileDir = userpath;
pathSeparatorLocation = strfind(fileDir, pathsep);
if isempty(fileDir)
error('Empty userpath. Please set the userpath before running this script');
elseif size(pathSeparatorLocation, 2) > 1
error('Multiple userpaths. Please set a single userpath before running this script');
end
if (~isempty(pathSeparatorLocation))
fileDir(pathSeparatorLocation) = [];
end
fprintf('Saving paths to %s\n\n', [fileDir, filesep, 'pathdef.m']);
if (~savepath([fileDir, filesep, 'pathdef.m']))
fprintf(['A file called pathdef.m has been created in your %s folder.\n', ...
'This should be enough to permanentely add all the MATLAB-Toolbox to ', ...
'your MATLAB installation.\n'], fileDir);
else
disp('There was an error generating pathdef.m To proceed please manually add the contents of variables mexDir, simLibDir, simModDir, shareDir and imgDir to your matlabpath');
end
% inform the user that it is possible to generate the goToWholeBodyControllers script
fprintf('\n');
fprintf(['INFO: if whole-body-controllers is part of your superbuild installation, you may \n', ...
'generate a file called ''goToWholeBodyControllers.m'' in your %s folder.\n', ...
'This will help to quickly reach the WBC-project folder after Matlab is launched.\n', ...
'To create the file, go to the ''WBC_SOURCE_DIR/config'' and run ''createGoToWBC.m.'' \n'], fileDir);