Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Matlab API Driving UR10

Hi guys, please excuse my ignorance, i'm very new to RoboDK. I'm currently working on a project involving sorting parts using a vision system mounted to a UR10.

Im using Matlab to do some image acquisition and analysis, based on the outcome of the analysis, i need to call and run 1 of 5 preset programs on the UR10. 

So my question is, can i do this in the RoboDK API for Matlab, and if so, would anyone have an example of the code needed to connect to and drive the UR10 (i'm using a Ethernet connection to the control box).

i can currently run the simulation of the program through the API, and can run the program on the robot directly through RoboDK, but i cant seem to run the program on the robot using the API.

kind Regards,
Hi Jordan,

Yes, this is possible. You should be able to connect to a UR10 robot and move it directly from your Matlab code using the RoboDK API for Matlab.
I recommend you to take a look at this example (based on Python):

So a simplified version of this example for Matlab would look like this:
% Clear Matlab variables and screen
close all

% Generate a Robolink object RDK. This object interfaces with RoboDK.
RDK = Robolink;

% Get the robot item
robot = RDK.Item('UR10');

% Try to connect to the robot (make sure to first provide the IP in the RoboDK User Interface)
success = robot.Connect();
% success = robot.Connect(''); % Optionally specify the robot IP

% Check if you are properly connected to the robot
[status, status_msg] = robot.ConnectedState();
if status ~= Robolink.ROBOTCOM_READY
   fprintf(['Failed to connect to the robot:\n' , status_msg]);
   fprintf('\nPress enter to continue in simulation mode.\n');

% Set the TCP as a pose, in mm and radians (important for linear movements)

% Set the linear speed in mm/s

% Move the robot using Joint coordinates

% Move the robot using Cartesian target (pose)
pose = transl(750,0,500)*roty(90*pi/180);

I also recommend you to take the latest version of the Matlab API from this link (the Connect function was missing):
Thanks Albert! just what i needed.

kind regards,

Users browsing this thread:
1 Guest(s)