RoboDK API - Documentation
Item Class Reference

The Item class represents an item in RoboDK station. An item can be a robot, a frame, a tool, an object, a target, ... any item visible in the station tree. An item can also be seen as a node where other items can be attached to (child items). Every item has one parent item/node and can have one or more child items/nodes. More...

#include <robodk_api.h>

Public Member Functions

 Item (RoboDK *rdk=nullptr, quint64 ptr=0, qint32 type=-1)
 
 Item (const Item &other)
 
Itemoperator= (const Item &x)=default
 
QString ToString () const
 
RoboDKRDK ()
 Returns the RoboDK link Robolink(). More...
 
void NewLink ()
 Create a new communication link for RoboDK. Use this for robots if you use a multithread application running multiple robots at the same time. More...
 
int Type () const
 Item type (object, robot, tool, reference, robot machining project, ...) More...
 
void Save (const QString &filename)
 Save a station, a robot, a tool or an object to a file More...
 
void Delete ()
 Deletes an item and its childs from the station. More...
 
bool Valid (bool check_pointer=false) const
 Check if an item is valid (not null and available in the open station) More...
 
void setParent (Item parent)
 Attaches the item to a new parent while maintaining the relative position with its parent. The absolute position is changed. More...
 
void setParentStatic (Item parent)
 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. More...
 
Item AttachClosest ()
 Attach the closest object to the tool. Returns the item that was attached. More...
 
Item DetachClosest (Item parent)
 Detach the closest object attached to the tool (see also setParentStatic). More...
 
void DetachAll (Item parent)
 Detach any object attached to a tool. More...
 
Item Parent () const
 Return the parent item of this item More...
 
QList< ItemChilds () const
 Returns a list of the item childs that are attached to the provided item. More...
 
bool Visible () const
 Returns 1 if the item is visible, otherwise, returns 0. More...
 
void setVisible (bool visible, int visible_frame=-1)
 Sets the item visiblity status More...
 
QString Name () const
 Returns the name of an item. The name of the item is always displayed in the RoboDK station tree More...
 
void setName (const QString &name)
 Set the name of a RoboDK item. More...
 
void setPose (const Mat pose)
 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 efector. More...
 
Mat Pose () const
 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 efector More...
 
void setGeometryPose (const Mat pose)
 Sets the position (pose) the object geometry with respect to its own reference frame. This procedure works for tools and objects. More...
 
Mat GeometryPose ()
 Returns the position (pose) the object geometry with respect to its own reference frame. This procedure works for tools and objects. More...
 
Mat 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. More...
 
Mat 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. More...
 
void setPoseFrame (const Mat frame_pose)
 Sets the reference frame of a robot(user frame). The frame can be either an item or a pose. If "frame" is an item, it links the robot to the frame item. If frame is a pose, it updates the linked pose of the robot frame (with respect to the robot reference frame). More...
 
void setPoseFrame (const Item frame_item)
 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. More...
 
void setPoseTool (const Mat tool_pose)
 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. More...
 
void setPoseTool (const Item tool_item)
 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. More...
 
void setPoseAbs (const Mat pose)
 Sets the global position (pose) of an item. For example, the position of an object/frame/target with respect to the station origin. More...
 
Mat PoseAbs ()
 Returns the global position (pose) of an item. For example, the position of an object/frame/target with respect to the station origin. More...
 
void setColor (double colorRGBA[4])
 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. More...
 
void Scale (double scale)
 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). More...
 
void Scale (double scale_xyz[3])
 Apply a per-axis 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). More...
 
Item setMachiningParameters (QString ncfile="", Item part_obj=nullptr, QString options="")
 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.
Tip: Use setPoseTool() and setPoseFrame() to link to the corresponding tool and reference frames. More...
 
void setAsCartesianTarget ()
 Sets a target as a cartesian target. A cartesian target moves to cartesian coordinates. More...
 
void setAsJointTarget ()
 Sets a target as a joint target. A joint target moves to a joints position without regarding the cartesian coordinates. More...
 
bool isJointTarget () const
 Returns True if a target is a joint target (green icon). Otherwise, the target is a Cartesian target (red icon). More...
 
tJoints Joints () const
 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. More...
 
tJoints JointsHome () const
 Returns the home joints of a robot. These joints can be manually set in the robot "Parameters" menu, then select "Set home position" More...
 
void setJointsHome (const tJoints &jnts)
 Set robot joints for the home position More...
 
Item ObjectLink (int link_id=0)
 Returns an item pointer to the geometry of a robot link. This is useful to show/hide certain robot links or alter their geometry. More...
 
Item getLink (int type_linked=RoboDK::ITEM_TYPE_ROBOT)
 Returns an item linked to a robot, object, tool, program or robot machining project. This is useful to retrieve the relationship between programs, robots, tools and other specific projects. More...
 
void setJoints (const tJoints &jnts)
 Set robot joints or the joints of a target More...
 
void JointLimits (tJoints *lower_limits, tJoints *upper_limits)
 Retrieve the joint limits of a robot More...
 
void setJointLimits (const tJoints &lower_limits, const tJoints &upper_limits)
 Set the joint limits of a robot More...
 
void setRobot (const Item &robot)
 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. More...
 
Item AddTool (const Mat &tool_pose, const QString &tool_name="New TCP")
 Adds an empty tool to the robot provided the tool pose (4x4 Matrix) and the tool name. More...
 
Mat SolveFK (const tJoints &joints, const Mat *tool=nullptr, const Mat *ref=nullptr)
 Computes the forward kinematics of the robot for the provided joints. The tool and the reference frame are not taken into account. More...
 
void JointsConfig (const tJoints &joints, tConfig config)
 Returns the robot configuration state for a set of robot joints. More...
 
tJoints SolveIK (const Mat &pose, const Mat *tool=nullptr, const Mat *ref=nullptr)
 Computes the inverse kinematics for the specified robot and pose. The joints returned are the closest to the current robot configuration (see SolveIK_All()) More...
 
tJoints SolveIK (const Mat pose, tJoints joints_approx, const Mat *tool=nullptr, const Mat *ref=nullptr)
 Computes the inverse kinematics for the specified robot and pose. The joints returned are the closest to the current robot configuration (see SolveIK_All()) More...
 
tMatrix2DSolveIK_All_Mat2D (const Mat &pose, const Mat *tool=nullptr, const Mat *ref=nullptr)
 Computes the inverse kinematics for the specified robot and pose. The function returns all available joint solutions as a 2D matrix. More...
 
QList< tJointsSolveIK_All (const Mat &pose, const Mat *tool=nullptr, const Mat *ref=nullptr)
 Computes the inverse kinematics for the specified robot and pose. The function returns all available joint solutions as a 2D matrix. More...
 
bool Connect (const QString &robot_ip="")
 Connect to a real robot using the corresponding robot driver. More...
 
bool Disconnect ()
 Disconnect from a real robot (when the robot driver is used) More...
 
void MoveJ (const Item &itemtarget, bool blocking=true)
 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. More...
 
void MoveJ (const tJoints &joints, bool blocking=true)
 Moves a robot to a specific target ("Move Joint" mode). By default, this function blocks until the robot finishes its movements. More...
 
void MoveJ (const Mat &target, bool blocking=true)
 Moves a robot to a specific target ("Move Joint" mode). By default, this function blocks until the robot finishes its movements. More...
 
void MoveL (const Item &itemtarget, bool blocking=true)
 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. More...
 
void MoveL (const tJoints &joints, bool blocking=true)
 Moves a robot to a specific target ("Move Linear" mode). By default, this function blocks until the robot finishes its movements. More...
 
void MoveL (const Mat &target, bool blocking=true)
 Moves a robot to a specific target ("Move Linear" mode). By default, this function blocks until the robot finishes its movements. More...
 
void MoveC (const Item &itemtarget1, const Item &itemtarget2, bool blocking=true)
 Moves a robot to a specific target ("Move Circular" mode). By default, this function blocks until the robot finishes its movements. More...
 
void MoveC (const tJoints &joints1, const tJoints &joints2, bool blocking=true)
 Moves a robot to a specific target ("Move Circular" mode). By default, this function blocks until the robot finishes its movements. More...
 
void MoveC (const Mat &target1, const Mat &target2, bool blocking=true)
 Moves a robot to a specific target ("Move Circular" mode). By default, this function blocks until the robot finishes its movements. More...
 
int MoveJ_Test (const tJoints &j1, const tJoints &j2, double minstep_deg=-1)
 Checks if a joint movement is possible and, optionally, free of collisions. More...
 
int MoveL_Test (const tJoints &joints1, const Mat &pose2, double minstep_mm=-1)
 Checks if a linear movement is free of issues and, optionally, collisions. More...
 
void setSpeed (double speed_linear, double accel_linear=-1, double speed_joints=-1, double accel_joints=-1)
 Sets the speed and/or the acceleration of a robot. More...
 
void setRounding (double zonedata)
 Sets the robot movement smoothing accuracy (also known as zone data value). More...
 
void ShowSequence (tMatrix2D *sequence)
 Displays a sequence of joints More...
 
bool Busy ()
 Checks if a robot or program is currently running (busy or moving) More...
 
void Stop ()
 Stops a program or a robot More...
 
void WaitMove (double timeout_sec=300) const
 Waits (blocks) until the robot finishes its movement. More...
 
void setAccuracyActive (int accurate=1)
 Sets the accuracy of the robot active or inactive. A robot must have been calibrated to properly use this option. More...
 
bool MakeProgram (const QString &filename)
 Saves a program to a file. More...
 
void setRunType (int program_run_type)
 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. More...
 
int 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 More...
 
int RunCode (const QString &parameters)
 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 More...
 
int RunInstruction (const QString &code, int run_type=RoboDK::INSTRUCTION_CALL_PROGRAM)
 Adds a program call, code, message or comment inside a program. More...
 
void Pause (double time_ms=-1)
 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. More...
 
void setDO (const QString &io_var, const QString &io_value)
 Sets a variable (output) to a given value. This can also be used to set any variables to a desired value. More...
 
void setAO (const QString &io_var, const QString &io_value)
 Set an analog Output More...
 
QString getDI (const QString &io_var)
 Get a Digital Input (DI). This function is only useful when connected to a real robot using the robot driver. It returns a string related to the state of the Digital Input (1=True, 0=False). This function returns an empty string if the script is not executed on the robot. More...
 
QString getAI (const QString &io_var)
 Get an Analog Input (AI). This function is only useful when connected to a real robot using the robot driver. It returns a string related to the state of the Digital 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. More...
 
void waitDI (const QString &io_var, const QString &io_value, double timeout_ms=-1)
 Waits for an input io_id to attain a given value io_value. Optionally, a timeout can be provided. More...
 
void customInstruction (const QString &name, const QString &path_run, const QString &path_icon="", bool blocking=true, const QString &cmd_run_on_robot="")
 Add a custom instruction. This instruction will execute a Python file or an executable file. More...
 
void ShowInstructions (bool visible=true)
 Show or hide instruction items of a program in the RoboDK tree More...
 
void ShowTargets (bool visible=true)
 Show or hide targets of a program in the RoboDK tree More...
 
int InstructionCount ()
 Returns the number of instructions of a program. More...
 
void Instruction (int ins_id, QString &name, int &instype, int &movetype, bool &isjointtarget, Mat &target, tJoints &joints)
 Returns the program instruction at position id More...
 
void setInstruction (int ins_id, const QString &name, int instype, int movetype, bool isjointtarget, const Mat &target, const tJoints &joints)
 Sets the program instruction at position id More...
 
int InstructionList (tMatrix2D *instructions)
 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. More...
 
double Update (int collision_check=RoboDK::COLLISION_OFF, int timeout_sec=3600, double *out_nins_time_dist=nullptr, double mm_step=-1, double deg_step=-1)
 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. More...
 
int InstructionListJoints (QString &error_msg, tMatrix2D **joint_list, double mm_step=10.0, double deg_step=5.0, const QString &save_to_file="", bool collision_check=false, int flags=0, double time_step_s=0.1)
 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. More...
 
QString setParam (const QString &param, const QString &value)
 Set a specific item parameter. Select Tools-Run Script-Show Commands to see all available commands for items and the station. Note: For parameters (commands) that require a JSON string value you can also provide a dict. More...
 
bool Finish ()
 Disconnect from the RoboDK API. This flushes any pending program generation. More...
 
quint64 GetID ()
 Get the item pointer. More...
 

Private Attributes

RoboDK_RDK
 Pointer to RoboDK link object. More...
 
quint64 _PTR
 Pointer to the item inside RoboDK. More...
 
qint32 _TYPE
 Item type. More...
 

Friends

class RoboDK_API::RoboDK
 

Detailed Description

The Item class represents an item in RoboDK station. An item can be a robot, a frame, a tool, an object, a target, ... any item visible in the station tree. An item can also be seen as a node where other items can be attached to (child items). Every item has one parent item/node and can have one or more child items/nodes.

Definition at line 1749 of file robodk_api.h.

Constructor & Destructor Documentation

◆ Item() [1/2]

Item ( RoboDK rdk = nullptr,
quint64  ptr = 0,
qint32  type = -1 
)

Definition at line 560 of file robodk_api.cpp.

◆ Item() [2/2]

Item ( const Item other)

Definition at line 565 of file robodk_api.cpp.

◆ ~Item()

~Item ( )

Definition at line 570 of file robodk_api.cpp.

Member Function Documentation

◆ AddTool()

Item AddTool ( const Mat tool_pose,
const QString &  tool_name = "New TCP" 
)

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

Parameters
tool_poseTCP as a 4x4 Matrix (pose of the tool frame)
tool_nameNew tool name
Returns
new item created
Parameters
tool_posepose -> TCP as a 4x4 Matrix (pose of the tool frame)
tool_nameNew tool name
Returns
new item created

Definition at line 1222 of file robodk_api.cpp.

◆ AttachClosest()

Item AttachClosest ( )

Attach the closest object to the tool. Returns the item that was attached.

Returns
Attached item

Definition at line 672 of file robodk_api.cpp.

◆ Busy()

bool Busy ( )

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

Returns
busy status (true=moving, false=stopped)

Definition at line 1583 of file robodk_api.cpp.

◆ Childs()

QList< Item > Childs ( ) const

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

Returns
item x n: list of child items

add more methods

Returns
item x n -> list of child items

Definition at line 726 of file robodk_api.cpp.

◆ Connect()

bool Connect ( const QString &  robot_ip = "")

Connect to a real robot using the corresponding robot driver.

Connect to a real robot using the robot driver.

Parameters
robot_ipIP of the robot to connect. Leave empty to use the one defined in RoboDK
Returns
true if connected successfully, false if connection failed
Parameters
robot_ipIP of the robot to connect. Leave empty to use the one defined in RoboDK
Returns
status -> true if connected successfully, false if connection failed

Definition at line 1366 of file robodk_api.cpp.

◆ customInstruction()

void customInstruction ( const QString &  name,
const QString &  path_run,
const QString &  path_icon = "",
bool  blocking = true,
const QString &  cmd_run_on_robot = "" 
)

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

Parameters
name
path_runpath to run(relative to RoboDK/bin folder or absolute path)
path_iconicon path(relative to RoboDK/bin folder or absolute path)
blockingTrue if blocking, 0 if it is a non blocking executable trigger
cmd_run_on_robotCommand to run through the driver when connected to the robot

:param name: digital input (string or number)

Definition at line 1826 of file robodk_api.cpp.

◆ Delete()

void Delete ( )

Deletes an item and its childs from the station.

Definition at line 624 of file robodk_api.cpp.

◆ DetachAll()

void DetachAll ( Item  parent)

Detach any object attached to a tool.

Definition at line 698 of file robodk_api.cpp.

◆ DetachClosest()

Item DetachClosest ( Item  parent)

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

Returns
Detached item

Definition at line 685 of file robodk_api.cpp.

◆ Disconnect()

bool Disconnect ( )

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

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

Definition at line 1380 of file robodk_api.cpp.

◆ Finish()

bool Finish ( )

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

Returns

Definition at line 2075 of file robodk_api.cpp.

◆ GeometryPose()

Mat GeometryPose ( )

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

Returns
4x4 homogeneous matrix (pose)

Definition at line 840 of file robodk_api.cpp.

◆ getAI()

QString getAI ( const QString &  io_var)

Get an Analog Input (AI). This function is only useful when connected to a real robot using the robot driver. It returns a string related to the state of the Digital 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.

Parameters
io_vario_var -> analog input (string or number as a string)

Definition at line 1790 of file robodk_api.cpp.

◆ getDI()

QString getDI ( const QString &  io_var)

Get a Digital Input (DI). This function is only useful when connected to a real robot using the robot driver. It returns a string related to the state of the Digital Input (1=True, 0=False). This function returns an empty string if the script is not executed on the robot.

Parameters
io_vario_var -> digital input (string or number as a string)

Definition at line 1776 of file robodk_api.cpp.

◆ GetID()

quint64 GetID ( )

Get the item pointer.

Definition at line 2080 of file robodk_api.cpp.

◆ getLink()

Item getLink ( int  type_linked = RoboDK::ITEM_TYPE_ROBOT)

Returns an item linked to a robot, object, tool, program or robot machining project. This is useful to retrieve the relationship between programs, robots, tools and other specific projects.

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.

Parameters
type_linkedtype of linked object to retrieve
Returns
Linked object
Parameters
type_linkedtype of linked object to retrieve
Returns

Definition at line 1149 of file robodk_api.cpp.

◆ Instruction()

void Instruction ( int  ins_id,
QString &  name,
int &  instype,
int &  movetype,
bool &  isjointtarget,
Mat target,
tJoints joints 
)

Returns the program instruction at position id

Parameters
ins_id
name
instype
movetype
isjointtarget
target
joints

Definition at line 1916 of file robodk_api.cpp.

◆ InstructionCount()

int InstructionCount ( )

Returns the number of instructions of a program.

Returns

ADD MORE METHODS

Returns

Definition at line 1897 of file robodk_api.cpp.

◆ InstructionList()

int InstructionList ( tMatrix2D instructions)

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.

Parameters
instructionsthe matrix of instructions
Returns
Returns 0 if success

Definition at line 1969 of file robodk_api.cpp.

◆ InstructionListJoints()

int InstructionListJoints ( QString &  error_msg,
tMatrix2D **  joint_list,
double  mm_step = 10.0,
double  deg_step = 5.0,
const QString &  save_to_file = "",
bool  collision_check = false,
int  result_flag = 0,
double  time_step_s = 0.1 
)

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.

Parameters
error_msgReturns a human readable error message (if any)
joint_listReturns the list of joints as [J1, J2, ..., Jn, ERROR, MM_STEP, DEG_STEP, MOVE_ID] if a file name is not specified

If flags == LISTJOINTS_SPEED: [J1, J2, ..., Jn, ERROR, MM_STEP, DEG_STEP, MOVE_ID, TIME, X_TCP, Y_TCP, Z_TCP, Speed_J1, Speed_J2, ..., Speed_Jn] If flags == LISTJOINTS_ACCEL: [J1, J2, ..., Jn, ERROR, MM_STEP, DEG_STEP, MOVE_ID, TIME, X_TCP, Y_TCP, Z_TCP, Speed_J1, Speed_J2, ..., Speed_Jn, Accel_J1, Accel_J2, ..., Accel_Jn]

Parameters
mm_stepMaximum step in millimeters for linear movements (millimeters)
deg_stepMaximum step for joint movements (degrees)
save_to_fileProvide 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.
collision_checkCheck for collisions
result_flagset to 1 to include the timings between movements, set to 2 to also include the joint speeds (deg/s), set to 3 to also include the accelerations, set to 4 to include all previous information and make the splitting time-based.
time_step_s(optional) set the time step in seconds for time based calculation. This value is only used when the result flag is set to 4 (time based).
Returns
Returns 0 if success, otherwise, it will return negative values
Parameters
error_msgReturns a human readable error message (if any)
joint_listReturns the list of joints as [J1, J2, ..., Jn, ERROR, MM_STEP, DEG_STEP, MOVE_ID] if a file name is not specified
mm_stepMaximum step in millimeters for linear movements (millimeters)
deg_stepMaximum step for joint movements (degrees)
save_to_fileProvide 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.
collision_checkCheck for collisions
result_flagset to 1 to include the timings between movements, set to 2 to also include the joint speeds (deg/s), set to 3 to also include the accelerations, set to 4 to include all previous information and make the splitting time-based.
time_step_s(optional) set the time step in seconds for time based calculation. This value is only used when the result flag is set to 4 (time based).
Returns
Returns 0 if success, otherwise, it will return negative values

Definition at line 2030 of file robodk_api.cpp.

◆ isJointTarget()

bool isJointTarget ( ) const

Returns True if a target is a joint target (green icon). Otherwise, the target is a Cartesian target (red icon).

Definition at line 1075 of file robodk_api.cpp.

◆ JointLimits()

void JointLimits ( tJoints lower_limits,
tJoints upper_limits 
)

Retrieve the joint limits of a robot

Returns the joint limits of a robot

Parameters
lower_limits
upper_limits

Definition at line 1177 of file robodk_api.cpp.

◆ Joints()

tJoints Joints ( ) const

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.

Returns
double x n: joints matrix
Returns
double x n -> joints matrix

Definition at line 1090 of file robodk_api.cpp.

◆ JointsConfig()

void JointsConfig ( const tJoints joints,
tConfig  config 
)

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

Parameters
jointsarray of joints
configconfiguration status as [REAR, LOWERARM, FLIP]
jointsarray of joints
Returns
3-array -> configuration status as [REAR, LOWERARM, FLIP]

Definition at line 1260 of file robodk_api.cpp.

◆ JointsHome()

tJoints JointsHome ( ) const

Returns the home joints of a robot. These joints can be manually set in the robot "Parameters" menu, then select "Set home position"

Returns
joint values for the home position
Returns
double x n -> joints array

Definition at line 1106 of file robodk_api.cpp.

◆ MakeProgram()

bool MakeProgram ( const QString &  filename)

Saves a program to a file.

Parameters
filenameFile path of the program
run_modeRUNMODE_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
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)
Parameters
filenameFile path of the program
Returns
success

Definition at line 1645 of file robodk_api.cpp.

◆ MoveC() [1/3]

void MoveC ( const Item itemtarget1,
const Item itemtarget2,
bool  blocking = true 
)

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

Parameters
itemtarget1Intermediate target to move to as a target item (RoboDK target item)
itemtarget2Final target to move to as a target item (RoboDK target item)
Parameters
itemtarget1target -> intermediate target to move to as a target item (RoboDK target item)
itemtarget2target -> final target to move to as a target item (RoboDK target item)
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1467 of file robodk_api.cpp.

◆ MoveC() [2/3]

void MoveC ( const Mat target1,
const Mat target2,
bool  blocking = true 
)

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

Parameters
target1Intermediate pose target to move to. It must be a 4x4 Homogeneous matrix
target2Final pose target to move to. It must be a 4x4 Homogeneous matrix
Parameters
target1pose -> intermediate pose target to move to. It must be a 4x4 Homogeneous matrix
target2pose -> final pose target to move to. It must be a 4x4 Homogeneous matrix
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1487 of file robodk_api.cpp.

◆ MoveC() [3/3]

void MoveC ( const tJoints joints1,
const tJoints joints2,
bool  blocking = true 
)

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

Parameters
joints1Intermediate joint target to move to.
joints2Final joint target to move to.
Parameters
joints1joints -> intermediate joint target to move to.
joints2joints -> final joint target to move to.
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1477 of file robodk_api.cpp.

◆ MoveJ() [1/3]

void MoveJ ( const Item itemtarget,
bool  blocking = true 
)

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.

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

Parameters
targetTarget to move to as a target item (RoboDK target item)
Parameters
targettarget -> target to move to as a target item (RoboDK target item)
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1394 of file robodk_api.cpp.

◆ MoveJ() [2/3]

void MoveJ ( const Mat target,
bool  blocking = true 
)

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

Parameters
targetPose target to move to. It must be a 4x4 Homogeneous matrix
Parameters
targetpose -> pose target to move to. It must be a 4x4 Homogeneous matrix
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1421 of file robodk_api.cpp.

◆ MoveJ() [3/3]

void MoveJ ( const tJoints joints,
bool  blocking = true 
)

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

Parameters
targetRobot joints to move to
Parameters
targetjoints -> joint target to move to.
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1412 of file robodk_api.cpp.

◆ MoveJ_Test()

int MoveJ_Test ( const tJoints j1,
const tJoints j2,
double  minstep_deg = -1 
)

Checks if a joint movement is possible and, optionally, free of collisions.

Checks if a joint movement is free of collision.

Parameters
j1Start joints
j2Destination joints
minstep_degMaximum joint step in degrees. If this value is not provided it will use the path step defined in Tools-Options-Motion (degrees).
Returns
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.
Parameters
j1joints -> start joints
j2joints -> destination joints
minstep_deg(optional): maximum joint step in degrees
Returns
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.

Definition at line 1498 of file robodk_api.cpp.

◆ MoveL() [1/3]

void MoveL ( const Item itemtarget,
bool  blocking = true 
)

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.

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

Parameters
itemtargetTarget to move to as a target item (RoboDK target item)
Parameters
itemtargettarget -> target to move to as a target item (RoboDK target item)
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1430 of file robodk_api.cpp.

◆ MoveL() [2/3]

void MoveL ( const Mat target,
bool  blocking = true 
)

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

Parameters
targetPose target to move to. It must be a 4x4 Homogeneous matrix
Parameters
targetpose -> pose target to move to. It must be a 4x4 Homogeneous matrix
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1457 of file robodk_api.cpp.

◆ MoveL() [3/3]

void MoveL ( const tJoints joints,
bool  blocking = true 
)

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

Parameters
jointsRobot joints to move to
Parameters
jointsjoints -> joint target to move to.
blockingblocking -> True if we want the instruction to block until the robot finished the movement (default=true)

Definition at line 1448 of file robodk_api.cpp.

◆ MoveL_Test()

int MoveL_Test ( const tJoints j1,
const Mat pose2,
double  minstep_deg = -1 
)

Checks if a linear movement is free of issues and, optionally, collisions.

Checks if a linear movement is free of collision.

Parameters
joints1Start joints
pose2Destination pose (active tool with respect to the active reference frame)
minstep_mmMaximum joint step in mm. If this value is not provided it will use the path step defined in Tools-Options-Motion (mm).
Returns
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.
Parameters
j1joints -> start joints
pose2joints -> destination pose (active tool with respect to the active reference frame)
minstep_mm(optional): maximum joint step in degrees
Returns
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.

Definition at line 1519 of file robodk_api.cpp.

◆ Name()

QString Name ( ) const

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

Returns
name of the item

Definition at line 774 of file robodk_api.cpp.

◆ NewLink()

void NewLink ( )

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

Definition at line 593 of file robodk_api.cpp.

◆ ObjectLink()

Item ObjectLink ( int  link_id = 0)

Returns an item pointer to the geometry of a robot link. This is useful to show/hide certain robot links or alter their geometry.

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

Parameters
link_idlink index(0 for the robot base, 1 for the first link, ...)
Returns
Internal geometry item
Parameters
link_idlink index(0 for the robot base, 1 for the first link, ...)
Returns

Definition at line 1134 of file robodk_api.cpp.

◆ Parent()

Item Parent ( ) const

Return the parent item of this item

Returns
Parent item

Definition at line 711 of file robodk_api.cpp.

◆ Pause()

void Pause ( double  time_ms = -1)

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.

Parameters
time_msTime in milliseconds

Definition at line 1736 of file robodk_api.cpp.

◆ Pose()

Mat Pose ( ) const

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 efector

Returns
4x4 homogeneous matrix (pose)

Definition at line 815 of file robodk_api.cpp.

◆ PoseAbs()

Mat PoseAbs ( )

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

Returns
4x4 homogeneous matrix (pose)

Definition at line 970 of file robodk_api.cpp.

◆ PoseFrame()

Mat 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.

Returns
4x4 homogeneous matrix (pose)

Definition at line 892 of file robodk_api.cpp.

◆ PoseTool()

Mat 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.

Returns
4x4 homogeneous matrix (pose)

Definition at line 879 of file robodk_api.cpp.

◆ RDK()

RoboDK * RDK ( )

Returns the RoboDK link Robolink().

Returns

Definition at line 586 of file robodk_api.cpp.

◆ RunCode()

int RunCode ( const QString &  parameters)

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

Parameters
parametersNumber of instructions that can be executed

Definition at line 1701 of file robodk_api.cpp.

◆ RunInstruction()

int RunInstruction ( const QString &  code,
int  run_type = RoboDK::INSTRUCTION_CALL_PROGRAM 
)

Adds a program call, code, message or comment inside a program.

Parameters
code<string of the code or program to run/param>
Parameters
run_typeINSTRUCTION_* variable to specify if the code is a progra

Definition at line 1721 of file robodk_api.cpp.

◆ RunProgram()

int 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

Returns
True if successful
Returns
number of instructions that can be executed

Definition at line 1682 of file robodk_api.cpp.

◆ Save()

void Save ( const QString &  filename)

Save a station, a robot, a tool or an object to a file

Save a station or object to a file

Parameters
filenamepath and file name
Parameters
filename

Definition at line 617 of file robodk_api.cpp.

◆ Scale() [1/2]

void Scale ( double  scale)

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).

------------------------------— add curve, scale, recolor, ...

Parameters
scalescale to apply as scale or [scale_x, scale_y, scale_z]

Definition at line 1003 of file robodk_api.cpp.

◆ Scale() [2/2]

void Scale ( double  scale_xyz[3])

Apply a per-axis 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).

Parameters
scalescale to apply as [scale_x, scale_y, scale_z]

Definition at line 1016 of file robodk_api.cpp.

◆ setAccuracyActive()

void setAccuracyActive ( int  accurate = 1)

Sets the accuracy of the robot active or inactive. A robot must have been calibrated to properly use this option.

Parameters
accurateset to 1 to use the accurate model or 0 to use the nominal model

Definition at line 1627 of file robodk_api.cpp.

◆ setAO()

void setAO ( const QString &  io_var,
const QString &  io_value 
)

Set an analog Output

Parameters
io_varAnalog Output
io_valueValue as a string

Definition at line 1763 of file robodk_api.cpp.

◆ setAsCartesianTarget()

void setAsCartesianTarget ( )

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

Definition at line 1055 of file robodk_api.cpp.

◆ setAsJointTarget()

void setAsJointTarget ( )

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

Definition at line 1065 of file robodk_api.cpp.

◆ setColor()

void setColor ( double  colorRGBA[4])

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.

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.

Parameters
tocolorcolor to change to
fromcolorfilter by this color
toleranceoptional tolerance to use if a color filter is used (defaults to 0.1)

Definition at line 983 of file robodk_api.cpp.

◆ setDO()

void setDO ( const QString &  io_var,
const QString &  io_value 
)

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

Parameters
io_vario_var -> digital output (string or number)
io_valueio_value -> value (string or number)

Definition at line 1750 of file robodk_api.cpp.

◆ setGeometryPose()

void setGeometryPose ( const Mat  pose)

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

Parameters
pose4x4 homogeneous matrix
apply_movementApply the movement to the inner geometry and not as a pose shift
Parameters
pose4x4 homogeneous matrix

Definition at line 828 of file robodk_api.cpp.

◆ setInstruction()

void setInstruction ( int  ins_id,
const QString &  name,
int  instype,
int  movetype,
bool  isjointtarget,
const Mat target,
const tJoints joints 
)

Sets the program instruction at position id

Parameters
ins_id
name
instype
movetype
isjointtarget
target
joints

Definition at line 1946 of file robodk_api.cpp.

◆ setJointLimits()

void setJointLimits ( const tJoints lower_limits,
const tJoints upper_limits 
)

Set the joint limits of a robot

Parameters
lower_limits
upper_limits

Definition at line 1192 of file robodk_api.cpp.

◆ setJoints()

void setJoints ( const tJoints jnts)

Set robot joints or the joints of a target

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.

Parameters
joints

Definition at line 1164 of file robodk_api.cpp.

◆ setJointsHome()

void setJointsHome ( const tJoints jnts)

Set robot joints for the home position

Sets the joint position of the "home" joints for a robot.

Parameters
joints

Definition at line 1121 of file robodk_api.cpp.

◆ setMachiningParameters()

Item setMachiningParameters ( QString  ncfile = "",
Item  part_obj = nullptr,
QString  options = "" 
)

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.
Tip: Use setPoseTool() and setPoseFrame() to link to the corresponding tool and reference frames.

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.

Item object_curves = RDK->ItemUserPick("Select an object with curves or points to follow", RoboDK::ITEM_TYPE_OBJECT);
if (!object_curves.Valid()){
// operation cancelled
return;
}
// Assuming ROBOT is a robot item
Item project = RDK->AddMachiningProject("Curve1 Settings", ROBOT);
// set the reference link:
project.setPoseFrame(ROBOT->getLink(RoboDK::ITEM_TYPE_FRAME));
// set the tool link:
project.setPoseTool(ROBOT->getLink(RoboDK::ITEM_TYPE_TOOL));
// set preferred start joints position (value automatically set by default)
project.setJoints(ROBOT->JointsHome());
// link the project to the part and provide additional settings
QString additional_options = "RotZ_Range=45 RotZ_Step=5 NormalApproach=50 No_Update";
project.setMachiningParameters("", object_curves, additional_options);
// in this example:
//RotZ_Range=45 RotZ_Step=5
//allow a tool z rotation of +/- 45 deg by steps of 5 deg
// NormalApproach=50
//Use 50 mm as normal approach by default
// No_Update
// Do not attempt to solve the path. It can be later updated by running project.Update()
RoboDK * RDK()
Returns the RoboDK link Robolink().
Definition: robodk_api.cpp:586
void setPoseFrame(const Mat frame_pose)
Sets the reference frame of a robot(user frame). The frame can be either an item or a pose....
Definition: robodk_api.cpp:906
@ ITEM_TYPE_TOOL
Item of type tool (.tool).
Definition: robodk_api.h:1339
@ ITEM_TYPE_FRAME
Item of type reference frame.
Definition: robodk_api.h:1336
@ ITEM_TYPE_OBJECT
Item of type object (.stl, .step or .iges for example).
Definition: robodk_api.h:1342
Item ItemUserPick(const QString &message="Pick one item", int itemtype=-1)
Shows a RoboDK popup to select one object from the open RoboDK station. An item type can be specified...
Item AddMachiningProject(const QString &name="Curve follow settings", Item *itemrobot=nullptr)
Add a new robot machining project. Machining projects can also be used for 3D printing,...
Parameters
ncfilepath to the NC (G-code/APT/Point cloud) file to load (optional)
part_objobject holding curves or points to automatically set up a curve/point follow project (optional)
optionsAdditional options (optional)
Returns
Program (can be null it has not been updated). Use Update() to retrieve the result
Parameters
ncfilepath to the NC (G-code/APT/Point cloud) file to load (optional)
part_objobject holding curves or points to automatically set up a curve/point follow project (optional)
optionsAdditional options (optional)
Returns
Program linked to the project (invalid item if failed to update). Use Update() to retrieve the result

Definition at line 1036 of file robodk_api.cpp.

◆ setName()

void setName ( const QString &  name)

Set the name of a RoboDK item.

Parameters
name

Definition at line 787 of file robodk_api.cpp.

◆ setParam()

QString setParam ( const QString &  param,
const QString &  value 
)

Set a specific item parameter. Select Tools-Run Script-Show Commands to see all available commands for items and the station. Note: For parameters (commands) that require a JSON string value you can also provide a dict.

Parameters
paramitem parameter
valuevalue
Returns

Definition at line 2060 of file robodk_api.cpp.

◆ setParent()

void setParent ( Item  parent)

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

Parameters
parent

Definition at line 647 of file robodk_api.cpp.

◆ setParentStatic()

void setParentStatic ( Item  parent)

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.

Parameters
parentparent item to attach this item to
Parameters
parentparent item to attach this item

Definition at line 660 of file robodk_api.cpp.

◆ setPose()

void setPose ( const Mat  pose)

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 efector.

Parameters
pose4x4 homogeneous matrix

Definition at line 802 of file robodk_api.cpp.

◆ setPoseAbs()

void setPoseAbs ( const Mat  pose)

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

Parameters
pose4x4 homogeneous matrix (pose)

Definition at line 957 of file robodk_api.cpp.

◆ setPoseFrame() [1/2]

void setPoseFrame ( const Item  frame_item)

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.

Parameters
pose4x4 homogeneous matrix (pose)

Definition at line 919 of file robodk_api.cpp.

◆ setPoseFrame() [2/2]

void setPoseFrame ( const Mat  frame_pose)

Sets the reference frame of a robot(user frame). The frame can be either an item or a pose. If "frame" is an item, it links the robot to the frame item. If frame is a pose, it updates the linked pose of the robot frame (with respect to the robot reference frame).

Parameters
frame_pose4x4 homogeneous matrix (pose)

Definition at line 906 of file robodk_api.cpp.

◆ setPoseTool() [1/2]

void setPoseTool ( const Item  tool_item)

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.

Parameters
tool_itemTool item

Definition at line 945 of file robodk_api.cpp.

◆ setPoseTool() [2/2]

void setPoseTool ( const Mat  tool_pose)

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.

Parameters
tool_pose4x4 homogeneous matrix (pose)

Definition at line 932 of file robodk_api.cpp.

◆ setRobot()

void setRobot ( const Item robot)

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.

Parameters
robotRobot item

Definition at line 1207 of file robodk_api.cpp.

◆ setRounding()

void setRounding ( double  zonedata)

Sets the robot movement smoothing accuracy (also known as zone data value).

Parameters
rounding_mmRounding value (double) (robot dependent, set to -1 for accurate/fine movements)
Parameters
zonedatazonedata value (int) (robot dependent, set to -1 for fine movements)

Definition at line 1558 of file robodk_api.cpp.

◆ setRunType()

void setRunType ( int  program_run_type)

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.

Returns
number of instructions that can be executed

Definition at line 1665 of file robodk_api.cpp.

◆ setSpeed()

void setSpeed ( double  speed_linear,
double  speed_joints = -1,
double  accel_linear = -1,
double  accel_joints = -1 
)

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

Parameters
speed_linearlinear speed in mm/s (-1 = no change)
accel_linearlinear acceleration in mm/s2 (-1 = no change)
speed_jointsjoint speed in deg/s (-1 = no change)
accel_jointsjoint acceleration in deg/s2 (-1 = no change)
Parameters
speed_linearlinear speed in mm/s (-1 = no change)
speed_jointsjoint speed in deg/s (-1 = no change)
accel_linearlinear acceleration in mm/s2 (-1 = no change)
accel_jointsjoint acceleration in deg/s2 (-1 = no change)

Definition at line 1541 of file robodk_api.cpp.

◆ setVisible()

void setVisible ( bool  visible,
int  visible_frame = -1 
)

Sets the item visiblity status

Parameters
visible
visible_referenceset the visible reference frame (1) or not visible (0)
Parameters
visible
visible_framesrt the visible reference frame (1) or not visible (0)

Definition at line 757 of file robodk_api.cpp.

◆ ShowInstructions()

void ShowInstructions ( bool  visible = true)

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

Parameters
show

Definition at line 1871 of file robodk_api.cpp.

◆ ShowSequence()

void ShowSequence ( tMatrix2D sequence)

Displays a sequence of joints

Parameters
sequencejoint sequence as a 6xN matrix or instruction sequence as a 7xN matrix

Definition at line 1570 of file robodk_api.cpp.

◆ ShowTargets()

void ShowTargets ( bool  visible = true)

Show or hide targets of a program in the RoboDK tree

Parameters
show

Definition at line 1883 of file robodk_api.cpp.

◆ SolveFK()

Mat SolveFK ( const tJoints joints,
const Mat tool = nullptr,
const Mat ref = nullptr 
)

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

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

Definition at line 1238 of file robodk_api.cpp.

◆ SolveIK() [1/2]

tJoints SolveIK ( const Mat pose,
const Mat tool = nullptr,
const Mat ref = nullptr 
)

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

Parameters
pose4x4 matrix -> pose of the robot flange with respect to the robot base frame
joints_closeAproximate joints solution to choose among the possible solutions. Leave this value empty to return the closest match to the current robot position.
tool_poseOptionally provide a tool pose, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.
reference_poseOptionally provide a reference pose, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.
Returns
array of joints
Parameters
pose4x4 matrix -> pose of the robot flange with respect to the robot base frame
tool4x4 matrix -> Optionally provide a tool, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.
reference4x4 matrix -> Optionally provide a reference, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.
Returns
array of joints

Definition at line 1278 of file robodk_api.cpp.

◆ SolveIK() [2/2]

tJoints SolveIK ( const Mat  pose,
tJoints  joints_approx,
const Mat tool = nullptr,
const Mat ref = nullptr 
)

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

Parameters
pose4x4 matrix -> pose of the robot flange with respect to the robot base frame
joints_approxAproximate solution. Leave empty to return the closest match to the current robot position.
tool4x4 matrix -> Optionally provide a tool, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.
reference4x4 matrix -> Optionally provide a reference, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.
Returns
array of joints

Definition at line 1306 of file robodk_api.cpp.

◆ SolveIK_All()

QList< tJoints > SolveIK_All ( const Mat pose,
const Mat tool = nullptr,
const Mat ref = nullptr 
)

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

Parameters
pose4x4 matrix -> pose of the robot tool with respect to the robot frame
tool_poseOptionally provide a tool pose, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.
reference_poseOptionally provide a reference pose, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.
Returns
double x n x m -> joint list (2D matrix)

Definition at line 1348 of file robodk_api.cpp.

◆ SolveIK_All_Mat2D()

tMatrix2D * SolveIK_All_Mat2D ( const Mat pose,
const Mat tool = nullptr,
const Mat ref = nullptr 
)

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

Parameters
pose4x4 matrix -> pose of the robot tool with respect to the robot frame
tool_poseOptionally provide a tool pose, otherwise, the robot flange is used. Tip: use robot.PoseTool() to retrieve the active robot tool.
reference_poseOptionally provide a reference pose, otherwise, the robot base is used. Tip: use robot.PoseFrame() to retrieve the active robot reference frame.
Returns
double x n x m -> joint list (2D matrix)
Parameters
pose4x4 matrix -> pose of the robot tool with respect to the robot frame
Returns
double x n x m -> joint list (2D matrix)

Definition at line 1331 of file robodk_api.cpp.

◆ Stop()

void Stop ( )

Stops a program or a robot

Returns

Definition at line 1596 of file robodk_api.cpp.

◆ ToString()

QString ToString ( ) const

Definition at line 574 of file robodk_api.cpp.

◆ Type()

int Type ( ) const

Item type (object, robot, tool, reference, robot machining project, ...)

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

GENERIC ITEM CALLS

Returns

Definition at line 602 of file robodk_api.cpp.

◆ Update()

double Update ( int  collision_check = RoboDK::COLLISION_OFF,
int  timeout_sec = 3600,
double *  out_nins_time_dist = nullptr,
double  mm_step = -1,
double  deg_step = -1 
)

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.

Parameters
collision_checkcheck_collisions: Check collisions (COLLISION_ON -yes- or COLLISION_OFF -no-)
timeout_secMaximum time to wait for the update to complete (in seconds)
out_nins_time_distoptional double array [3] = [valid_instructions, program_time, program_distance]
mm_stepMaximum step in millimeters for linear movements (millimeters). Set to -1 to use the default, as specified in Tools-Options-Motion.
deg_stepMaximum step for joint movements (degrees). Set to -1 to use the default, as specified in Tools-Options-Motion.
Returns
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)

Definition at line 1991 of file robodk_api.cpp.

◆ Valid()

bool Valid ( bool  check_deleted = false) const

Check if an item is valid (not null and available in the open station)

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

Parameters
item_checkItem to check
Returns

True if the item exists, false otherwise

true if valid, false if invalid

Definition at line 637 of file robodk_api.cpp.

◆ Visible()

bool Visible ( ) const

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

Returns
true if visible, false if not visible

Definition at line 744 of file robodk_api.cpp.

◆ waitDI()

void waitDI ( const QString &  io_var,
const QString &  io_value,
double  timeout_ms = -1 
)

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

Parameters
io_vario_var -> digital output (string or number)
io_valueio_value -> value (string or number)
timeout_msint (optional) -> timeout in miliseconds

Definition at line 1806 of file robodk_api.cpp.

◆ WaitMove()

void WaitMove ( double  timeout_sec = 300) const

Waits (blocks) until the robot finishes its movement.

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

Definition at line 1607 of file robodk_api.cpp.

Friends And Related Function Documentation

◆ RoboDK_API::RoboDK

friend class RoboDK_API::RoboDK
friend

Definition at line 1750 of file robodk_api.h.

Member Data Documentation

◆ _PTR

quint64 _PTR
private

Pointer to the item inside RoboDK.

Definition at line 2485 of file robodk_api.h.

◆ _RDK

RoboDK* _RDK
private

Pointer to RoboDK link object.

Definition at line 2482 of file robodk_api.h.

◆ _TYPE

qint32 _TYPE
private

Item type.

Definition at line 2488 of file robodk_api.h.


The documentation for this class was generated from the following files: