Simulink Mex File Integration of UR Control with RTDE

Version 1.0.0 (37.6 KB) by SMEAC
Easy Universal Robot Control integration into simulink through a mex file project using the ur-rtde
18 Downloads
Updated 18 Jan 2024

View Simulink Mex File Integration of UR Control with RTDE on File Exchange

ur_rtde_mex

Simulink mex project for connecting a universal robot to matlab/simulink

File : mex_rtde_moveL.cpp

Abstract: An CPP-file S-function for Simulink to control a UR Robot

Inputs:

  • 1x6 TCPPose Target (X,Y,Z,RX,RY,RZ)

Outputs:

  • 1x6 TCPPose Actual (X,Y,Z,RX,RY,RZ)
  • 1x6 Q Actual (Q1, Q2, Q3, Q4, Q5, Q6)

Parameters:

  • Speed of Robot
  • Accel of Robot
  • Sample Time of s-Function
  • string IP Address of Robot

Example Parameter List: 3 5 0.05 '192.168.255.128'

Notes for compilation:

This file needs to be compiled against the ur-rtde and boost libraries

Link for ur-rtde here: https://gitlab.com/sdurobotics/ur_rtde Link for boost here: https://www.boost.org/

Tested are the following versions:

  • Microsoft Visual C++ 2019

  • Matlab 2023b

  • URSim Virtual 5.14.6

  • Boost Version 1.84.0

  • ur_rtde Branch Version: bbbd7a42 IMPORTANT!!!! In order to maintain Real-time performance, the branch needs to be modified in accordance with Issue 151. https://gitlab.com/sdurobotics/ur_rtde/-/issues/151 Although the solution is in a submitted merge request, it is not solved in the current Master. Solution: Comment out break at line 518 in rtde.cpp

                   }
                   robot_state->unlockUpdateStateMutex();
    
                   //break;
               }                             
    

My Compiler function:

 mex -r2018a mex_rtde_moveL.cpp ...
        -IC:\Users\Gavin\source\repos\ur_rtde\include ...
        -IC:\dev\boost_1_84_0 ...
        -LC:\Users\Gavin\source\repos\ur_rtde-build\Release ...
        -lrtde.lib ...
        -LC:\dev\boost_1_84_0\bin.v2\libs\thread\build\msvc-14.3\release\link-static\threadapi-win32\threading-multi ...
        -LC:\dev\boost_1_84_0\bin.v2\libs\system\build\msvc-14.3\release\link-static\threading-multi ...
        -llibboost_system-vc143-mt-x64-1_84.lib ...
        -llibboost_thread-vc143-mt-x64-1_84.lib 

Copyright Gavin Kane 2023

Cite As

SMEAC (2024). Simulink Mex File Integration of UR Control with RTDE (https://github.com/SMEAC/ur_rtde_mex), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2023b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Versions that use the GitHub default branch cannot be downloaded

Version Published Release Notes
1.0.0

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.