This section gives information on the functions accessible via the KORTEX™ API MEX interface.
The MEX interface allows you to interact with and control the robot from a MATLAB script.
MEX interface function calls must be wrapped in a call to kortexApiMexInterface
, which provides an entry point to the MEX interface:
[function_output1, function_output2, ...] = kortexApiMexInterface('function name string', function_input1, ...);
Examples of use of the MEX interface can be seen in the example /mex-wrapper/tests_api_control.m
.
Examples can also be seen in the file kortex.m
. In that file, a kortex
MATLAB System object uses the KORTEX™ API MEX interface.
Note that all scripts should begin with a call to CreateRobotApisWrapper
, and end with a call to DestroyRobotApisWrapper
.
Robot initialization, configuration, & de-initialization
This function initializes the KORTEX™ API that operates underneath the MEX interface.
C++ Type
Description
char*
The IP address of the robot.
char*
The username that will initiate a session on the robot.
char*
The password linked to the username.
uint32_t
The session timeout.
uint32_t
The control timeout.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
uint32_t
An handle to the API. This handle will be needed by most of the function of this MEX interface.
uint32_t
The device ID of the vision module attached to the robot.
This function closes the connection with the KORTEX™ API cleanly.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Set the robot into admittance mode.
C++ Type
Description
uint32_t
API Handle.
int32_t
The desired AdmittanceMode .
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Set the robot servoing mode.
C++ Type
Description
uint32_t
API Handle.
int32_t
The desired ServoingMode .
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Emergency, troubleshooting, fault handling
Apply the emergency stop on the robot. The robot should stop moving and go to the fault state.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Try to clear the faults on the robot. If the robot is in a fault state, you should see a red LED on the robot's base.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Reboot the robot. Warning: the robot may fall slowly for a short time because during the reboot process, the joints stop the servoing process.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Stop the current trajectory.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Pause the current trajectory.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Resume the current trajectory.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Robot information, status, and feedback
Returns the joint count of the robot.
C++ Type
Description
uint32_t
The handle of the API.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
uint32_t
The joint count.
Returns the status of the robot.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
int32_t
Status of the robot. This value is described here .
It returns the feedback data from the base, the joints and tool.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
BaseFeedback
Feedback data for the base.
ActuatorsFeedback
Feedback data for each joint.
InterconnectFeedback
Feedback data for the interface module, including gripper.
Move the robot to a specific Cartesian pose. The orientation is represented with Euler angles and the convention used is the Tait-Bryan, extrinsic ZYX
C++ Type
Description
uint32_t
API Handle.
int32_t
The CartesianConstraintType applied on the movement.
double[2]
Speed limitation that will be applied on the trajectory if the constraint has been set to CARTESIAN_CONSTRAINT_SPEED. The first value is the translation velocity and the second value is the orientation velocity.
double
Not supported for now.
double[3]
Translation (X, Y, Z) in meters.
double[3]
Orientation. (X(gamma), Y(beta), Z(alpha)) in degrees. (Tait-Bryan, extrinsic ZYX )
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Move the robot to a specific joint pose.
C++ Type
Description
uint32_t
API Handle.
int32_t
The JointConstraintType applied on the movement.
double
Speed limitation, in degrees / second, that will be applied on the trajectory if the constrait has been set to JOINT_CONSTRAINT_SPEED.
double
Duration of the trajectory that will be applied on the trajectory if the constraint has been set to JOINT_CONSTRAINT_DURATION.
double[7]
An angle, in degrees, for each joint of the robot. The first index is the nearest joint to the base and the last index is the nearest joint to the gripper.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Move the robot using a speed command.
C++ Type
Description
uint32_t
API Handle.
double
Duration, in seconds, of the speed command.
double[7]
An speed command, in degrees / second, for each joint of the robot. The first index is nearest joint to the base and the last index is the nearest joint to the gripper.
uint32_t
Joint count.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Move the robot tool. For now, our gripper is considered as one tool so only one command (first index) is needed to move the tool.
C++ Type
Description
uint32_t
API Handle.
int32_t
The mode used to move the tool.
double
Duration constraint, in sec, of the tool command. If set to 0 then no cosntraint is applied.
double[10]
A command for each possible tool. Each command is a value between 0 and 1. 0 means fully opened and 1 means fully closed.
uint32_t
Tool count.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
PlayPreComputedTrajectory
Send a Precomputed Joint Trajectory to the robot. A Precomputed Joint Trajectory is a set of (timestamp, angular position, angular velocity, angular acceleration) for each joint at each increment of the trajectory. Together, this represents a trajectory. For more information on the Precomputed Joint Trajectories, you can read the documentation on Precomputed Joint Trajectories .
C++ Type
Description
uint32_t
API Handle.
int32_t
The desired TrajectoryContinuityMode .
double[7][30000]
A matrix that contains a list of angular positions (degrees) for each joint at each increment.
double[7][30000]
A matrix that contains a list of angular velocities (degrees / second) for each joint at each increment.
double[7][30000]
A matrix that contains a list of angular accelerations (degrees / second ^ squared) for each joint at each increment.
double[7][30000]
A matrix that contains a list of timestamps for each joint at each increment.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Vision module configuration
Configure one of the sensors (either 2D or 3D) of the vision module.
C++ Type
Description
uint32_t
API Handle.
int32_t
The sensor ID you want to configure. This value is described here .
int32_t
The desired resolution. See Resolution .
int32_t
The desired frame rate. See FrameRate .
int32_t
The desired bit rate. See BitRate .
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Configure a specific option out of the options available on the vision module.
C++ Type
Description
uint32_t
API Handle.
int32_t
The sensor ID you want to configure. See Sensor .
int32_t
The desired option. See Option .
double
The desired value of the specified option.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Initialize the vision module API.
C++ Type
Description
uint32_t
The handle of the API.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
Get the configuration of a specific sensor(2D or 3D) of the vision module.
C++ Type
Description
uint32_t
API Handle.
uint32_t
ID of the desired sensor. See Sensor .
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
uint32_t
The resolution of the sensor. See Resolution .
uint32_t
The frame rate of the sensor. See FrameRate .
uint32_t
The bit rate of the sensor. See BitRate .
Get the value of a specific option from a specific sensor (eitrher 2D or 3D) of the vision module.
C++ Type
Description
uint32_t
API Handle.
uint32_t
The desired sensor. See Sensor .
uint32_t
The desired option. See Option .
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
uint32_t
The resolution of the sensor. This value is described here .
uint32_t
The frame rate of the sensor. This value is described here .
uint32_t
The bit rate of the sensor. This value is described here .
Get the intrinsic parameters from a specific sensor (either 2D or 3D) of the vision module.
C++ Type
Description
uint32_t
API Handle.
uint32_t
The desired sensor. This value is described here .
C++ Type
Description
bool
A flag that tells if the operation was a success (true
) or not (false
).
ErrorStructMatrix
A data structure that contains the error code if the operation was not a success.
IntrinsicParameters
Sensor intrinsic parameters.
Get the extrinsic parameters of the vision module.
C++ Type
Description
uint32_t
API Handle
C++ Type
Description
bool
A flag that tells if the operation was a success (true
) or not (false
).
ErrorStructMatrix
A data structure that contains the error code if the operation was not a success.
ExtrinsicParameters
Sensor extrinsic parameters
Returns the last error that occurred in the API.
C++ Type
Description
uint32_t
API Handle.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
uint32_t
The error code of the last error triggered by the Kortex API.
Returns a string that describe the error code provided as an input.
C++ Type
Description
uint32_t
API Handle.
uint32_t
The error code that you want a name for.
C++ Type
Description
uint32_t
An error code (0
for success or non-zero for failure).
char *
The name that describe the error code.