Show / Hide Table of Contents

Interface IItem

Namespace:RoboDk.API
Assembly: RoboDkApi.dll
Syntax
public interface IItem

Properties

|Improve this Doc View Source

项Id

Declaration
long ItemId { get; }
Property Value
Type Description
long

Methods

|Improve this Doc View Source

AddCurve(Mat, bool, ProjectionType)

Adds a curve provided point coordinates. The provided points must be a list of vertices. A vertex normal can be provided optionally.

Declaration
IItem AddCurve(Mat curvePoints, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
Type Name Description
Mat curvePoints

matrix 3xN or 6xN -> N must be multiple of 3

bool addToRef

add_to_ref -> If True, the curve will be added as part of the object in the RoboDK item tree

ProjectionType projectionType

Type of projection. For example: PROJECTION_ALONG_NORMAL_RECALC will project along the point normal and recalculate the normal vector on the surface projected.

Returns
Type Description
IItem

returns the object where the curve was added or null if failed

|Improve this Doc View Source

AddCustomInstruction(string, string, string, bool, string)

Add a custom instruction. This instruction will execute a Python file or an executable file.

Declaration
void AddCustomInstruction(string name, string pathRun, string pathIcon = "", bool blocking = true, string cmdRunOnRobot = "")
Parameters
Type Name Description
string name
string pathRun

path to run(relative to RoboDK/bin folder or absolute path)

string pathIcon

icon path(relative to RoboDK/bin folder or absolute path)

bool blocking

True if blocking, 0 if it is a non blocking executable trigger

string cmdRunOnRobot

Command to run through the driver when connected to the robot

|Improve this Doc View Source

AddMoveJ(IItem)

Adds a new robot move joint instruction to a program. Obsolete. Use MoveJ instead.

Declaration
void AddMoveJ(IItem itemtarget)
Parameters
Type Name Description
IItem itemtarget

target to move to

|Improve this Doc View Source

AddMoveL(IItem)

Adds a new robot move linear instruction to a program. Obsolete. Use MoveL instead.

Declaration
void AddMoveL(IItem itemtarget)
Parameters
Type Name Description
IItem itemtarget

target to move to

|Improve this Doc View Source

AddTool(Mat, string)

Adds an empty tool to the robot provided the tool pose (4x4 Matrix) and the tool name.

Declaration
IItem AddTool(Mat toolPose, string toolName = "New TCP")
Parameters
Type Name Description
Mat toolPose
string toolName
Returns
Type Description
IItem

new item created

|Improve this Doc View Source

AttachClosest()

Attach the closest object to the tool. Returns the item that was attached. Use item.Valid() to check if an object was attached to the tool.

Declaration
IItem AttachClosest()
Returns
Type Description
IItem
|Improve this Doc View Source

Busy()

Checks if a robot or program is currently running (busy or moving)

Declaration
bool Busy()
Returns
Type Description
bool

busy status (true=moving, false=stopped)

|Improve this Doc View Source

Childs()

Returns a list of the item childs that are attached to the provided item.

Declaration
List Childs()
Returns
Type Description
List<IItem>

item x n -> list of child items

|Improve this Doc View Source

Clone(IRoboDK)

Make a copy of the item with a new roboDK link.

Declaration
IItem Clone(IRoboDK connectionLink)
Parameters
Type Name Description
IRoboDK connectionLink

RoboDK link

Returns
Type Description
IItem

new item

|Improve this Doc View Source

Connect(string)

Connect to a real robot using the robot driver.

Declaration
bool Connect(string robotIp = "")
Parameters
Type Name Description
string robotIp

IP of the robot to connect. Leave empty to use the one defined in RoboDK

Returns
Type Description
bool

状态- >真如果连接成功,假connection failed

|Improve this Doc View Source

ConnectedState()

Check connection status with a real robot.

Declaration
RobotConnectionType ConnectedState()
Returns
Type Description
RobotConnectionType

Status contains connection status code enum, Message contains error info if status is not "Ready".

|Improve this Doc View Source

ConnectionParams()

Returns the robot connection parameters.

Declaration
RobotConnectionParameter ConnectionParams()
Returns
Type Description
RobotConnectionParameter

Robot IP, Robot Port, FTP Path, FTP Username, FTP Password

|Improve this Doc View Source

ConnectSafe(string, int, int)

Connect to a real robot and wait for a connection to succeed.

Declaration
bool ConnectSafe(string robotIp = "", int maxAttempts = 5, int waitConnection = 4)
Parameters
Type Name Description
string robotIp

Robot IP. Leave blank to use the robot's connection params.

int maxAttempts

Maximum connection attemps before reporting an unsuccessful connection.

int waitConnection

Time to wait in seconds between connection attempts.

Returns
Type Description
bool

True if connected successfully, else false.

|Improve this Doc View Source

Delete()

Deletes an item and its childs from the station.

Declaration
void Delete()
|Improve this Doc View Source

DetachAll(IItem)

Detaches any object attached to a tool.

Declaration
void DetachAll(IItem parent = null)
Parameters
Type Name Description
IItem 家长

New parent item to attach, such as a reference frame(optional). If not provided, the items held by the tool will be placed at the station root.

|Improve this Doc View Source

DetachClosest(IItem)

Detach the closest object attached to the tool (see also: setParentStatic).

Declaration
IItem DetachClosest(IItem parent = null)
Parameters
Type Name Description
IItem 家长

New parent item to attach, such as a reference frame(optional). If not provided, the items held by the tool will be placed at the station root.

Returns
Type Description
IItem
|Improve this Doc View Source

Disconnect()

Disconnect from a real robot (when the robot driver is used)

Declaration
bool Disconnect()
Returns
Type Description
bool

status -> true if disconnected successfully, false if it failed. It can fail if it was previously disconnected manually for example.

|Improve this Doc View Source

Equals(IItem)

Compare this item with other item. Return true if they are the same; False otherwise.

Declaration
bool Equals(IItem otherItem)
Parameters
Type Name Description
IItem otherItem
Returns
Type Description
bool

True if this item and other item is the same RoboDK item.

|Improve this Doc View Source

Finish()

Disconnect from the RoboDK API. This flushes any pending program generation.

Declaration
void Finish()
|Improve this Doc View Source

GeometryPose()

Returns the position (pose) the object geometry with respect to its own reference frame. This procedure works for tools and objects.

Declaration
Mat GeometryPose()
Returns
Type Description
Mat

4x4 homogeneous matrix (pose)

|Improve this Doc View Source

GetColor()

Return the color of an Item (object, tool or robot). If the item has multiple colors it returns the first color available). A color is in the format COLOR = [R, G, B,(A = 1)] where all values range from 0 to 1.

Declaration
Color GetColor()
Returns
Type Description
Color

Color [R, G, B, A]

See Also
SetColor(Color)
Recolor(Color,Color?,double)
|Improve this Doc View Source

GetInstruction(int)

Returns the program instruction at position id

Declaration
ProgramInstruction GetInstruction(int instructionId)
Parameters
Type Name Description
int instructionId
Returns
Type Description
ProgramInstruction

program instruction at position instructionId

|Improve this Doc View Source

GetInstructionListJoints(double, double, string, CollisionCheckOptions, ListJointsType, int, double)

Returns a list of joints. Linear moves are rounded according to the smoothing parameter set inside the program.

Declaration
InstructionListJointsResult GetInstructionListJoints(double mmStep = 10, double degStep = 5, string saveToFile = "", CollisionCheckOptions collisionCheck = CollisionCheckOptions.CollisionCheckOff, ListJointsType flags = ListJointsType.Any, int timeoutSec = 3600, double time_step = 0.2)
Parameters
Type Name Description
double mmStep

Maximum step in millimeters for linear movements (millimeters)

double degStep

Maximum step for joint movements (degrees)

string saveToFile

Provide a file name to directly save the output to a file. If the file name is not provided it will return the matrix. If step values are very small, the returned matrix can be very large.

CollisionCheckOptions collisionCheck

Check for collisions: will set to 1 or 0

ListJointsType flags

Reserved for future compatibility

int timeoutSec

Maximum time to wait for the result (in seconds)

double time_step

Time step in seconds for time-based calculation (ListJointsType must be set to TimeBased)

Returns
Type Description
InstructionListJointsResult

List of InstructionListJointsResult.

|Improve this Doc View Source

GetItemFlags()

检索当前项标志。项flags allow defining how much access the user has to item-specific features.

Declaration
项Flags GetItemFlags()
Returns
Type Description
项Flags

Current Item Flags

|Improve this Doc View Source

GetItemType()

Returns the type of an item (robot, object, target, reference frame, ...)

Declaration
项Type GetItemType()
Returns
Type Description
项Type
|Improve this Doc View Source

GetLink(ItemType)

Returns an item pointer (Item class) to a robot, object, tool or program. This is useful to retrieve the relationship between programs, robots, tools and other specific projects.

Declaration
IItem GetLink(ItemType typeLinked = ItemType.Robot)
Parameters
Type Name Description
项Type typeLinked

type of linked object to retrieve

Returns
Type Description
IItem
|Improve this Doc View Source

GetParam(string)

Get a custom data parameter. Some items can hold custom data parameters.

Declaration
byte[] GetParam(string param)
Parameters
Type Name Description
string param
Returns
Type Description
byte[]
|Improve this Doc View Source

GetPoints(ObjectSelectionType, int, out Mat)

Retrieves the point under the mouse cursor, a curve or the 3D points of an object. The points are provided in [XYZijk] format in relative coordinates. The XYZ are the local point coordinate and ijk is the normal of the surface.

Declaration
string GetPoints(ObjectSelectionType featureType, int featureId, out Mat pointList)
Parameters
Type Name Description
ObjectSelectionType featureType

The type of geometry (FEATURE_SURFACE, FEATURE_POINT, ...). Set to FEATURE_SURFACE and if not point or curve was selected, the name of the geometry will be 'point on surface'

int featureId

The internal ID to retrieve the right geometry from the object (use SelectedFeature)

Mat pointList

The point or a list of points as XYZijk, coordinates are relative to the object (ijk is the normal to the surface)

Returns
Type Description
string

The name of the selected geometry (if applicable)

|Improve this Doc View Source

GetRoboDkLink()

Get RoboDK low level link interface.

Declaration
RoboDK.IRoboDKLink GetRoboDkLink()
Returns
Type Description
RoboDK.IRoboDKLink
|Improve this Doc View Source

Htool()

Obsolete: Use PoseTool() instead. Returns the tool pose of an item. If a robot is provided it will get the tool pose of the active tool held by the robot.

Declaration
Mat Htool()
Returns
Type Description
Mat

4x4 homogeneous matrix (pose)

|Improve this Doc View Source

InstructionCount()

Returns the number of instructions of a program.

Declaration
int InstructionCount()
Returns
Type Description
int
|Improve this Doc View Source

InstructionList(out Mat)

Returns the list of program instructions as an MxN matrix, where N is the number of instructions and M equals to 1 plus the number of robot axes.

Declaration
int InstructionList(out Mat instructions)
Parameters
Type Name Description
Mat instructions

the matrix of instructions

Returns
Type Description
int

Returns 0 if success

|Improve this Doc View Source

InstructionListJoints(out string, out Mat, double, double, string, CollisionCheckOptions, ListJointsType, int, double)

Returns a list of joints an MxN matrix, where M is the number of robot axes plus 4 columns. Linear moves are rounded according to the smoothing parameter set inside the program.

Declaration
int InstructionListJoints(out string errorMsg, out Mat jointList, double mmStep = 10, double degStep = 5, string saveToFile = "", CollisionCheckOptions collisionCheck = CollisionCheckOptions.CollisionCheckOff, ListJointsType flags = ListJointsType.Any, int timeoutSec = 3600, double time_step = 0.2)
Parameters
Type Name Description
string errorMsg

Returns a human readable error message (if any)

Mat jointList

Returns the list of joints as [J1, J2, ..., Jn, ERROR, MM_STEP, DEG_STEP, MOVE_ID] if a file name is not specified

double mmStep

Maximum step in millimeters for linear movements (millimeters)

double degStep

Maximum step for joint movements (degrees)

string saveToFile

Provide a file name to directly save the output to a file. If the file name is not provided it will return the matrix. If step values are very small, the returned matrix can be very large.

CollisionCheckOptions collisionCheck

Check for collisions: will set to 1 or 0

ListJointsType flags

Reserved for future compatibility

int timeoutSec

Maximum time to wait for the result (in seconds)

double time_step

Time step for time-based calculation (ListJointsType must be set to TimeBased)

Returns
Type Description
int

Returns 0 if success, otherwise, it will return negative values

|Improve this Doc View Source

JointLimits(out double[], out double[])

Returns the joint limits of a robot

Declaration
void JointLimits(out double[] lowerLlimits, out double[] upperLimits)
Parameters
Type Name Description
double[] lowerLlimits
double[] upperLimits
|Improve this Doc View Source

Joints()

Returns the current joints of a robot or the joints of a target. If the item is a cartesian target, it returns the preferred joints (configuration) to go to that cartesian position.

Declaration
double[] Joints()
Returns
Type Description
double[]

double x n -> joints matrix

|Improve this Doc View Source

JointsConfig(double[])

Returns the robot configuration state for a set of robot joints.

Declaration
double[] JointsConfig(double[] joints)
Parameters
Type Name Description
double[] joints

array of joints

Returns
Type Description
double[]

3-array -> configuration status as [REAR, LOWERARM, FLIP]

|Improve this Doc View Source

JointsHome()

Returns the home joints of a robot. These joints can be manually set in the robot "Parameters" menu, then select "Set home position"SetJointsHome(double[])

Declaration
double[] JointsHome()
Returns
Type Description
double[]

double x n -> joints array

|Improve this Doc View Source

MakeProgram(string, RunMode)

Saves a program to a file.

Declaration
bool MakeProgram(string filename = "", RunMode runMode = RunMode.MakeRobotProgram)
Parameters
Type Name Description
string filename

File path of the program

RunMode runMode

RUNMODE_MAKE_ROBOTPROG to generate the program file.Alternatively, Use RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD or RUNMODE_MAKE_ROBOTPROG_AND_START to transfer the program through FTP and execute the program.

Returns
Type Description
bool

Transfer succeeded is True if there was a successful program transfer (if RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD or RUNMODE_MAKE_ROBOTPROG_AND_START are used)

|Improve this Doc View Source

MoveC(IItem, IItem, bool)

Moves a robot to a specific target ("Move Circular" mode). By default, this function blocks until the robot finishes its movements.

Declaration
void MoveC(IItem itemtarget1, IItem itemtarget2, bool blocking = true)
Parameters
Type Name Description
IItem itemtarget1

target -> intermediate target to move to as a target item (RoboDK target item)

IItem itemtarget2

target -> final target to move to as a target item (RoboDK target item)

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

MoveC(Mat, Mat, bool)

Moves a robot to a specific target ("Move Circular" mode). By default, this function blocks until the robot finishes its movements.

Declaration
void MoveC(Mat target1, Mat target2, bool blocking = true)
Parameters
Type Name Description
Mat target1

pose -> intermediate pose target to move to. It must be a 4x4 Homogeneous matrix

Mat target2

pose -> final pose target to move to. It must be a 4x4 Homogeneous matrix

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

MoveC(double[], double[], bool)

Moves a robot to a specific target ("Move Circular" mode). By default, this function blocks until the robot finishes its movements.

Declaration
void MoveC(double[] joints1, double[] joints2, bool blocking = true)
Parameters
Type Name Description
double[] joints1

joints -> intermediate joint target to move to.

double[] joints2

joints -> final joint target to move to.

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

MoveJ_Test_Blend(double[], double[], double[], double, double)

Checks if a joint movement is free of collision.

Declaration
bool MoveJ_Test_Blend(double[] j1, double[] j2, double[] j3, double blendDeg = 5, double minstepDeg = -1)
Parameters
Type Name Description
double[] j1

joints -> start joints

double[] j2

joints -> joints via

double[] j3

joints -> joints final destination

double blendDeg

Blend in degrees

double minstepDeg

(optional): maximum joint step in degrees

Returns
Type Description
bool

collision : returns false if the movement is possible and free of collision. Otherwise it returns true.

|Improve this Doc View Source

MoveJ_Test(double[], double[], double)

Checks if a joint movement is free of collision.

Declaration
int MoveJ_Test(double[] j1, double[] j2, double minstepDeg = -1)
Parameters
Type Name Description
double[] j1

joints -> start joints

double[] j2

joints -> destination joints

double minstepDeg

(optional): maximum joint step in degrees

Returns
Type Description
int

collision : returns 0 if the movement is free of collision. Otherwise it returns the number of pairs of objects that collided if there was a collision.

|Improve this Doc View Source

MoveJ(IItem, bool)

Moves a robot to a specific target ("Move Joint" mode). By default, this function blocks until the robot finishes its movements. Given a target item, MoveJ can also be applied to programs and a new movement instruction will be added.

Declaration
void MoveJ(IItem itemtarget, bool blocking = true)
Parameters
Type Name Description
IItem itemtarget

target -> target to move to as a target item (RoboDK target item)

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

MoveJ(Mat, bool)

Moves a robot to a specific target ("Move Joint" mode). By default, this function blocks until the robot finishes its movements.

Declaration
void MoveJ(Mat target, bool blocking = true)
Parameters
Type Name Description
Mat target

pose -> pose target to move to. It must be a 4x4 Homogeneous matrix

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

MoveJ(double[], bool)

Moves a robot to a specific target ("Move Joint" mode). By default, this function blocks until the robot finishes its movements.

Declaration
void MoveJ(double[] joints, bool blocking = true)
Parameters
Type Name Description
double[] joints

joints -> joint target to move to.

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

MoveL_Test(double[], Mat, double)

Checks if a linear movement is free of collision.

Declaration
int MoveL_Test(double[] j1, Mat t2, double minstepDeg = -1)
Parameters
Type Name Description
double[] j1

joints -> start joints

Mat t2

Pose -> destination pose with respect to the active tool and coordinate system

double minstepDeg

(optional): maximum joint step in degrees

Returns
Type Description
int

collision : returns 0 if the movement is free of collision. Otherwise it returns the number of pairs of objects that collided if there was a collision.

|Improve this Doc View Source

MoveL(IItem, bool)

Moves a robot to a specific target ("Move Linear" mode). By default, this function blocks until the robot finishes its movements. Given a target item, MoveL can also be applied to programs and a new movement instruction will be added.

Declaration
void MoveL(IItem itemtarget, bool blocking = true)
Parameters
Type Name Description
IItem itemtarget

target -> target to move to as a target item (RoboDK target item)

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

MoveL(Mat, bool)

Moves a robot to a specific target ("Move Linear" mode). By default, this function blocks until the robot finishes its movements.

Declaration
void MoveL(Mat target, bool blocking = true)
Parameters
Type Name Description
Mat target

pose -> pose target to move to. It must be a 4x4 Homogeneous matrix

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

MoveL(double[], bool)

Moves a robot to a specific target ("Move Linear" mode). By default, this function blocks until the robot finishes its movements.

Declaration
void MoveL(double[] joints, bool blocking = true)
Parameters
Type Name Description
double[] joints

joints -> joint target to move to.

bool blocking

blocking -> True if we want the instruction to block until the robot finished the movement (default=true)

|Improve this Doc View Source

Name()

Returns the name of an item. The name of the item is always displayed in the RoboDK station tree

Declaration
string Name()
Returns
Type Description
string

name of the item

|Improve this Doc View Source

NewLink()

Create a new communication link. Use this for robots if you use a multithread application running multiple robots at the same time.

Declaration
void NewLink()
|Improve this Doc View Source

ObjectLink(int)

Returns an item pointer (:class:.Item) to a robot link. This is useful to show/hide certain robot links or alter their geometry.

Declaration
IItem ObjectLink(int linkId = 0)
Parameters
Type Name Description
int linkId

link index(0 for the robot base, 1 for the first link, ...)

Returns
Type Description
IItem
|Improve this Doc View Source

Parent()

Returns the parent item of this item.

Declaration
IItem Parent()
Returns
Type Description
IItem
|Improve this Doc View Source

Pause(double)

Generates a pause instruction for a robot or a program when generating code. Set it to -1 (default) if you want the robot to stop and let the user resume the program anytime.

Declaration
void Pause(double timeMs = -1)
Parameters
Type Name Description
double timeMs

Time in milliseconds

|Improve this Doc View Source

Pose()

Returns the local position (pose) of an object, target or reference frame. For example, the position of an object/frame/target with respect to its parent. If a robot is provided, it will get the pose of the end effector

Declaration
Mat Pose()
Returns
Type Description
Mat

4x4 homogeneous matrix (pose)

|Improve this Doc View Source

PoseAbs()

Returns the global position (pose) of an item. For example, the position of an object/frame/target with respect to the station origin.

Declaration
Mat PoseAbs()
Returns
Type Description
Mat

4x4 homogeneous matrix (pose)

|Improve this Doc View Source

PoseFrame()

Returns the reference frame pose of an item. If a robot is provided it will get the tool pose of the active reference frame used by the robot.

Declaration
Mat PoseFrame()
Returns
Type Description
Mat

4x4 homogeneous matrix (pose)

|Improve this Doc View Source

PoseTool()

Returns the tool pose of an item. If a robot is provided it will get the tool pose of the active tool held by the robot.

Declaration
Mat PoseTool()
Returns
Type Description
Mat

4x4 homogeneous matrix (pose)

|Improve this Doc View Source

ProjectPoints(Mat, ProjectionType)

Projects a point to the object given its coordinates. The provided points must be a list of [XYZ] coordinates. Optionally, a vertex normal can be provided [XYZijk].

Declaration
Mat ProjectPoints(Mat points, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
Type Name Description
Mat points

matrix 3xN or 6xN -> list of points to project

ProjectionType projectionType

projection_type -> Type of projection. For example: ProjectionType.AlongNormalRecalc will project along the point normal and recalculate the normal vector on the surface projected.

Returns
Type Description
Mat

projected points (empty matrix if failed)

|Improve this Doc View Source

RDK()

Returns the RoboDK link Robolink().

Declaration
RoboDK RDK()
Returns
Type Description
RoboDK
|Improve this Doc View Source

Recolor(double[], double[], double)

Changes the color of a robot/object/tool. A color must must in the format COLOR=[R,G,B,(A=1)] where all values range from 0 to 1. Alpha (A) defaults to 1 (100% opaque). Set A to 0 to make an object transparent.

Declaration
void Recolor(double[] tocolor, double[] fromcolor = null, double tolerance = 0.1)
Parameters
Type Name Description
double[] tocolor

color to change to

double[] fromcolor

filter by this color

double tolerance

optional tolerance to use if a color filter is used (defaults to 0.1)

|Improve this Doc View Source

Recolor(Color, Color?, double)

Changes the color of a robot/object/tool. A color must must in the format COLOR=[R,G,B,(A=1)] where all values range from 0 to 1. Alpha (A) defaults to 1 (100% opaque). Set A to 0 to make an object transparent.

Declaration
void Recolor(Color tocolor, Color? fromcolor = null, double tolerance = 0.1)
Parameters
Type Name Description
Color tocolor

color to change to

Color? fromcolor

filter by this color

double tolerance

optional tolerance to use if a color filter is used (defaults to 0.1)

|Improve this Doc View Source

RL()

Use RDK() instead. Returns the RoboDK link Robolink().

Declaration
RoboDK RL()
Returns
Type Description
RoboDK
|Improve this Doc View Source

RunCode(string)

运行一个程序。它返回instructi的数量ons that can be executed successfully (a quick program check is performed before the program starts) Program parameters can be provided for Python calls. This is a non-blocking call.Use IsBusy() to check if the program execution finished. Notes: if setRunMode(RUNMODE_SIMULATE) is used -> the program will be simulated (default run mode) if setRunMode(RUNMODE_RUN_ROBOT) is used ->the program will run on the robot(default when RUNMODE_RUN_ROBOT is used) if setRunMode(RUNMODE_RUN_ROBOT) is used together with program.setRunType(PROGRAM_RUN_ON_ROBOT) -> the program will run sequentially on the robot the same way as if we right clicked the program and selected "Run on robot" in the RoboDK GUI

Declaration
int RunCode(string parameters = null)
Parameters
Type Name Description
string parameters

Number of instructions that can be executed

Returns
Type Description
int
|Improve this Doc View Source

RunCodeCustom(string, ProgramRunType)

添加一个程序调用,代码、消息或评论the program. Returns True if succeeded.

Declaration
bool RunCodeCustom(string code, ProgramRunType runType = ProgramRunType.CallProgram)
Parameters
Type Name Description
string code

string of the code or program to run

ProgramRunType runType

specify if the code is a program

Returns
Type Description
bool

True if success; False othwersise

|Improve this Doc View Source

RunProgram()

运行一个程序。它返回instructi的数量ons that can be executed successfully (a quick program check is performed before the program starts) This is a non-blocking call. Use IsBusy() to check if the program execution finished. Notes: if setRunMode(RUNMODE_SIMULATE) is used -> the program will be simulated (default run mode) if setRunMode(RUNMODE_RUN_ROBOT) is used -> the program will run on the robot (default when RUNMODE_RUN_ROBOT is used) if setRunMode(RUNMODE_RUN_ROBOT) is used together with program.setRunType(PROGRAM_RUN_ON_ROBOT) -> the program will run sequentially on the robot the same way as if we right clicked the program and selected "Run on robot" in the RoboDK GUI

Declaration
int RunProgram()
Returns
Type Description
int

number of instructions that can be executed

|Improve this Doc View Source

Save(string)

Save a station or object to a file

Declaration
void Save(string filename)
Parameters
Type Name Description
string filename
|Improve this Doc View Source

Scale(double[])

Apply a scale to an object to make it bigger or smaller. The scale can be uniform (if scale is a float value) or per axis (if scale is a vector).

Declaration
void Scale(double[] scale)
Parameters
Type Name Description
double[] scale

scale to apply as [scale_x, scale_y, scale_z]

|Improve this Doc View Source

SelectedFeature(out ObjectSelectionType, out int)

Retrieve the currently selected feature for this object (surface, point, line, ...)

Declaration
bool SelectedFeature(out ObjectSelectionType featureType, out int featureId)
Parameters
Type Name Description
ObjectSelectionType featureType

The type of geometry, FEATURE_SURFACE, FEATURE_POINT, ...

int featureId

The internal ID to retrieve the raw geometry (use GetPoints)

Returns
Type Description
bool

True if the object is selected

|Improve this Doc View Source

SetAsCartesianTarget()

Sets a target as a cartesian target. A cartesian target moves to cartesian coordinates.

Declaration
void SetAsCartesianTarget()
|Improve this Doc View Source

SetAsJointTarget()

Sets a target as a joint target. A joint target moves to a joints position without regarding the cartesian coordinates.

Declaration
void SetAsJointTarget()
|Improve this Doc View Source

SetColor(int, Color)

设置颜色物体的形状。它也可以sed for tools. A color must in the format COLOR=[R, G, B,(A = 1)] where all values range from 0 to 1.

Declaration
void SetColor(int shapeId, Color tocolor)
Parameters
Type Name Description
int shapeId

ID of the shape: the ID is the order in which the shape was added using AddShape()

Color tocolor

color to set

|Improve this Doc View Source

SetColor(Color)

Set the color of an object, tool or robot. A color must in the format COLOR=[R, G, B,(A = 1)] where all values range from 0 to 1.

Declaration
void SetColor(Color tocolor)
Parameters
Type Name Description
Color tocolor

color to set

See Also
GetColor()
Recolor(Color,Color?,double)
|Improve this Doc View Source

setConnectionParams(string, int, string, string, string)

Set the robot connection parameters.

Declaration
void setConnectionParams(string robotIP, int port, string remotePath, string ftpUser, string ftpPass)
Parameters
Type Name Description
string robotIP

IP address of robot.

int port

Port of robot.

string remotePath

FTP path to connect to.

string ftpUser

FTP username

string ftpPass

FTP password

|Improve this Doc View Source

setDO(字符串,字符串)

Sets a variable (output) to a given value. This can also be used to set any variables to a desired value.

Declaration
void setDO(string ioVar, string ioValue)
Parameters
Type Name Description
string ioVar

io_var -> digital output (string or number)

string ioValue

io_value -> value (string or number)

|Improve this Doc View Source

SetFrame(IItem)

Obsolete: Use setPoseFrame instead. Sets the frame of a robot (user frame). The frame can be either an item or a 4x4 Matrix. If "frame" is an item, it links the robot to the frame item. If frame is a 4x4 Matrix, it updates the linked pose of the robot frame.

Declaration
void SetFrame(IItem frame)
Parameters
Type Name Description
IItem frame

item/pose -> frame item or 4x4 Matrix (pose of the reference frame)

|Improve this Doc View Source

SetFrame(Mat)

Obsolete: Use setPoseFrame instead. Sets the frame of a robot (user frame). The frame can be either an item or a 4x4 Matrix. If "frame" is an item, it links the robot to the frame item. If frame is a 4x4 Matrix, it updates the linked pose of the robot frame.

Declaration
void SetFrame(Mat frame)
Parameters
Type Name Description
Mat frame

item/pose -> frame item or 4x4 Matrix (pose of the reference frame)

|Improve this Doc View Source

SetGeometryPose(Mat)

Sets the position (pose) the object geometry with respect to its own reference frame. This procedure works for tools and objects.

Declaration
void SetGeometryPose(Mat pose)
Parameters
Type Name Description
Mat pose

4x4 homogeneous matrix

|Improve this Doc View Source

SetHtool(Mat)

Obsolete: Use setPoseTool(pose) instead. Sets the tool pose of a tool item. If a robot is provided it will set the tool pose of the active tool held by the robot.

Declaration
void SetHtool(Mat pose)
Parameters
Type Name Description
Mat pose

4x4 homogeneous matrix (pose)

|Improve this Doc View Source

SetInstruction(int, ProgramInstruction)

Sets the program instruction at position id

Declaration
void SetInstruction(int instructionId, ProgramInstruction instruction)
Parameters
Type Name Description
int instructionId
ProgramInstruction instruction
|Improve this Doc View Source

SetItemFlags(ItemFlags)

Update item flags. Item flags allow defining how much access the user has to item-specific features.

Declaration
void SetItemFlags(ItemFlags itemFlags = ItemFlags.All)
Parameters
Type Name Description
项Flags itemFlags

项Flags to be set

|Improve this Doc View Source

SetJointLimits(double[], double[])

Sets the joint limits of a robot

Declaration
void SetJointLimits(double[] lowerLlimits, double[] upperLimits)
Parameters
Type Name Description
double[] lowerLlimits
double[] upperLimits
|Improve this Doc View Source

SetJoints(double[], SetJointsType)

Sets the current joints of a robot or the joints of a target. It the item is a cartesian target, it returns the preferred joints (configuration) to go to that cartesian position.

Declaration
bool SetJoints(double[] joints, SetJointsType saturate_action = SetJointsType.Default)
Parameters
Type Name Description
double[] joints

array of joint values, in degrees or mm for linear axes

SetJointsType saturate_action

Behavior to saturate or ignore invalid joints (only applicable to robot items)

Returns
Type Description
bool

Returns True if the joints are valid (not saturated), False if they are outside the joint limitations.

|Improve this Doc View Source

SetJointsHome(double[])

Set the home position of the robot in the joint space. param joints: robot jointsJointsHome()

Declaration
void SetJointsHome(double[] joints)
Parameters
Type Name Description
double[] joints

Home Position of all robot joints

|Improve this Doc View Source

SetMachiningParameters(string, IItem, string)

Update the robot milling path input and parameters. Parameter input can be an NC file (G-code or APT file) or an object item in RoboDK. A curve or a point follow project will be automatically set up for a robot manufacturing project. Tip: Use getLink() and setLink() to get/set the robot tool, reference frame, robot and program linked to the project. Tip: Use setPose() and setJoints() to update the path to tool orientation or the preferred start joints.

Declaration
IItem SetMachiningParameters(string ncfile = "", IItem partObj = null, string options = "")
Parameters
Type Name Description
string ncfile

path to the NC (G-code/APT/Point cloud) file to load (optional)

IItem partObj
string options

Additional options (optional)

Returns
Type Description
IItem

Program (null). Use Update() to retrieve the result

|Improve this Doc View Source

SetName(string)

Set the name of a RoboDK item.

Declaration
void SetName(string name)
Parameters
Type Name Description
string name
|Improve this Doc View Source

SetParam(string, byte[])

Set a custom data parameter. Some items can hold custom data parameters.

Declaration
void SetParam(string param, byte[] value)
Parameters
Type Name Description
string param
byte[] value
|Improve this Doc View Source

SetParam(string, string)

Send a specific parameter for an item.

Declaration
string SetParam(string param, string value = "")
Parameters
Type Name Description
string param

Command name

string value

Command value (optional, not all commands require a value)

Returns
Type Description
string

Command response

|Improve this Doc View Source

setParamRobotTool(double, double[])

Sets the tool mass and center of gravity. This is only used with accurate robots to improve accuracy.

Declaration
void setParamRobotTool(double toolMass, double[] toolCOG)
Parameters
Type Name Description
double toolMass

Tool weigth in Kg.

double[] toolCOG

Tool center of gravity as [x,y,z] with respect to the robot flange.

|Improve this Doc View Source

SetParent(IItem)

Attaches the item to a new parent while maintaining the relative position with its parent. The absolute position is changed.

Declaration
void SetParent(IItem parent)
Parameters
Type Name Description
IItem 家长
|Improve this Doc View Source

SetParentStatic(IItem)

Attaches the item to another parent while maintaining the current absolute position in the station. The relationship between this item and its parent is changed to maintain the abosolute position.

Declaration
void SetParentStatic(IItem parent)
Parameters
Type Name Description
IItem 家长

家长item to attach this item

|Improve this Doc View Source

SetPose(Mat)

Sets the local position (pose) of an object, target or reference frame. For example, the position of an object/frame/target with respect to its parent. If a robot is provided, it will set the pose of the end effector.

Declaration
void SetPose(Mat pose)
Parameters
Type Name Description
Mat pose

4x4 homogeneous matrix

|Improve this Doc View Source

SetPoseAbs(Mat)

Sets the global position (pose) of an item. For example, the position of an object/frame/target with respect to the station origin.

Declaration
void SetPoseAbs(Mat pose)
Parameters
Type Name Description
Mat pose

4x4 homogeneous matrix (pose)

|Improve this Doc View Source

SetPoseFrame(IItem)

Sets the tool of a robot or a tool object (Tool Center Point, or TCP) to a frame position. To set a new pose positionSetPoseFrame(Mat)If the item is a tool, it links the robot to the tool item.If tool is a pose, it updates the current robot TCP.

Declaration
void SetPoseFrame(IItem frameItem)
Parameters
Type Name Description
IItem frameItem
|Improve this Doc View Source

SetPoseFrame(Mat)

Sets the tool of a robot or a tool object (Tool Center Point, or TCP) to a frame position. To set a new frame positionSetPoseFrame(IItem)If the item is a tool, it links the robot to the tool item.If tool is a pose, it updates the current robot TCP.

Declaration
void SetPoseFrame(Mat framePose)
Parameters
Type Name Description
Mat framePose
|Improve this Doc View Source

SetPoseTool(IItem)

Sets the tool of a robot or a tool object (Tool Center Point, or TCP). The tool pose can be either an item or a 4x4 Matrix. If the item is a tool, it links the robot to the tool item.If tool is a pose, it updates the current robot TCP.

Declaration
void SetPoseTool(IItem toolItem)
Parameters
Type Name Description
IItem toolItem
|Improve this Doc View Source

SetPoseTool(Mat)

Sets the tool of a robot or a tool object (Tool Center Point, or TCP). The tool pose can be either an item or a 4x4 Matrix. If the item is a tool, it links the robot to the tool item.If tool is a pose, it updates the current robot TCP.

Declaration
void SetPoseTool(Mat toolPose)
Parameters
Type Name Description
Mat toolPose
|Improve this Doc View Source

SetRobot(IItem)

Sets the robot of a program or a target. You must set the robot linked to a program or a target every time you copy paste these objects. If the robot is not provided, the first available robot will be chosen automatically.

Declaration
void SetRobot(IItem robot = null)
Parameters
Type Name Description
IItem robot

Robot item

|Improve this Doc View Source

SetRounding(double)

Sets the rounding accuracy to smooth the edges of corners. In general, it is recommended to allow a small approximation near the corners to maintain a constant speed. Setting a rounding values greater than 0 helps avoiding jerky movements caused by constant acceleration and decelerations.

Declaration
void SetRounding(double rounding)
Parameters
Type Name Description
double rounding
|Improve this Doc View Source

SetRunType(ProgramExecutionType)

Sets if the program will be run in simulation mode or on the real robot. Use: "PROGRAM_RUN_ON_SIMULATOR" to set the program to run on the simulator only or "PROGRAM_RUN_ON_ROBOT" to force the program to run on the robot.

Declaration
void SetRunType(ProgramExecutionType programExecutionType)
Parameters
Type Name Description
ProgramExecutionType programExecutionType
|Improve this Doc View Source

SetSpeed(double, double, double, double)

Sets the speed and/or the acceleration of a robot.

Declaration
void SetSpeed(double speedLinear, double accelLinear = -1, double speedJoints = -1, double accelJoints = -1)
Parameters
Type Name Description
double speedLinear

linear speed in mm/s (-1 = no change)

double accelLinear

linear acceleration in mm/s2 (-1 = no change)

double speedJoints

joint speed in deg/s (-1 = no change)

double accelJoints

joint acceleration in deg/s2 (-1 = no change)

|Improve this Doc View Source

SetTool(IItem)

Obsolete: Use setPoseTool instead. Sets the tool pose of a robot. The tool pose can be either an item or a 4x4 Matrix. If "tool" is an item, it links the robot to the tool item. If tool is a 4x4 Matrix, it updates the linked pose of the robot tool.

Declaration
void SetTool(IItem tool)
Parameters
Type Name Description
IItem tool

item/pose -> tool item or 4x4 Matrix (pose of the tool frame)

|Improve this Doc View Source

SetTool(Mat)

Obsolete: Use setPoseTool instead. Sets the tool pose of a robot. The tool pose can be either an item or a 4x4 Matrix. If "tool" is an item, it links the robot to the tool item. If tool is a 4x4 Matrix, it updates the linked pose of the robot tool.

Declaration
void SetTool(Mat tool)
Parameters
Type Name Description
Mat tool

item/pose -> tool item or 4x4 Matrix (pose of the tool frame)

|Improve this Doc View Source

SetTransparency(double)

Set the alpha channel of an object, tool or robot. The alpha channel must remain between 0 and 1.

Declaration
void SetTransparency(double alpha)
Parameters
Type Name Description
double alpha

transparency level

See Also
GetColor()
SetColor(Color)
Recolor(Color,Color?,double)
|Improve this Doc View Source

SetVisible(bool, VisibleRefType)

Sets the item visiblity status

Declaration
void SetVisible(bool visible, VisibleRefType visibleFrame = (VisibleRefType)-1)
Parameters
Type Name Description
bool visible
VisibleRefType visibleFrame

srt the visible reference frame (1) or not visible (0)

|Improve this Doc View Source

SetZoneData(double)

Sets the robot movement smoothing accuracy (also known as zone data value). Obsolete, use SetRounding instead.

Declaration
[Obsolete] void SetZoneData(double zonedata)
Parameters
Type Name Description
double zonedata

zonedata value (int) (robot dependent, set to -1 for fine movements)

|Improve this Doc View Source

ShowAsCollided(bool, int)

Show an object or a robot link as collided (red)

Declaration
void ShowAsCollided(bool collided, int robotLinkId = 0)
Parameters
Type Name Description
bool collided
int robotLinkId
|Improve this Doc View Source

ShowInstructions(bool)

Show or hide instruction items of a program in the RoboDK tree

Declaration
void ShowInstructions(bool show = true)
Parameters
Type Name Description
bool show
|Improve this Doc View Source

ShowSequence(Mat)

Displays a sequence of joints

Declaration
void ShowSequence(Mat sequence)
Parameters
Type Name Description
Mat sequence

joint sequence as a 6xN matrix or instruction sequence as a 7xN matrix

|Improve this Doc View Source

ShowTargets(bool)

Show or hide targets of a program in the RoboDK tree

Declaration
void ShowTargets(bool show = true)
Parameters
Type Name Description
bool show
|Improve this Doc View Source

SimulatorJoints()

Return the current joint position of a robot (only from the simulator, never from the real robot). This should be used only when RoboDK is connected to the real robot and only the simulated robot needs to be retrieved(for example, if we want to move the robot using a spacemouse). Note: Use robot.Joints() instead to retrieve the simulated and real robot position when connected.

Declaration
double[] SimulatorJoints()
Returns
Type Description
double[]

double x n -> joints array

|Improve this Doc View Source

SolveFK(double[])

Computes the forward kinematics of the robot for the provided joints. The tool and the reference frame are not taken into account.

Declaration
Mat SolveFK(double[] joints)
Parameters
Type Name Description
double[] joints
Returns
Type Description
Mat

4x4 homogeneous matrix: pose of the robot flange with respect to the robot base

|Improve this Doc View Source

SolveIK_All(Mat, Mat, Mat)

Computes the inverse kinematics for the specified robot and pose. The function returns all available joint solutions as a 2D matrix.

Declaration
Mat SolveIK_All(Mat pose, Mat tool = null, Mat reference = null)
Parameters
Type Name Description
Mat pose

4x4 matrix -> pose of the robot tool with respect to the robot frame

Mat tool

4x4 matrix -> Optionally provide a tool, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.

Mat reference

4x4 matrix -> Optionally provide a reference, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.

Returns
Type Description
Mat

双x n m - >联合列表(2 d矩阵)

|Improve this Doc View Source

SolveIK(Mat, double[], Mat, Mat)

Computes the inverse kinematics for the specified robot and pose. The joints returned are the closest to the current robot configuration (see SolveIK_All())

Declaration
double[] SolveIK(Mat pose, double[] jointsApprox = null, Mat tool = null, Mat reference = null)
Parameters
Type Name Description
Mat pose

4x4 matrix -> pose of the robot flange with respect to the robot base frame

double[] jointsApprox

Aproximate solution. Leave empty to return the closest match to the current robot position.

Mat tool

4x4 matrix -> Optionally provide a tool, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.

Mat reference

4x4 matrix -> Optionally provide a reference, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.

Returns
Type Description
double[]

array of joints

|Improve this Doc View Source

Stop()

Stops a program or a robot

Declaration
void Stop()
|Improve this Doc View Source

Update()

Declaration
UpdateResult Update()
Returns
Type Description
UpdateResult
|Improve this Doc View Source

Update(CollisionCheckOptions, int, double, double)

Updates a program and returns the estimated time and the number of valid instructions. An update can also be applied to a robot machining project. The update is performed on the generated program.

Declaration
UpdateResult Update(CollisionCheckOptions collisionCheck, int timeoutSec = 3600, double linStepMm = -1, double jointStepDeg = -1)
Parameters
Type Name Description
CollisionCheckOptions collisionCheck

check_collisions: Check collisions (COLLISION_ON -yes- or COLLISION_OFF -no-)

int timeoutSec

Maximum time to wait for the update to complete (in seconds)

double linStepMm

Maximum step in millimeters for linear movements (millimeters). Set to -1 to use the default, as specified in Tools-Options-Motion.

double jointStepDeg

Maximum step for joint movements (degrees). Set to -1 to use the default, as specified in Tools-Options-Motion.

Returns
Type Description
UpdateResult

1.0 if there are no problems with the path or less than 1.0 if there is a problem in the path (ratio of problem)

|Improve this Doc View Source

Valid()

Checks if the item is valid. An invalid item will be returned by an unsuccessful function call.

Declaration
bool Valid()
Returns
Type Description
bool

true if valid, false if invalid

|Improve this Doc View Source

Visible()

Returns 1 if the item is visible, otherwise, returns 0.

Declaration
bool Visible()
Returns
Type Description
bool

true if visible, false if not visible

|Improve this Doc View Source

waitDI(string, string, double)

Waits for an input io_id to attain a given value io_value. Optionally, a timeout can be provided.

Declaration
void waitDI(string ioVar, string ioValue, double timeoutMs = -1)
Parameters
Type Name Description
string ioVar

io_var -> digital output (string or number)

string ioValue

io_value -> value (string or number)

double timeoutMs

int (optional) -> timeout in miliseconds

|Improve this Doc View Source

WaitMove(double)

Waits (blocks) until the robot finishes its movement.

Declaration
void WaitMove(double timeoutSec = 300)
Parameters
Type Name Description
double timeoutSec

timeout -> Max time to wait for robot to finish its movement (in seconds)

  • Improve this Doc
  • View Source
In This Article
Back to topCopyright © 2015-RoboDK Inc.