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

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