Interface IItem
public interface IItemProperties
ItemId
long ItemId { get; }Property Value
Methods
AccuracyActive()
Request accurate kinematics status
bool AccuracyActive()Returns
- bool
Returns true if the accurate kinematics are being used
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.
IItem AddCurve(Mat curvePoints, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)Parameters
curvePointsMatmatrix 3xN or 6xN -> N must be multiple of 3
addToRefbooladd_to_ref -> If True, the curve will be added as part of the object in the RoboDK item tree
projectionTypeProjectionTypeType of projection. For example: PROJECTION_ALONG_NORMAL_RECALC will project along the point normal and recalculate the normal vector on the surface projected.
Returns
- IItem
returns the object where the curve was added or null if failed
AddCustomInstruction(string, string, string, bool, string)
Add a custom instruction. This instruction will execute a Python file or an executable file.
void AddCustomInstruction(string name, string pathRun, string pathIcon = "", bool blocking = true, string cmdRunOnRobot = "")Parameters
namestringpathRunstringpath to run(relative to RoboDK/bin folder or absolute path)
pathIconstringicon path(relative to RoboDK/bin folder or absolute path)
blockingboolTrue if blocking, 0 if it is a non blocking executable trigger
cmdRunOnRobotstringCommand to run through the driver when connected to the robot
AddFile(string)
Adds an object attached to this object
IItem AddFile(string filename)Parameters
filenamestringAny file to load, supported by RoboDK. Supported formats include STL, STEP, IGES, ROBOT, TOOL, RDK,... It is also possible to load supported robot programs, such as SRC (KUKA), SCRIPT (Universal Robots), LS (Fanuc), JBI (Motoman), MOD (ABB), PRG (ABB), ...
Returns
- IItem
Returns loaded object
AddGeometry(IItem, Mat)
Makes a copy of the source item geometry adding it at a given position (pose), relative to this item
void AddGeometry(IItem source, Mat pose)Parameters
AddMoveJ(IItem)
Adds a new robot move joint instruction to a program. Obsolete. Use MoveJ instead.
void AddMoveJ(IItem itemtarget)Parameters
itemtargetIItemtarget to move to
AddMoveL(IItem)
Adds a new robot move linear instruction to a program. Obsolete. Use MoveL instead.
void AddMoveL(IItem itemtarget)Parameters
itemtargetIItemtarget to move to
AddPoints(Mat, bool, ProjectionType)
Adds a list of points to the object. The provided points must be a list of vertices. A vertex normal can be provided optionally.
IItem AddPoints(Mat points, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)Parameters
pointsMatlist of points as a matrix (3xN matrix, or 6xN to provide point normals as ijk vectors)
addToRefboolIf True, the points will be added as part of the object in the RoboDK item tree (a reference object must be provided)
projectionTypeProjectionTypeType of projection.Use the PROJECTION_* flags.
Returns
- IItem
added object/shape (0 if failed)
AddShape(Mat)
Adds a shape to the object provided some triangle coordinates. Triangles must be provided as a list of vertices. A vertex normal can be provided optionally.
IItem AddShape(Mat trianglePoints)Parameters
trianglePointsMatList of vertices grouped by triangles (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3)
Returns
- IItem
Added object/shape
AddShape(List<Mat>)
Adds a shape to the object provided some triangle coordinates. Triangles must be provided as a list of vertices. A vertex normal can be provided optionally.
IItem AddShape(List<Mat> listTrianglePoints)Parameters
listTrianglePointsList<Mat>List of Mat objects. Each Mat object is a list of vertices grouped by triangles (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3)
Returns
- IItem
Added object/shape
AddTool(Mat, string)
Adds an empty tool to the robot provided the tool pose (4x4 Matrix) and the tool name.
IItem AddTool(Mat toolPose, string toolName = "New TCP")Parameters
Returns
- IItem
new item created
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.
IItem AttachClosest()Returns
Busy()
Checks if a robot or program is currently running (busy or moving)
bool Busy()Returns
- bool
busy status (true=moving, false=stopped)
Childs()
Returns a list of the item childs that are attached to the provided item.
List<IItem> Childs()Returns
Clone(IRoboDK)
Make a copy of the item with a new roboDK link.
IItem Clone(IRoboDK connectionLink)Parameters
connectionLinkIRoboDKRoboDK link
Returns
- IItem
new item
Collision(IItem)
Check if if this item is in a collision state with another item
bool Collision(IItem item)Parameters
itemIItemItem to check for collisions
Returns
- bool
Returns true if this item collides with another item; false otherwise.
Connect(string)
Connect to a real robot using the robot driver.
bool Connect(string robotIp = "")Parameters
robotIpstringIP of the robot to connect. Leave empty to use the one defined in RoboDK
Returns
- bool
status -> true if connected successfully, false if connection failed
ConnectSafe(string, int, int)
Connect to a real robot and wait for a connection to succeed.
bool ConnectSafe(string robotIp = "", int maxAttempts = 5, int waitConnection = 4)Parameters
robotIpstringRobot IP. Leave blank to use the robot's connection params.
maxAttemptsintMaximum connection attemps before reporting an unsuccessful connection.
waitConnectionintTime to wait in seconds between connection attempts.
Returns
- bool
True if connected successfully, else false.
ConnectedState()
Check connection status with a real robot.
RobotConnectionType ConnectedState()Returns
- RobotConnectionType
Status contains connection status code enum, Message contains error info if status is not "Ready".
ConnectionParams()
Returns the robot connection parameters.
RobotConnectionParameter ConnectionParams()Returns
- RobotConnectionParameter
Robot IP, Robot Port, FTP Path, FTP Username, FTP Password
Copy(bool)
Copy the item to the clipboard (same as Ctrl+C). Use together with Paste() to duplicate items.
void Copy(bool copy_children = true)Parameters
copy_childrenboolSet to false to prevent copying all items attached to this item
Delete()
Deletes an item and its childs from the station.
void Delete()DetachAll(IItem)
Detaches any object attached to a tool.
void DetachAll(IItem parent = null)Parameters
parentIItemNew 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.
DetachClosest(IItem)
Detach the closest object attached to the tool (see also: setParentStatic).
IItem DetachClosest(IItem parent = null)Parameters
parentIItemNew 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
Disconnect()
Disconnect from a real robot (when the robot driver is used)
bool Disconnect()Returns
- bool
status -> true if disconnected successfully, false if it failed. It can fail if it was previously disconnected manually for example.
Equals(IItem)
Compare this item with other item. Return true if they are the same; False otherwise.
bool Equals(IItem otherItem)Parameters
otherItemIItem
Returns
- bool
True if this item and other item is the same RoboDK item.
FilterProgram(string, out string)
Filter a program file to improve accuracy for a specific robot. The robot must have been previously calibrated.
bool FilterProgram(string filename, out string filterMessage)Parameters
filenamestringFile path of the program. Formats supported include: JBI (Motoman), SRC (KUKA), MOD (ABB), PRG (ABB), LS (FANUC)
filterMessagestringThe summary of the filtering
Returns
- bool
Returns true if the filter succeeded, or false if there are filtering problems.
FilterTarget(Mat, double[])
Filters a target to improve accuracy. This option requires a calibrated robot.
FilterTargetResult FilterTarget(Mat pose, double[] approximatedJoints = null)Parameters
poseMatPose of the robot TCP with respect to the robot reference frame
approximatedJointsdouble[]Approximated desired joints to define the preferred configuration
Returns
- FilterTargetResult
FilterTargetResult with filtered pose and joints
Finish()
Disconnect from the RoboDK API. This flushes any pending program generation.
void Finish()GeometryPose()
Returns the position (pose) the object geometry with respect to its own reference frame. This procedure works for tools and objects.
Mat GeometryPose()Returns
- Mat
4x4 homogeneous matrix (pose)
GetAnalogInput(string)
Get an Analog Input (AI). This function is only useful when connected to a real robot using the robot driver.
string GetAnalogInput(string input)Parameters
inputstringAnalog Input (string or number)
Returns
- string
Returns a string related to the state of the Analog Input (0-1 or other range depending on the robot driver). This function returns an empty string if the script is not executed on the robot.
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.
Color GetColor()Returns
- Color
Color [R, G, B, A]
- See Also
GetDigitalInput(string)
Get a Digital Input (DI). This function is only useful when connected to a real robot using the robot driver.
string GetDigitalInput(string input)Parameters
inputstringDigital Input (string or number)
Returns
- string
Returns a string related to the state of the Digital Input (0/1 or other value depending on the robot driver). This function returns an empty string if the script is not executed on the robot.
GetInstruction(int)
Returns the program instruction at position id
ProgramInstruction GetInstruction(int instructionId)Parameters
instructionIdint
Returns
- ProgramInstruction
program instruction at position instructionId
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.
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
mmStepdoubleMaximum step in millimeters for linear movements (millimeters)
degStepdoubleMaximum step for joint movements (degrees)
saveToFilestringProvide 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.
collisionCheckCollisionCheckOptionsCheck for collisions: will set to 1 or 0
flagsListJointsTypeReserved for future compatibility
timeoutSecintMaximum time to wait for the result (in seconds)
time_stepdoubleTime step in seconds for time-based calculation (ListJointsType must be set to TimeBased)
Returns
- InstructionListJointsResult
List of InstructionListJointsResult.
GetItemFlags()
Retrieve current item flags. Item flags allow defining how much access the user has to item-specific features.
ItemFlags GetItemFlags()Returns
- ItemFlags
Current Item Flags
GetItemType()
Returns the type of an item (robot, object, target, reference frame, ...)
ItemType GetItemType()Returns
GetJointPoses(double[])
Get positions of the joint links for a provided robot configuration (joints). If no joints are provided it will return the poses for the current robot position.
List<Mat> GetJointPoses(double[] joints = null)Parameters
jointsdouble[]Robot configuration (joints)
Returns
- List<Mat>
Returns an array of 4x4 homogeneous matrices. Index 0 is the base frame reference (it never moves when the joints move).
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.
IItem GetLink(ItemType typeLinked = ItemType.Robot)Parameters
typeLinkedItemTypetype of linked object to retrieve
Returns
GetLinks(ItemType)
Get all the items of a specific type for which GetLink returns this item.
List<IItem> GetLinks(ItemType typeLinked = ItemType.Robot)Parameters
typeLinkedItemTypeType of the items to check for a link
Returns
GetParam(string)
Get a custom data parameter. Some items can hold custom data parameters.
byte[] GetParam(string param)Parameters
paramstring
Returns
- byte[]
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.
string GetPoints(ObjectSelectionType featureType, int featureId, out Mat pointList)Parameters
featureTypeObjectSelectionTypeThe 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'
featureIdintThe internal ID to retrieve the right geometry from the object (use SelectedFeature)
pointListMatThe point or a list of points as XYZijk, coordinates are relative to the object (ijk is the normal to the surface)
Returns
- string
The name of the selected geometry (if applicable)
GetRoboDkLink()
Get RoboDK low level link interface.
RoboDK.IRoboDKLink GetRoboDkLink()Returns
GetRunType()
Get the Run Type of a program to specify if a program made using the GUI will be run in simulation mode or on the real robot ("Run on robot" option).
ProgramExecutionType GetRunType()Returns
- ProgramExecutionType
Returns ProgramExecutionType (Simulator or Robot).
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.
Mat Htool()Returns
- Mat
4x4 homogeneous matrix (pose)
InstructionCount()
Returns the number of instructions of a program.
int InstructionCount()Returns
InstructionDelete(int)
Delete an instruction of a program
bool InstructionDelete(int instructionId = 0)Parameters
instructionIdintInstruction ID
Returns
- bool
Returns true if success.
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.
int InstructionList(out Mat instructions)Parameters
instructionsMatthe matrix of instructions
Returns
- int
Returns 0 if success
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.
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
errorMsgstringReturns a human readable error message (if any)
jointListMatReturns the list of joints as [J1, J2, ..., Jn, ERROR, MM_STEP, DEG_STEP, MOVE_ID] if a file name is not specified
mmStepdoubleMaximum step in millimeters for linear movements (millimeters)
degStepdoubleMaximum step for joint movements (degrees)
saveToFilestringProvide 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.
collisionCheckCollisionCheckOptionsCheck for collisions: will set to 1 or 0
flagsListJointsTypeReserved for future compatibility
timeoutSecintMaximum time to wait for the result (in seconds)
time_stepdoubleTime step for time-based calculation (ListJointsType must be set to TimeBased)
Returns
- int
Returns 0 if success, otherwise, it will return negative values
InstructionSelect(int)
Select an instruction in the program as a reference to add new instructions. New instructions will be added after the selected instruction.
int InstructionSelect(int instructionId = -1)Parameters
instructionIdintInstruction ID
Returns
- int
If no Instruction ID is specified, the active instruction will be selected and returned (if the program is running), otherwise it returns -1.
IsInside(IItem)
Check if the object is inside the provided object.
bool IsInside(IItem objectParent)Parameters
objectParentIItem
Returns
- bool
Returns true if the object is inside the objectParent.
IsJointTarget()
Check if the target is a joint target. A joint target moves to the joint position without taking into account the cartesian coordinates.
bool IsJointTarget()Returns
- bool
Returns true if the target is a joint target.
JointLimits(out double[], out double[])
Returns the joint limits of a robot
void JointLimits(out double[] lowerLlimits, out double[] upperLimits)Parameters
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.
double[] Joints()Returns
- double[]
double x n -> joints matrix
JointsConfig(double[])
Returns the robot configuration state for a set of robot joints.
double[] JointsConfig(double[] joints)Parameters
jointsdouble[]array of joints
Returns
- double[]
3-array -> configuration status as [REAR, LOWERARM, FLIP]
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[])
double[] JointsHome()Returns
- double[]
double x n -> joints array
MakeProgram(string, RunMode)
Saves a program to a file.
bool MakeProgram(string filename = "", RunMode runMode = RunMode.MakeRobotProgram)Parameters
filenamestringFile path of the program
runModeRunModeRUNMODE_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
- 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)
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.
void MoveC(IItem itemtarget1, IItem itemtarget2, bool blocking = true)Parameters
itemtarget1IItemtarget -> intermediate target to move to as a target item (RoboDK target item)
itemtarget2IItemtarget -> final target to move to as a target item (RoboDK target item)
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
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.
void MoveC(Mat target1, Mat target2, bool blocking = true)Parameters
target1Matpose -> intermediate pose target to move to. It must be a 4x4 Homogeneous matrix
target2Matpose -> final pose target to move to. It must be a 4x4 Homogeneous matrix
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
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.
void MoveC(double[] joints1, double[] joints2, bool blocking = true)Parameters
joints1double[]joints -> intermediate joint target to move to.
joints2double[]joints -> final joint target to move to.
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
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.
void MoveJ(IItem itemtarget, bool blocking = true)Parameters
itemtargetIItemtarget -> target to move to as a target item (RoboDK target item)
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
MoveJ(Mat, bool)
Moves a robot to a specific target ("Move Joint" mode). By default, this function blocks until the robot finishes its movements.
void MoveJ(Mat target, bool blocking = true)Parameters
targetMatpose -> pose target to move to. It must be a 4x4 Homogeneous matrix
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
MoveJ(double[], bool)
Moves a robot to a specific target ("Move Joint" mode). By default, this function blocks until the robot finishes its movements.
void MoveJ(double[] joints, bool blocking = true)Parameters
jointsdouble[]joints -> joint target to move to.
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
MoveJ_Test(double[], double[], double)
Checks if a joint movement is free of collision.
int MoveJ_Test(double[] j1, double[] j2, double minstepDeg = -1)Parameters
j1double[]joints -> start joints
j2double[]joints -> destination joints
minstepDegdouble(optional): maximum joint step in degrees
Returns
- 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.
MoveJ_Test_Blend(double[], double[], double[], double, double)
Checks if a joint movement is free of collision.
bool MoveJ_Test_Blend(double[] j1, double[] j2, double[] j3, double blendDeg = 5, double minstepDeg = -1)Parameters
j1double[]joints -> start joints
j2double[]joints -> joints via
j3double[]joints -> joints final destination
blendDegdoubleBlend in degrees
minstepDegdouble(optional): maximum joint step in degrees
Returns
- bool
collision : returns false if the movement is possible and free of collision. Otherwise it returns true.
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.
void MoveL(IItem itemtarget, bool blocking = true)Parameters
itemtargetIItemtarget -> target to move to as a target item (RoboDK target item)
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
MoveL(Mat, bool)
Moves a robot to a specific target ("Move Linear" mode). By default, this function blocks until the robot finishes its movements.
void MoveL(Mat target, bool blocking = true)Parameters
targetMatpose -> pose target to move to. It must be a 4x4 Homogeneous matrix
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
MoveL(double[], bool)
Moves a robot to a specific target ("Move Linear" mode). By default, this function blocks until the robot finishes its movements.
void MoveL(double[] joints, bool blocking = true)Parameters
jointsdouble[]joints -> joint target to move to.
blockingboolblocking -> True if we want the instruction to block until the robot finished the movement (default=true)
MoveL_Test(double[], Mat, double)
Checks if a linear movement is free of collision.
int MoveL_Test(double[] j1, Mat t2, double minstepDeg = -1)Parameters
j1double[]joints -> start joints
t2MatPose -> destination pose with respect to the active tool and coordinate system
minstepDegdouble(optional): maximum joint step in degrees
Returns
- 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.
Name()
Returns the name of an item. The name of the item is always displayed in the RoboDK station tree
string Name()Returns
- string
name of the item
NewLink()
Create a new communication link. Use this for robots if you use a multithread application running multiple robots at the same time.
void NewLink()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.
IItem ObjectLink(int linkId = 0)Parameters
linkIdintlink index(0 for the robot base, 1 for the first link, ...)
Returns
Parent()
Returns the parent item of this item.
IItem Parent()Returns
Paste(IItem)
Paste the copied item as a dependency of another item (same as Ctrl+V). Paste should be used after Copy().
IItem Paste(IItem paste_to = null)Parameters
paste_toIItemItem to attach the copied item (optional)
Returns
- IItem
Returns the new item created
Paste(IItem, int)
Paste the copied item as a dependency of another item (same as Ctrl+V). Paste should be used after Copy().
List<IItem> Paste(IItem paste_to, int paste_times)Parameters
paste_toIItemItem to attach the copied item (can be null)
paste_timesintNumber of times to paste the item
Returns
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.
void Pause(double timeMs = -1)Parameters
timeMsdoubleTime in milliseconds
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
Mat Pose()Returns
- Mat
4x4 homogeneous matrix (pose)
PoseAbs()
Returns the global position (pose) of an item. For example, the position of an object/frame/target with respect to the station origin.
Mat PoseAbs()Returns
- Mat
4x4 homogeneous matrix (pose)
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.
Mat PoseFrame()Returns
- Mat
4x4 homogeneous matrix (pose)
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.
Mat PoseTool()Returns
- Mat
4x4 homogeneous matrix (pose)
ProgramStart(string, string, string)
Defines the name of the program when the program is generated. It is also possible to specify the name of the post processor as well as the folder to save the program. This method must be called before any program output is generated (before any robot movement or other instruction).
int ProgramStart(string progname, string defaultfolder = "", string postprocessor = "")Parameters
prognamestringname of the program
defaultfolderstringfolder to save the program, leave empty to use the default program folder
postprocessorstringname of the post processor (for a post processor in C:/RoboDK/Posts/Fanuc_post.py it is possible to provide "Fanuc_post.py" or simply "Fanuc_post")
Returns
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].
Mat ProjectPoints(Mat points, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)Parameters
pointsMatmatrix 3xN or 6xN -> list of points to project
projectionTypeProjectionTypeprojection_type -> Type of projection. For example: ProjectionType.AlongNormalRecalc will project along the point normal and recalculate the normal vector on the surface projected.
Returns
- Mat
projected points (empty matrix if failed)
RDK()
Returns the RoboDK link Robolink().
RoboDK RDK()Returns
RL()
Use RDK() instead. Returns the RoboDK link Robolink().
RoboDK RL()Returns
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.
void Recolor(double[] tocolor, double[] fromcolor = null, double tolerance = 0.1)Parameters
tocolordouble[]color to change to
fromcolordouble[]filter by this color
tolerancedoubleoptional tolerance to use if a color filter is used (defaults to 0.1)
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.
void Recolor(Color tocolor, Color? fromcolor = null, double tolerance = 0.1)Parameters
tocolorColorcolor to change to
fromcolorColor?filter by this color
tolerancedoubleoptional tolerance to use if a color filter is used (defaults to 0.1)
RunCode(string)
Runs a program. It returns the number of instructions 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
int RunCode(string parameters = null)Parameters
parametersstringNumber of instructions that can be executed
Returns
RunCodeCustom(string, ProgramRunType)
Adds a program call, code, message or comment to the program. Returns True if succeeded.
bool RunCodeCustom(string code, ProgramRunType runType = ProgramRunType.CallProgram)Parameters
codestringstring of the code or program to run
runTypeProgramRunTypespecify if the code is a program
Returns
- bool
True if success; False othwersise
RunInstruction(string, ProgramRunType)
Adds a program call, code, message or comment to the program. Returns True if succeeded.
bool RunInstruction(string code, ProgramRunType runType = ProgramRunType.CallProgram)Parameters
codestringstring of the code or program to run
runTypeProgramRunTypespecify if the code is a program
Returns
- bool
True if success; False othwersise
RunProgram()
Runs a program. It returns the number of instructions 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
int RunProgram()Returns
- int
number of instructions that can be executed
Save(string)
Save a station or object to a file
void Save(string filename)Parameters
filenamestring
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).
void Scale(double[] scale)Parameters
scaledouble[]scale to apply as [scale_x, scale_y, scale_z]
SearchL(IItem, bool)
Moves a robot to a specific target and stops when a specific input switch is detected ("Search Linear" mode). This function waits (blocks) until the robot finishes its movements.
double[] SearchL(IItem target, bool blocking = true)Parameters
targetIItemTarget to move to as a target item (RoboDK target item)
blockingboolSet to true to wait until the robot finished the movement (default=true)
Returns
- double[]
SearchL(Mat, bool)
Moves a robot to a specific target and stops when a specific input switch is detected ("Search Linear" mode). This function waits (blocks) until the robot finishes its movements.
double[] SearchL(Mat target, bool blocking = true)Parameters
targetMatPose target to move to. It must be a 4x4 Homogeneous matrix
blockingboolSet to true to wait until the robot finished the movement (default=true)
Returns
- double[]
SearchL(double[], bool)
Moves a robot to a specific target and stops when a specific input switch is detected ("Search Linear" mode). This function waits (blocks) until the robot finishes its movements.
double[] SearchL(double[] target, bool blocking = true)Parameters
targetdouble[]Joint target to move to.
blockingboolSet to true to wait until the robot finished the movement (default=true)
Returns
- double[]
SelectedFeature(out ObjectSelectionType, out int)
Retrieve the currently selected feature for this object (surface, point, line, ...)
bool SelectedFeature(out ObjectSelectionType featureType, out int featureId)Parameters
featureTypeObjectSelectionTypeThe type of geometry, FEATURE_SURFACE, FEATURE_POINT, ...
featureIdintThe internal ID to retrieve the raw geometry (use GetPoints)
Returns
- bool
True if the object is selected
SetAcceleration(double)
Sets the linear acceleration of a robot in mm/s2
void SetAcceleration(double value)Parameters
valuedoubleAcceleration in mm/s2
SetAccelerationJoints(double)
Sets the joint acceleration of a robot
void SetAccelerationJoints(double value)Parameters
valuedoubleAcceleration in deg/s2 for rotary joints and mm/s2 for linear joints
SetAccuracyActive(bool)
Sets the accuracy of the robot active or inactive. A robot must have been calibrated to properly use this option.
void SetAccuracyActive(bool accurate = true)Parameters
accurateboolSet true to use the accurate model or false to use the nominal model
SetAnalogOutput(string, string)
Set an Analog Output (AO).
void SetAnalogOutput(string output, string value)Parameters
SetAsCartesianTarget()
Sets a target as a cartesian target. A cartesian target moves to cartesian coordinates.
void SetAsCartesianTarget()SetAsJointTarget()
Sets a target as a joint target. A joint target moves to a joints position without regarding the cartesian coordinates.
void SetAsJointTarget()SetColor(int, Color)
Set the color of an object shape. It can also be used for tools. A color must in the format COLOR=[R, G, B,(A = 1)] where all values range from 0 to 1.
void SetColor(int shapeId, Color tocolor)Parameters
shapeIdintID of the shape: the ID is the order in which the shape was added using AddShape()
tocolorColorcolor to set
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.
void SetColor(Color tocolor)Parameters
tocolorColorcolor to set
- See Also
- GetColor()
SetColorCurve(Color, int)
Set the color of a curve object. It can also be used for tools. A color must in the format COLOR=[R, G, B,(A = 1)] where all values range from 0 to 1.
void SetColorCurve(Color tocolor, int curveId = -1)Parameters
tocolorColorcolor to set
curveIdintID of the curve: the ID is the order in which the shape was added using AddCurve()
SetDigitalOutput(string, string)
Set a Digital Output (DO). This command can also be used to set any generic variables to a desired value.
void SetDigitalOutput(string output, string value)Parameters
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.
void SetFrame(IItem frame)Parameters
frameIItemitem/pose -> frame item or 4x4 Matrix (pose of the reference frame)
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.
void SetFrame(Mat frame)Parameters
frameMatitem/pose -> frame item or 4x4 Matrix (pose of the reference frame)
SetGeometryPose(Mat)
Sets the position (pose) the object geometry with respect to its own reference frame. This procedure works for tools and objects.
void SetGeometryPose(Mat pose)Parameters
poseMat4x4 homogeneous matrix
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.
void SetHtool(Mat pose)Parameters
poseMat4x4 homogeneous matrix (pose)
SetInstruction(int, ProgramInstruction)
Sets the program instruction at position id
void SetInstruction(int instructionId, ProgramInstruction instruction)Parameters
instructionIdintinstructionProgramInstruction
SetItemFlags(ItemFlags)
Update item flags. Item flags allow defining how much access the user has to item-specific features.
void SetItemFlags(ItemFlags itemFlags = ItemFlags.All)Parameters
itemFlagsItemFlagsItem Flags to be set
SetJointLimits(double[], double[])
Sets the joint limits of a robot
void SetJointLimits(double[] lowerLlimits, double[] upperLimits)Parameters
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.
bool SetJoints(double[] joints, SetJointsType saturate_action = SetJointsType.Default)Parameters
jointsdouble[]array of joint values, in degrees or mm for linear axes
saturate_actionSetJointsTypeBehavior to saturate or ignore invalid joints (only applicable to robot items)
Returns
- bool
Returns True if the joints are valid (not saturated), False if they are outside the joint limitations.
SetJointsHome(double[])
Set the home position of the robot in the joint space. param joints: robot joints JointsHome()
void SetJointsHome(double[] joints)Parameters
jointsdouble[]Home Position of all robot joints
SetLink(IItem)
Sets a link between this item and the specified item. This is useful to set the relationship between programs, robots, tools and other specific projects.
void SetLink(IItem item)Parameters
itemIItemItem to link
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.
IItem SetMachiningParameters(string ncfile = "", IItem partObj = null, string options = "")Parameters
ncfilestringpath to the NC (G-code/APT/Point cloud) file to load (optional)
partObjIItemoptionsstringAdditional options (optional)
Returns
- IItem
Program (null). Use Update() to retrieve the result
SetName(string)
Set the name of a RoboDK item.
void SetName(string name)Parameters
namestring
SetParam(string, byte[])
Set a custom data parameter. Some items can hold custom data parameters.
void SetParam(string param, byte[] value)Parameters
SetParam(string, string)
Send a specific parameter for an item.
string SetParam(string param, string value = "")Parameters
Returns
- string
Command response
SetParent(IItem)
Attaches the item to a new parent while maintaining the relative position with its parent. The absolute position is changed.
void SetParent(IItem parent)Parameters
parentIItem
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.
void SetParentStatic(IItem parent)Parameters
parentIItemparent item to attach this item
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.
void SetPose(Mat pose)Parameters
poseMat4x4 homogeneous matrix
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.
void SetPoseAbs(Mat pose)Parameters
poseMat4x4 homogeneous matrix (pose)
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 position SetPoseFrame(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.
void SetPoseFrame(IItem frameItem)Parameters
frameItemIItem
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 position SetPoseFrame(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.
void SetPoseFrame(Mat framePose)Parameters
framePoseMat
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.
void SetPoseTool(IItem toolItem)Parameters
toolItemIItem
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.
void SetPoseTool(Mat toolPose)Parameters
toolPoseMat
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.
void SetRobot(IItem robot = null)Parameters
robotIItemRobot item
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.
void SetRounding(double rounding)Parameters
roundingdouble
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.
void SetRunType(ProgramExecutionType programExecutionType)Parameters
programExecutionTypeProgramExecutionType
SetSpeed(double, double, double, double)
Sets the speed and/or the acceleration of a robot.
void SetSpeed(double speedLinear, double accelLinear = -1, double speedJoints = -1, double accelJoints = -1)Parameters
speedLineardoublelinear speed in mm/s (-1 = no change)
accelLineardoublelinear acceleration in mm/s2 (-1 = no change)
speedJointsdoublejoint speed in deg/s (-1 = no change)
accelJointsdoublejoint acceleration in deg/s2 (-1 = no change)
SetSpeedJoints(double)
Sets the joint speed of a robot
void SetSpeedJoints(double value)Parameters
valuedoubleSpeed in deg/s for rotary joints and mm/s for linear joints
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.
void SetTool(IItem tool)Parameters
toolIItemitem/pose -> tool item or 4x4 Matrix (pose of the tool frame)
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.
void SetTool(Mat tool)Parameters
toolMatitem/pose -> tool item or 4x4 Matrix (pose of the tool frame)
SetTransparency(double)
Set the alpha channel of an object, tool or robot. The alpha channel must remain between 0 and 1.
void SetTransparency(double alpha)Parameters
alphadoubletransparency level
- See Also
- GetColor()
SetValue(string, Mat)
Set a specific property name to a given value. This is reserved for internal purposes and future compatibility.
Mat SetValue(string variableName, Mat value = null)Parameters
Returns
SetValue(string, string)
Set a specific property name to a given value. This is reserved for internal purposes and future compatibility.
void SetValue(string variableName, string value)Parameters
SetVisible(bool, VisibleRefType)
Sets the item visiblity status
void SetVisible(bool visible, VisibleRefType visibleFrame = (VisibleRefType)-1)Parameters
visibleboolvisibleFrameVisibleRefTypesrt the visible reference frame (1) or not visible (0)
SetZoneData(double)
Sets the robot movement smoothing accuracy (also known as zone data value).
Obsolete, use SetRounding instead.
[Obsolete]
void SetZoneData(double zonedata)Parameters
zonedatadoublezonedata value (int) (robot dependent, set to -1 for fine movements)
ShowAsCollided(bool, int)
Show an object or a robot link as collided (red)
void ShowAsCollided(bool collided, int robotLinkId = 0)Parameters
ShowInstructions(bool)
Show or hide instruction items of a program in the RoboDK tree
void ShowInstructions(bool show = true)Parameters
showbool
ShowSequence(Mat)
Displays a sequence of joints
void ShowSequence(Mat sequence)Parameters
sequenceMatjoint sequence as a 6xN matrix or instruction sequence as a 7xN matrix
ShowSequence(List<double[]>, List<Mat>, SequenceDisplayFlags, int)
Displays a sequence of joints or poses
void ShowSequence(List<double[]> joints = null, List<Mat> poses = null, SequenceDisplayFlags flags = (SequenceDisplayFlags)-1, int timeout = -1)Parameters
jointsList<double[]>List of joint arrays
posesList<Mat>List of poses
flagsSequenceDisplayFlagsDisplay options
timeoutintDisplay timeout, in milliseconds (default: -1)
ShowTargets(bool)
Show or hide targets of a program in the RoboDK tree
void ShowTargets(bool show = true)Parameters
showbool
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.
double[] SimulatorJoints()Returns
- double[]
double x n -> joints array
SolveFK(double[])
Computes the forward kinematics of the robot for the provided joints. The tool and the reference frame are not taken into account.
Mat SolveFK(double[] joints)Parameters
jointsdouble[]
Returns
- Mat
4x4 homogeneous matrix: pose of the robot flange with respect to the robot base
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())
double[] SolveIK(Mat pose, double[] jointsApprox = null, Mat tool = null, Mat reference = null)Parameters
poseMat4x4 matrix -> pose of the robot flange with respect to the robot base frame
jointsApproxdouble[]Aproximate solution. Leave empty to return the closest match to the current robot position.
toolMat4x4 matrix -> Optionally provide a tool, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.
referenceMat4x4 matrix -> Optionally provide a reference, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.
Returns
- double[]
array of joints
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.
Mat SolveIK_All(Mat pose, Mat tool = null, Mat reference = null)Parameters
poseMat4x4 matrix -> pose of the robot tool with respect to the robot frame
toolMat4x4 matrix -> Optionally provide a tool, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.
referenceMat4x4 matrix -> Optionally provide a reference, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.
Returns
- Mat
double x n x m -> joint list (2D matrix)
Stop()
Stops a program or a robot
void Stop()Update()
UpdateResult Update()Returns
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.
UpdateResult Update(CollisionCheckOptions collisionCheck, int timeoutSec = 3600, double linStepMm = -1, double jointStepDeg = -1)Parameters
collisionCheckCollisionCheckOptionscheck_collisions: Check collisions (COLLISION_ON -yes- or COLLISION_OFF -no-)
timeoutSecintMaximum time to wait for the update to complete (in seconds)
linStepMmdoubleMaximum step in millimeters for linear movements (millimeters). Set to -1 to use the default, as specified in Tools-Options-Motion.
jointStepDegdoubleMaximum step for joint movements (degrees). Set to -1 to use the default, as specified in Tools-Options-Motion.
Returns
- 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)
Valid(bool)
Checks if the item is valid. An invalid item will be returned by an unsuccessful function call.
bool Valid(bool checkDeleted = false)Parameters
checkDeletedboolCheck if the item was deleted in RoboDK
Returns
- bool
true if valid, false if invalid
Visible()
Returns 1 if the item is visible, otherwise, returns 0.
bool Visible()Returns
- bool
true if visible, false if not visible
WaitDigitalInput(string, string, double)
Waits for an input to attain a given value. Optionally, a timeout can be provided.
void WaitDigitalInput(string input, string value, double timeout = -1)Parameters
inputstringDigital Input (string or number)
valuestringExpected value
timeoutdoubleTimeout in miliseconds
WaitFinished()
Wait until a program finishes or a robot completes its movement
void WaitFinished()WaitMove(double)
Waits (blocks) until the robot finishes its movement.
void WaitMove(double timeoutSec = 300)Parameters
timeoutSecdoubletimeout -> Max time to wait for robot to finish its movement (in seconds)
setConnectionParams(string, int, string, string, string)
Set the robot connection parameters.
void setConnectionParams(string robotIP, int port, string remotePath, string ftpUser, string ftpPass)Parameters
robotIPstringIP address of robot.
portintPort of robot.
remotePathstringFTP path to connect to.
ftpUserstringFTP username
ftpPassstringFTP password
setDO(string, string)
Sets a variable (output) to a given value. This can also be used to set any variables to a desired value.
void setDO(string ioVar, string ioValue)Parameters
ioVarstringio_var -> digital output (string or number)
ioValuestringio_value -> value (string or number)
setParamRobotTool(double, double[])
Sets the tool mass and center of gravity. This is only used with accurate robots to improve accuracy.
void setParamRobotTool(double toolMass, double[] toolCOG)Parameters
toolMassdoubleTool weigth in Kg.
toolCOGdouble[]Tool center of gravity as [x,y,z] with respect to the robot flange.
waitDI(string, string, double)
Waits for an input io_id to attain a given value io_value. Optionally, a timeout can be provided.
void waitDI(string ioVar, string ioValue, double timeoutMs = -1)