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 SourceAddCurve(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 |
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 |
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 |
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 |
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 |
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 |
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) |
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 |
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 |
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 |
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". |
ConnectionParams()
Returns the robot connection parameters.
Declaration
RobotConnectionParameter ConnectionParams()
Returns
Type | Description |
---|---|
RobotConnectionParameter | Robot IP, Robot Port, FTP Path, FTP Username, FTP Password |
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. |
Delete()
Deletes an item and its childs from the station.
Declaration
void Delete()
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. |
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 |
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. |
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. |
Finish()
Disconnect from the RoboDK API. This flushes any pending program generation.
Declaration
void Finish()
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) |
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
|Improve this Doc View SourceGetInstruction(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 |
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. |
GetItemFlags()
检索当前项标志。项flags allow defining how much access the user has to item-specific features.
Declaration
项Flags GetItemFlags()
Returns
Type | Description |
---|---|
项Flags | Current Item Flags |
GetItemType()
Returns the type of an item (robot, object, target, reference frame, ...)
Declaration
项Type GetItemType()
Returns
Type | Description |
---|---|
项Type |
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 |
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[] |
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) |
GetRoboDkLink()
Get RoboDK low level link interface.
Declaration
RoboDK.IRoboDKLink GetRoboDkLink()
Returns
Type | Description |
---|---|
RoboDK.IRoboDKLink |
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) |
InstructionCount()
Returns the number of instructions of a program.
Declaration
int InstructionCount()
Returns
Type | Description |
---|---|
int |
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 |
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 |
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 |
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 |
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] |
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 |
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) |
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) |
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) |
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) |
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. |
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. |
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) |
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) |
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) |
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. |
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) |
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) |
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) |
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 |
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()
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 |
Parent()
Returns the parent item of this item.
Declaration
IItem Parent()
Returns
Type | Description |
---|---|
IItem |
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 |
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) |
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) |
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) |
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) |
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) |
RDK()
Returns the RoboDK link Robolink().
Declaration
RoboDK RDK()
Returns
Type | Description |
---|---|
RoboDK |
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) |
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) |
RL()
Use RDK() instead. Returns the RoboDK link Robolink().
Declaration
RoboDK RL()
Returns
Type | Description |
---|---|
RoboDK |
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 |
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 |
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 |
Save(string)
Save a station or object to a file
Declaration
void Save(string filename)
Parameters
Type | Name | Description |
---|---|---|
string | filename |
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] |
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 |
SetAsCartesianTarget()
Sets a target as a cartesian target. A cartesian target moves to cartesian coordinates.
Declaration
void SetAsCartesianTarget()
SetAsJointTarget()
Sets a target as a joint target. A joint target moves to a joints position without regarding the cartesian coordinates.
Declaration
void SetAsJointTarget()
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 |
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
|Improve this Doc View SourcesetConnectionParams(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 |
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) |
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) |
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) |
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 |
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) |
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 |
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 |
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 |
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. |
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 |
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 |
SetName(string)
Set the name of a RoboDK item.
Declaration
void SetName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
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 |
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 |
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. |
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 | 家长 |
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 |
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 |
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) |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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) |
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) |
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) |
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
|Improve this Doc View SourceSetVisible(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) |
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) |
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 |
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 |
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 |
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 |
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 |
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 |
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矩阵) |
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 |
Stop()
Stops a program or a robot
Declaration
void Stop()
Update()
Declaration
UpdateResult Update()
Returns
Type | Description |
---|---|
UpdateResult |
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) |
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 |
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 |
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 |
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) |