1、安装工具箱
在网站:https://petercorke.com/下载需要的工具箱,然后解压工具箱拷贝到/Applications/MATLAB_R2023b.app/toolbox文件下,然后在matlab命令行中加入拷贝进去的工具箱的路径:addpath('/Applications/MATLAB_R2023b.app/toolbox/rvctools'),此时运行:rtbdemo,工具箱就可以正常的运行了:
运行显示界面
一般情况添加路径就可以了,但是有时候添加路径之后还是无法使用工具箱,此时就到工具箱中用matlab打开:startup_rvc.m文件,就可以正常运行了,最后在命令行中输入:savepath,将路径保存一下,下次打开matlab就可以自动的加载路径了。工具箱安装完结!
2、将工具箱添加到Simulink库浏览器中
在目录:toolbox/rvctools/robot/simulink下新建一个slblocks.m文件,文件内容如下:
function blkStruct = slblocks
%SLBLOCKS Defines a block library.
% Library's name. The name appears in the Library Browser's
% contents pane.
blkStruct.Name = ['Robot' sprintf(' ') 'ToolBox'];
% 'Robot' sprintf(' ') 'ToolBox'这个是在Simulink中显示的名称,可以自定义
% The function that will be called when the user double-clicks on
% the library's name. ;
blkStruct.OpenFcn = 'roblocks';
% The argument to be set as the Mask Display for the subsystem. You
% may comment this line out if no specific mask is desired.
% Example: blkStruct.MaskDisplay = 'plot([0:2*pi],sin([0:2*pi]));';
% No display for now.
% blkStruct.MaskDisplay = '';
% End of blocks
然后用MATLAB打开这个文件并且运行,显示如下就表示添加成功。
打开Simulink在库浏览器中就可以看到有这个工具箱了。
如果没有显示的话,右键任何一个工具箱模块,点击刷新库浏览器,就会显示出来了。