Skip to content

MATLAB IndyDCP client

Overview

Indy Toolbox is a set of MATLAB functions for users to interface with Indy Framework 2.0 and control Indy robots. Beneath the top-level directory, there are multiple files and subdirectories:

  • core : It contains functions and scripts to setup and handle communication with Indy Framework.

  • simplecommand : Functions to send simple commands to Indy Framework.
    Simple commands mostly do not require input parameters and complex feedbacks.

  • mediumcommand : Functions to send medium commands to Indy Framework.
    Medium commands mostly require a few of input parameters and no complex feedbacks.

  • extendedcommand : Functions to send extended commands to Indy Framework.
    Extended commands require very long input parameters such as a list of waypoints or interpolated trajectory.

  • getcommand : Functions to send request-data commands to Indy Framework.
    Users use Get commands to retrieve robot current status such as joint positions and velocities.

  • example : Sample scripts demonstrate how to use extended commands.

  • startup_toolbox.m : This script adds all subdirectories above to the MATLAB search path.

Installation

The Indy Toolbox is freely available from the Github repository. Installation can be performed by following two steps.

  • Clone the repository using any Git tool.

  • Execute the startup_toolbox.m script located in the top-level directory to add the toolbox to your MATLAB path.

Configuration

The Indy Toolbox operates on computers with MATLAB installed. It is compatible with most of MATLAB versions. Furthermore, the toolbox requires Ethernet connection to IndyCB, which is control box of Indy, in order to transfer commands and robot status. After installation, the Indy Toolbox can be used immediately without any further configuration.

Socket Connection

The Indy Toolkit communicates with Indy Framework via an Indy-DCP-based socket connection. Therefore, configuration information for the socket is required and set inside the SetupConnection.m script in the ** folder. Before executing the script, let us look at its content shown in the Code for more details.

  • RobotName : Name of Indy model (e.g. NRMK-Indy7 for Indy7 model)
  • IPAddress : IP Address of STEP (i.e., control box)
  • Port : TCP Port number (6066)
  • Connection : This global object will handle socket connection with Indy Framework since this script is executed.
  • IndyDCPConnect : Start a connection to IndyDCP server on STEP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
RobotName = "NRMK-Indy7"
IPAddress = "192.168.10.108"
Port = 6066

global Connection;
Connection.robotName = RobotName;
Connection.sock = 0;
Connection.invokeID = 0;

IndyDCPConnect(IPAddress, Port)

Stop Socket Connection

In the core folder, there is another script named CleanupConnection.m to terminate connection and clean internal variables. This script should be executed before closing the system.

Call Toolkit Functions

All functions of the Indy Toolkit are separated into four groups: simplecommand, mediumcommand, extendedcommand, and getcommand as explained in the previous section. The functions must be called after connection is established. Each function is implemented in a file with the same name. Users are free to look at and modify the content of the functions.

Run examples


Before using the Indy Toolkit, be sure the Indy Framework operating in STEP.

By assuming that the robot model is Indy7 and IP address is 192.168.10.10.108 as in the Code, let us setup workspace and socket connection as below.

1
2
3
startup_toolbox; % Setup current directory to MATLAB path

SetupConnection; % Make a connection to Indy DCP server    

Call a simple function (e.g. Move to Home position)

1
MoveHome(); % Send a move-home command to Indy Framework

Call a medium command (e.g. Move to absolute joint-space target)

1
2
3
qTar = [0, 10, 50, 0, 70, 0]; % DEGREE

MoveJointTo(qTar);          

Get robot's joint positions and velocities via a getting command

1
2
3
position = GetJointPosition();

velocity = GetJointVelocity();

Execute a list of waypoints via an extended command

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
q1 = [0, 0, 0, 0, 0, 0];

q2 = [0, 0, -45, 0, 0, 0];

q3 = [0, -30, -45, 0, 0, 0];

q4 = [0, -30, -45, 0, 20, 0];

waypoints = [q1; q2; q3; q4];

MoveJointWaypoints(waypoints);            

Close socket connection

1
CleanupConnection();

Indy Dedicated TCP/IP Protocol

Indy Dedicated TCI/IP Protocol (Indy DCP) is the main protocol for Indy Toolkit to communicate with Indy Framework. In general, the IndyDCP requires following information to handle the connection. Please refer to IndyDCP protocol for more details about the protocol.

  • IPAddress : IP Address of STEP

  • Port : Port number of Indy DCP socket

  • Robot Name : Reserved name of Indy model. "NRMK-IndyRP" is for IndyRP and "NRMK-Indy7" is for Indy7.

  • Invoke ID : ID of sending requests

To ease users' work, there is a global connection variable in which those settings are maintained during the whole connection time. As a result, users only need to set the information in the SetupConnection.m script and let the system do the rest.

Simple, Medium, and Get Commands

Simple, Medium, and Get commands are the APIs users may try at first to get used to the Indy Toolkit. They are called in the same way as other MATLAB functions. Below list is the APIs and their detail description.

  • MoveHome.m : Move to pre-defined home position.

  • MoveZero.m : Move to zero position where all joint angles are zero.

  • StopSlow.m : Stop robot motion within a short time.

  • StopEmergency.m : Stop robot motion immediately.

  • ResetRobot.m : Soft recover robot from emergency events.

  • SetDirectTeaching.m : Set robot to gravity compensation mode.

  • FinishDirectTeaching.m : Set robot back to joint-space control mode.

  • MoveJointTo.m : Move to absolute joint-space position (degree)

  • MoveJointBy.m : Move to relative joint-space position (degree)

  • MoveTaskTo.m : Move to absolute 6D-space position (meter, degree)

  • MoveTaskBy.m : Move to relative 6D-space position (meter, degree)

  • IsRobotReady.m : Retrieve robot status whether it is ready for operation or not

  • GetJointPosition.m : Retrieve current joint angles (degree)

  • GetJointVelocity.m : Retrieve current joint velocities (degree/s)

  • GetTooltipPosition.m : Retrieve the Tool Center Point (TCP) position with respect to global coordinate (meter, degree)

Extended Commands

Currently, the Indy Toolkit provides users with two extended APIs for joint space. The MoveJointWaypoints is for motion through high-level waypoints while the MoveExtendedTrajectory is for low-level interpolated points. The usage of MoveJointWaypoints was described in the previous section. Below example is about MoveExtendedTrajectory.

The Code script demonstrates how to test an algorithm of trajectory interpolation developed in MATLAB on Indy robot. In the example, vel_profile_interpolation is supposed to be a newly developed velocity-profile interpolation. It receives start and goal states including start position and velocity and target velocity and acceleration as input. Then, the vel_profile_interpolation calculates desired positions, velocities, and accelerations at each cycle and stores all data into pd, vd, and ad arrays respectively. Finally, the MoveExtendedTrajectory function is called to send those arrays to Indy Framework for execution.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
% Check robot status
if (IsRobotReady() ~= 1)
    disp("Robot is not ready!\n");
end

% Start State
DOF = 6;
DELT = 250e-6;
start.t = 0;
start.pos = GetJointPosition();
start.vel = GetJointVelocity();

% Goal State
goal.t = 2;
goal.vel = [70, 60, 50, 20, 25, 30] % deg/s;
goal.acc = [15, 15, 15, 15, 15, 15] % deg/s^2;

[pd, vd, ad] = vel_profile_interpolation(DELT, start, goal);

% Plotting Data
t = start.t:DELT:(goal.t+2);
plot_data(t, pd, vd)

% Send to Indy
MoveExtendedTrajectory(DELT, pd, vd, ad);

Figures below shows experimental results of extended trajectory interpolation on Indy robot. The first figure draws computed trajectory (i.e. positions and velocities) of vel_profile_interpolation while the other figure is a capture of recorded trajectory of the Indy after the MoveExtendedTrajectory is called. The similarity of two figures proves that the MATLAB-based developed trajectory was executed correctly on Indy robot.


Extended trajectory data


Recorded joints' motion while executing extended trajectory