Matlab与V-REP联合仿真 | Joint simulation of MATLAB and V-REP

Matlab与V-REP联合仿真

image-20190804123801237

  1. 新建matlab文件夹,将vrep根目录V-REP_PRO_EDU_V3_5_0_Mac/programming/remoteApiBindings/matlab/文件拷贝进去

  2. 拷贝完成会有以下文件

    image-20190720101023154

  3. Matlab中将remoteMatlabApi文件和子文件addpath

  4. 打开simpleTest.m,注意注释里面需要添加代码到V-REP UR5lua脚本中

    image-20190720101108045

  5. 打开V-REP,new scene,拖入一个UR5机械臂

    image-20190720101300478

    添加代码到lua中,保存修改

    simExtRemoteApiStart(19999)

    image-20190720101118626

  6. 运行V-REP仿真,再运行matlab的simpleTest.m,如下界面表示通信正常

    image-20190720101504743

V-REP 与 Matlab 通信的关键脚本代码如下:

% V-REP脚本:

simExtRemoteApiStart(19999)

% MATLAB端:

vrep=remApi(‘remoteApi’); % using the prototype file (remoteApiProto.m)
vrep.simxFinish(-1); % just in case, close all opened connections

clientID=vrep.simxStart(‘127.0.0.1’,19999,true,true,5000,5);

Reference:

User Manual:

http://www.coppeliarobotics.com/helpFiles/index.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章