KUKA-KAWASAKI-Visualization Toolbox for Matlab®

Online Documentation

J. Otto, T. Schwatinski, T. Pawletta,

september 2011

1. General information

The toolbox can be used to interpret commands send from the MatlabKK-Robotic Toolbox and to visualize the behaviour of articulated robots. Currently Kuka KR3 and Kawasaki FSN003 robots are supported.

The MatalbKK-Robotic-Visualization Toolbox has to be executed by a Matlab-instance and acts as Visualization PC. The MatlabKK-Robotic Toolbox is executed by a second Matlab-instance and acts as Control PC. This can be either a PC in a local network or the Visualization PC itself. If both toolboxes run at the same PC, the communication is realized by the localhost. Otherwise you have to establish a common TCP/IP connection.

IMPORTANT NOTE: The MatlabKK-Robotic-Visualization Toolbox works only with TCP/IP, that is why you have always to connect the MatlabKK-Robotic Toolbox with "virtual Kawasaki robots". The specific virtual robot type (Kuka or Kawasaki) is defined within the MatlabKK-Robotic-Visualization Toolbox. For further details see the example in section 4.

2. Commands of the MatlabKK-Robotic-Visualization Toolbox

>>VirtualRobot.create(type, port, pose, {axis_property})

Command is used to configure the visualization server.

typestring'Kawasaki' or 'Kuka', used for selecting robot type
portnumberport of server
pose[x, y, z, a, b, c]cartesian position (x,y,z) and ZYZ orientation (a,b,c) of the base coordinate system of the robot
axis_property[1x6] vectorparameters of Matlab's 'axis'-command - size and position of the visualization-figure, default is fullscreen

>>VirtualRobot.repose_robot(robot, pose)

Command is used to rearrange any existing robot. It is used after the VirtualRobot.start_all command directly.

robotnumberconsecutive number of robots which have been added to the visualization server already
pose[x, y, z, a, b, c]cartesian position (x,y,z) and ZYZ orientation (a,b,c) of the base coordinate system of the robot

>>VirtualRobot.place_env(name, pose, {fc})
>>VirtualRobot.place_part(name, pose, {fc})


Commands are used to place environmental (.place_env) or movable (.place_part) models.

namestringname of the .mat-file for a model which stores x, y and z coordinates in seperated vectors
pose[x, y, z, a, b, c] vectorcartesian position (x,y,z) and ZYZ orientation (a,b,c) of the base coordinate system of a model
fc[1x3] vectorFaceColor property from Matlab

>>VirtualRobot.repose_env(num, pose)
>>VirtualRobot.repose_part(num, pose)


Commands are used to rearrange any environmental (.repose_env) or movable (.repose_part) model. Any repose command is used after the VirtualRobot.start_all command directly.

numnumberconsecutive number of environmental or movable models which have been loaded already
pose[x, y, z, a, b, c]cartesian position (x,y,z) and ZYZ orientation (a,b,c) of the base coordinate system of a model

>>VirtualRobot.start_all

starts the visualization of all robots defined by VirtualRobot.create

>>VirtualRobot.delete_all

finishes the visualization of all robots defined by VirtualRobot.create including deleting relevant timer-functions

3. Supported commands of the MatlabKK-Robotic Toolbox

(in conjunction with the MatlabKK-Robotic-Visualization Tbx)

rkillspecial kill command
rbrakepauses movenment
rstopstops movenment
rrunreactivation of robots
rset(..., 'interpreter', 'on')switch controller-interpreter on
rset(..., 'interpreter', 'off')switch controller-interpreter off
rset(..., 'interpreter', 'eraese')eraese buffers of controller-interpreter
rset(...)setting additional parameters like speed, acceleration and deceleration
Pose = rget(..., 'pose')get actual cartesian coordinates
Axis = rget(..., 'axis')get actual axis coordinates
target_position=rpoint(...)definition of points and trajecories
allowed parameters: ptp,lin,abs,rel,axis,pose,speed,acceleration,deceleration,wait
ID = rmove(..., target_position, ...)starts movenment of a robot to target-position
ID = rmove(..., 'home2' or 'home', ...)starts movenment of a robot to home or home2 position
specific signals interpreted from the visualization server only
rset(..., 'signal', [9, -10])open gripper
rset(..., 'signal', [-9, 10])close gripper
rset(..., 'signal', [99, 1])activate plot of the trajectory
rset(..., 'signal', [99, 0])deactivate plot of the trajectory

4. Simple example

The following example shows how several robots can be generated and controled using the MatlabKK-Robotic-Visualization Toolbox and the MatlabKK-Robotic Toolbox together on the same PC.

  1. Start two Matlab instances (one as Visualization PC and the other one as Control PC) on your computer.
  2. Check the Matlab path variable for both new toolboxes.
  3. Execute sequentially the following commands in the appropriate Matlab instance.
    Note: The Visualization PC waits after step 1 and step 3 max. two minutes(!) for connection with the Control PC (steps 2 and 4). In case of an error repeat the commands with a new port number (eg. 40002).
stepMatlab instance Visualization PC
with MatlabKK-Robotic-Visualization Tbx
Matlab instance Control PC
with MatlabKK-Robotic Tbx
1VirtualRobot.create('Kawasaki', 40000, [0, 0, 0, 0, 0, 0])
2r1=robot('open', 'Kawasaki', 'tcpip', 'localhost', 40000)
3VirtualRobot.create('Kuka', 40001,[500, 500, 0, 0, 0, 0])
4r2=robot('open', 'Kawasaki', 'tcpip', 'localhost', 40001)
5VirtualRobot.start_all
6rset(r2, 'signal', [99, 1]);
rmove(r1, 'home2');
rmove(r2, 'home2');
P1=rpoint(180, 0, 0, 0, 0, 0, 'axis', 'rel', 'ptp');
P2=rpoint(-180, 0, 0, 0, 0, 0, 'axis', 'rel', 'ptp');
rmove(r1, P1);
rmove(r2, P2);
7robot(r1, r2, 'close')
8VirtualRobot.delete_all

5. Advanced example

This example shows the usage of environmental and movable objects. In the following a Kawasaki robot performs a sorting task.

  1. Start two Matlab instances (one as Visualization PC and the other one as Control PC) on your computer.
  2. Check the Matlab path variable for both new toolboxes.
  3. Download neccessary files and copy them to appropriate working directories:
    • environmental parts: table.mat, base.mat -> copy to Visualization PC
    • movable parts: test_tube.mat -> copy to Visualization PC
    • (a Matlab script for creating the environmental and movable parts above can be downloaded here)
    • robot's programm code: waypoints.mat -> copy to Control PC
  4. Execute sequentially the following commands in the appropriate Matlab instance.
    Note: The Visualization PC waits after step 1 max. two minutes(!) for connection with the Control PC (step 2). In case of an error repeat both commands with a new port number (eg. 40001).
stepMatlab instance Visualization PC
with MatlabKK-Robotic-Visualization Tbx
Matlab instance Control PC
with MatlabKK-Robotic Tbx
1VirtualRobot.create('Kawasaki', 40000, [0, 0, 0, 0, 0, 0])
2r1=robot('open', 'Kawasaki', 'tcpip', 'localhost', 40000)
3VirtualRobot.start_all
4VirtualRobot.place_env('table', [0 -500 0 0 0 0]);
VirtualRobot.place_env('base', [200 -450 400 0 0 0], [0,1,0]);
VirtualRobot.place_env('base', [-200 -450 400 0 0 0], [0,1,0]);
VirtualRobot.place_env('base', [0 -450 400 0 0 0], [0,1,0]);
VirtualRobot.place_part('test_tube', [200 -450 425 0 0 0], [1,0,0]);
VirtualRobot.place_part('test_tube', [-200 -450 425 0 0 0], [1,0,0]);
view(45,45);
zoom(2);
5load waypoints;
6rmove(r1, waypoints);
7robot(r1, 'close')
8VirtualRobot.delete_all

Back to the MatlabKK-Robotic-Visualization Tbx Homepage