Interface IRoboDK
Namespace: RoboDk.API
Assembly: RoboDkApi.dll
Syntax
public interface IRoboDK
Properties
| Improve this Doc View SourceApplicationDir
Declaration
string ApplicationDir { get; }
Property Value
Type | Description |
---|---|
string |
DefaultSocketTimeoutMilliseconds
Default Socket Timeout in Milliseconds.
Declaration
int DefaultSocketTimeoutMilliseconds { get; set; }
Property Value
Type | Description |
---|---|
int |
ItemInterceptFunction
Allows to install a function which can intercept all interface methods. Used for Aspect oriented programming (e.g. Add loging to an Interface). Example: rdk.InterceptorFunction = ItemInterceptorFunction; private IItem ItemInterceptorFunction(IItem item) { var behaviour = new LoggingAspect(_logger); var itemProxy = Unitity.Interception.Intercept.ThroughProxy(item, new InterfaceInterceptor(), new[] {behaviour}); return itemProxy; }
Declaration
Func<IItem, IItem> ItemInterceptFunction { get; set; }
Property Value
Type | Description |
---|---|
Func<IItem, IItem> |
LastStatusMessage
Declaration
string LastStatusMessage { get; }
Property Value
Type | Description |
---|---|
string |
Name
Name of the RoboDK instance. In case of multiple instances the name can help to identify the instance.
Declaration
string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Process
Declaration
Process Process { get; }
Property Value
Type | Description |
---|---|
Process |
RoboDKClientPort
TCP Client Port
Declaration
int RoboDKClientPort { get; }
Property Value
Type | Description |
---|---|
int |
RoboDKServerPort
TCP Server Port to which this instance is connected to.
Declaration
int RoboDKServerPort { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Improve this Doc View SourceAddCurve(Mat, IItem, 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, IItem referenceObject = null, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
Type | Name | Description |
---|---|---|
Mat | curvePoints | matrix 3xN or 6xN -> N must be multiple of 3 |
IItem | referenceObject | object to add the curve and/or project the curve to the surface |
bool | addToRef | If True, the curve will be added as part of the object in the RoboDK item tree (a reference object must be provided) |
ProjectionType | projectionType | 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 |
---|---|
IItem | added object/curve (use item.Valid() to check if item is valid.) |
AddFile(string, IItem)
Load a file and attaches it to parent and returns the newly added IItem.
Declaration
IItem AddFile(string filename, IItem parent = null)
Parameters
Type | Name | Description |
---|---|---|
string | filename | Any file to load, supported by RoboDK. Supported formats include STL, STEP, IGES, ROBOT, TOOL, RDK,... It is also possible to load supported robot programs, such as SRC (KUKA), SCRIPT (Universal Robots), LS (Fanuc), JBI (Motoman), MOD (ABB), PRG (ABB), ... |
IItem | parent | item to attach the newly added object (optional) |
Returns
Type | Description |
---|---|
IItem |
AddFrame(string, IItem)
Adds a new Frame that can be referenced by a robot.
Declaration
IItem AddFrame(string name, IItem parent = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | name of the reference frame |
IItem | parent | parent to attach to (such as the robot base frame) |
Returns
Type | Description |
---|---|
IItem | The new reference frame created |
AddMachiningProject(string, IItem)
Add a new robot machining project. Machining projects can also be used for 3D printing, following curves and following points.
It returns the newly created :class:.IItem
containing the project settings.
Tip: Use the macro /RoboDK/Library/Macros/MoveRobotThroughLine.py to see an example that creates a new "curve follow project" given a list of points to follow(Option 4).
Declaration
IItem AddMachiningProject(string name = "Curve follow settings", IItem itemrobot = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the project settings |
IItem | itemrobot | Robot to use for the project settings(optional). It is not required to specify the robot if only one robot or mechanism is available in the RoboDK station. |
Returns
Type | Description |
---|---|
IItem |
AddPoints(Mat, IItem, bool, ProjectionType)
Adds a list of points to an object. The provided points must be a list of vertices. A vertex normal can be provided optionally.
Declaration
IItem AddPoints(Mat points, IItem referenceObject = null, bool addToRef = false, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
Type | Name | Description |
---|---|---|
Mat | points | list of points as a matrix (3xN matrix, or 6xN to provide point normals as ijk vectors) |
IItem | referenceObject | item to attach the newly added geometry (optional) |
bool | addToRef | If True, the points will be added as part of the object in the RoboDK item tree (a reference object must be provided) |
ProjectionType | projectionType | Type of projection.Use the PROJECTION_* flags. |
Returns
Type | Description |
---|---|
IItem | added object/shape (0 if failed) |
AddProgram(string, IItem)
Add a new program to the RoboDK station. Programs can be used to simulate a specific sequence, to generate vendor specific programs (Offline Programming) or to run programs on the robot (Online Programming).
Declaration
IItem AddProgram(string name, IItem robot = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the program |
IItem | robot | Robot that will be used for this program. It is not required to specify the robot if the station has only one robot or mechanism. |
Returns
Type | Description |
---|---|
IItem | Newly created Program IItem |
AddShape(Mat, IItem, bool, Color?)
Adds a shape provided triangle coordinates. Triangles must be provided as a list of vertices. A vertex normal can be provided optionally.
Declaration
IItem AddShape(Mat trianglePoints, IItem addTo = null, bool shapeOverride = false, Color? color = null)
Parameters
Type | Name | Description |
---|---|---|
Mat | trianglePoints | List of vertices grouped by triangles (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3) |
IItem | addTo | item to attach the newly added geometry (optional). Leave empty to create a new object. |
bool | shapeOverride | Set to true to replace any other existing geometry |
Color? | color | Color of the added shape |
Returns
Type | Description |
---|---|
IItem | added object/shape (use item.Valid() to check if item is valid.) |
AddShape(List<Mat>, IItem, bool, List<Color>)
Adds a shape provided triangle coordinates. Triangles must be provided as a list of vertices. A vertex normal can be provided optionally.
Declaration
IItem AddShape(List<Mat> listTrianglePoints, IItem addTo = null, bool shapeOverride = false, List<Color> listColor = null)
Parameters
Type | Name | Description |
---|---|---|
List<Mat> | listTrianglePoints | List of Mat objects. Each mat object is a list of vertices grouped by triangles of the same color (3xN or 6xN matrix, N must be multiple of 3 because vertices must be stacked by groups of 3) |
IItem | addTo | item to attach the newly added geometry (optional). Leave empty to create a new object. |
bool | shapeOverride | Set to true to replace any other existing geometry |
List<Color> | listColor | Optionally specify the color as RGBA [0-1] (list of same length as triangle_points_list) |
Returns
Type | Description |
---|---|
IItem |
AddStation(string)
Add a new empty station.
Declaration
IItem AddStation(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the station |
Returns
Type | Description |
---|---|
IItem | Newly created station IItem |
AddTarget(string, IItem, IItem)
Add a new target that can be reached with a robot.
Declaration
IItem AddTarget(string name, IItem parent = null, IItem robot = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Target name |
IItem | parent | Reference frame to attach the target |
IItem | robot | Robot that will be used to go to target (optional) |
Returns
Type | Description |
---|---|
IItem | Newly created target item. |
AddTargetJ(IItem, string, double[], IItem, IItem)
Add a joint movement to a program
Declaration
IItem AddTargetJ(IItem pgm, string targetName, double[] joints, IItem robotBase = null, IItem robot = null)
Parameters
Type | Name | Description |
---|---|---|
IItem | pgm | |
string | targetName | |
double[] | joints | |
IItem | robotBase | |
IItem | robot |
Returns
Type | Description |
---|---|
IItem |
AddText(string, IItem)
Add Text to 3D View
Declaration
IItem AddText(string text, IItem parent = null)
Parameters
Type | Name | Description |
---|---|---|
string | text | Text to add to the scene |
IItem | parent | item to attach the newly added text object (optional) |
Returns
Type | Description |
---|---|
IItem |
BuildMechanism(int, List<IItem>, List<double>, List<double>, List<double>, List<double>, List<double>, List<double>, Mat, Mat, string, IItem)
Create a new robot or mechanism.
Declaration
IItem BuildMechanism(int type, List<IItem> listObj, List<double> param, List<double> jointsBuild, List<double> jointsHome, List<double> jointsSenses, List<double> jointsLimLow, List<double> jointsLimHigh, Mat baseFrame = null, Mat tool = null, string name = "New robot", IItem robot = null)
Parameters
Type | Name | Description |
---|---|---|
int | type | Type of the mechanism |
List<IItem> | listObj | |
List<double> | param | robot parameters in the same order as shown in the RoboDK menu: Utilities-Build Mechanism or robot |
List<double> | jointsBuild | |
List<double> | jointsHome | |
List<double> | jointsSenses | |
List<double> | jointsLimLow | |
List<double> | jointsLimHigh | |
Mat | baseFrame | |
Mat | tool | tool pose |
string | name | robot name (you can also use setName() |
IItem | robot | existing robot in the station to replace it (optional) |
Returns
Type | Description |
---|---|
IItem |
CalibrateReference(Mat, ReferenceCalibrationType, bool, IItem)
Calibrate a Reference Frame given a list of points or joint values. Important: If the robot is calibrated, provide joint values to maximize accuracy.
Declaration
Mat CalibrateReference(Mat joints, ReferenceCalibrationType method = ReferenceCalibrationType.Frame3P_P1OnX, bool useJoints = false, IItem robot = null)
Parameters
Type | Name | Description |
---|---|---|
Mat | joints | points as a 3xN matrix or nDOFsxN) - List of points or a list of robot joints |
ReferenceCalibrationType | method | type of algorithm(by point, plane, ...) |
bool | useJoints | use points or joint values. The robot item must be provided if joint values is used. |
IItem | robot |
Returns
Type | Description |
---|---|
Mat | TODO: Document return value. |
CalibrateTool(Mat, out double[], EulerType, TcpCalibrationType, IItem)
Calibrate a tool (TCP) given a number of points or calibration joints. Important: If the robot is calibrated, provide joint values to maximize accuracy.
Declaration
double[] CalibrateTool(Mat posesJoints, out double[] errorStats, EulerType format = EulerType.EulerRxRyRz, TcpCalibrationType algorithm = TcpCalibrationType.CalibrateTcpByPoint, IItem robot = null)
Parameters
Type | Name | Description |
---|---|---|
Mat | posesJoints | matrix of poses in a given format or a list of joints |
double[] | errorStats | stats[mean, standard deviation, max] - Output error stats summary |
EulerType | format | Euler format. Optionally, use EulerType.JointFormat and provide the robot. |
TcpCalibrationType | algorithm | type of algorithm (by point, plane, ...) |
IItem | robot | Robot used for calibration (if using joint values) |
Returns
Type | Description |
---|---|
double[] | TCP as [x, y, z] - calculated TCP |
Cam2DAdd(IItem, string)
Open a simulated 2D camera view. Returns a handle pointer that can be used in case more than one simulated view is used.
Declaration
long Cam2DAdd(IItem item, string cameraParameters = "")
Parameters
Type | Name | Description |
---|---|---|
IItem | item | Reference frame or other object to attach the camera |
string | cameraParameters | Camera parameters as a string. Refer to the documentation for more information. |
Returns
Type | Description |
---|---|
long | Camera pointer/handle. Keep the handle if more than 1 simulated camera is used |
Cam2DClose(long)
Closes all camera windows or one specific camera if the camera handle is provided.
Declaration
bool Cam2DClose(long camHandle = 0)
Parameters
Type | Name | Description |
---|---|---|
long | camHandle | Camera handle(pointer returned by Cam2DAdd). Leave to 0 to close all simulated views. |
Returns
Type | Description |
---|---|
bool | Returns true if success, false otherwise. |
Cam2DSetParameters(string, long)
Set the parameters of the simulated camera.
Declaration
bool Cam2DSetParameters(string cameraParameters, long camHandle = 0)
Parameters
Type | Name | Description |
---|---|---|
string | cameraParameters | parameter settings according to the parameters supported by Cam2D_Add |
long | camHandle | camera handle (optional) |
Returns
Type | Description |
---|---|
bool | Returns true if success, false otherwise. |
Cam2DSnapshot(string, long)
Take a snapshot from a simulated camera view and save it to a file.
Declaration
bool Cam2DSnapshot(string fileSaveImg, long camHandle = 0)
Parameters
Type | Name | Description |
---|---|---|
string | fileSaveImg | file path to save.Formats supported include PNG, JPEG, TIFF, ... |
long | camHandle | Camera handle(pointer returned by Cam2DAdd) |
Returns
Type | Description |
---|---|
bool | Return true if image has been saved successfully. |
CloneRoboDkConnection(ConnectionType)
Open a new additional RoboDK Link to the same already existing RoboDK instance. NOTE: Use IItem.Clone() to use an already existing item on the new RoboDk connection.
Declaration
IRoboDK CloneRoboDkConnection(RoboDK.ConnectionType connectionType = ConnectionType.Api)
Parameters
Type | Name | Description |
---|---|---|
RoboDK.ConnectionType | connectionType |
Returns
Type | Description |
---|---|
IRoboDK | New RoboDK Link |
CloseRoboDK()
Close RoboDK window and finish RoboDK process.
Declaration
void CloseRoboDK()
CloseStation()
Closes the current station without suggesting to save
Declaration
void CloseStation()
Collision(IItem, IItem, bool)
Check if item1 and item2 collided.
Declaration
bool Collision(IItem item1, IItem item2, bool useCollisionMap = true)
Parameters
Type | Name | Description |
---|---|---|
IItem | item1 | |
IItem | item2 | |
bool | useCollisionMap | Turn off collision map check to force collision checking even if it is not set in the collision map |
Returns
Type | Description |
---|---|
bool | Returns true if item1 collides with item2; false otherwise. |
CollisionLine(double[], double[])
Checks the collision between a line and any objects in the station. The line is composed by 2 points.
Declaration
bool CollisionLine(double[] p1, double[] p2)
Parameters
Type | Name | Description |
---|---|---|
double[] | p1 | Start point [x,y,z] of the line |
double[] | p2 | End point [x,y,z] of the line |
Returns
Type | Description |
---|---|
bool | Return true if there is a collision; false otherwise |
Collisions()
Returns the number of pairs of objects that are currently in a collision state.
Declaration
int Collisions()
Returns
Type | Description |
---|---|
int | Number of pairs of objects in a collision state. |
Command(string, bool)
Send a special command. These commands are meant to have a specific effect in RoboDK, such as changing a specific setting or provoke specific events.
Declaration
string Command(string cmd, bool value)
Parameters
Type | Name | Description |
---|---|---|
string | cmd | Command Name, such as Trace, Threads or Window. |
bool | value | Command value |
Returns
Type | Description |
---|---|
string |
Command(string, double)
Send a special command. These commands are meant to have a specific effect in RoboDK, such as changing a specific setting or provoke specific events.
Declaration
string Command(string cmd, double value)
Parameters
Type | Name | Description |
---|---|---|
string | cmd | Command Name, such as Trace, Threads or Window. |
double | value | Command value |
Returns
Type | Description |
---|---|
string |
Command(string, int)
Send a special command. These commands are meant to have a specific effect in RoboDK, such as changing a specific setting or provoke specific events.
Declaration
string Command(string cmd, int value)
Parameters
Type | Name | Description |
---|---|---|
string | cmd | Command Name, such as Trace, Threads or Window. |
int | value | Command value |
Returns
Type | Description |
---|---|
string |
Command(string, string)
Send a special command. These commands are meant to have a specific effect in RoboDK, such as changing a specific setting or provoke specific events.
Declaration
string Command(string cmd, string value = "")
Parameters
Type | Name | Description |
---|---|---|
string | cmd | Command Name, such as Trace, Threads or Window. |
string | value | Comand value (optional, not all commands require a value) |
Returns
Type | Description |
---|---|
string |
Connect()
Establish a connection with RoboDK. If RoboDK is not running it will attempt to start RoboDK from the default installation path. (otherwise APPLICATION_DIR must be set properly).
Declaration
bool Connect()
Returns
Type | Description |
---|---|
bool | If the connection succeeds it returns True, otherwise it returns False. |
Connected()
Checks if the RoboDK Link is connected.
Declaration
bool Connected()
Returns
Type | Description |
---|---|
bool | True if connected; False otherwise |
Copy(IItem, bool)
Makes a copy of an item (same as Ctrl+C), which can be pasted (Ctrl+V) using Paste().
Declaration
void Copy(IItem tocopy, bool copy_children = true)
Parameters
Type | Name | Description |
---|---|---|
IItem | tocopy | Item to copy |
bool | copy_children | Set to false to prevent copying all items attached to this item |
Delete(List<IItem>)
Delete a list of items
Declaration
void Delete(List<IItem> item_list)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | item_list |
DisableCollisionCheckingForAllItems()
Set all pairs as NOT checking for collisions:
Declaration
void DisableCollisionCheckingForAllItems()
Disconnect()
Stops the communication with RoboDK. If setRunMode is set to MakeRobotProgram for offline programming, any programs pending will be generated.
Declaration
void Disconnect()
EnableCollisionCheckingForAllItems()
Set all pairs as checking for collisions:
Declaration
void EnableCollisionCheckingForAllItems()
FitAll()
Fit all
Declaration
void FitAll()
GetActiveStation()
Returns the active station item (station currently visible)
Declaration
IItem GetActiveStation()
Returns
Type | Description |
---|---|
IItem |
GetCollisionItems()
Return the list of items that are in a collision state. This call will run a check for collisions if collision checking is not activated (if SetCollisionActive is set to Off).
Declaration
List<CollisionItem> GetCollisionItems()
Returns
Type | Description |
---|---|
List<CollisionItem> | List of items that are in a collision state |
GetCollisionPairs()
Returns the list of pairs of items that are in a collision state. This call will run a check for collisions if collision checking is not activated (if SetCollisionActive is set to Off).
Declaration
List<CollisionPair> GetCollisionPairs()
Returns
Type | Description |
---|---|
List<CollisionPair> |
GetCursorXYZ(int, int, List<double>)
Returns the position of the cursor as XYZ coordinates (by default), or the 3D position of a given set of 2D coordinates of the window (x and y coordinates in pixels from the top left corner) The XYZ coordinates returned are given with respect to the RoboDK station(absolute reference). If no coordinates are provided, the current position of the cursor is retrieved.
Declaration
IItem GetCursorXYZ(int xCoord = -1, int yCoord = -1, List<double> xyzStation = null)
Parameters
Type | Name | Description |
---|---|---|
int | xCoord | X coordinate in pixels |
int | yCoord | Y coordinate in pixels |
List<double> | xyzStation | XYZ coordinates in mm (absolute coordinates) |
Returns
Type | Description |
---|---|
IItem | Item under the mouse cursor. |
GetItemByName(string, ItemType)
Returns an item by its name. If there is no exact match it will return the last closest match. Specify what type of item you are looking for with itemtype. This is useful if 2 items have the same name but different type.
Declaration
IItem GetItemByName(string name, ItemType itemType = ItemType.Any)
Parameters
Type | Name | Description |
---|---|---|
string | name | name of the item (name of the item shown in the RoboDK station tree) |
ItemType | itemType | type of the item to be retrieved (avoids confusion if there are similar name matches). |
Returns
Type | Description |
---|---|
IItem | Returns an item by its name. |
GetItemList(ItemType)
Returns a list of items of all available items in the currently open station in robodk. Optionally, use a filter to return items of a specific type
Declaration
List<IItem> GetItemList(ItemType itemType = ItemType.Any)
Parameters
Type | Name | Description |
---|---|---|
ItemType | itemType | Only return items of this type |
Returns
Type | Description |
---|---|
List<IItem> | List of Items (optionally filtered by ItemType). |
GetItemListNames(ItemType)
Returns a list of items (list of names) of all available items in the currently open station in robodk. Optionally, use a filter to return specific items (example: GetItemListNames(itemType = ItemType.Robot))
Declaration
List<string> GetItemListNames(ItemType itemType = ItemType.Any)
Parameters
Type | Name | Description |
---|---|---|
ItemType | itemType | Only return items of this type. |
Returns
Type | Description |
---|---|
List<string> | List of item Names |
GetLicense()
Returns the license string (as shown in the RoboDK main window)
Declaration
string GetLicense()
Returns
Type | Description |
---|---|
string | license string. |
GetOpenStation()
Returns the list of open stations in RoboDK
Declaration
List<IItem> GetOpenStation()
Returns
Type | Description |
---|---|
List<IItem> |
GetParameter(string)
Gets a global or a user parameter from the open RoboDK station. The parameters can also be modified by right clicking the station and selecting "shared parameters" Some available parameters: PATH_OPENSTATION = folder path of the current .stn file FILE_OPENSTATION = file path of the current .stn file PATH_DESKTOP = folder path of the user's folder Other parameters can be added or modified by the user
Declaration
string GetParameter(string parameter)
Parameters
Type | Name | Description |
---|---|---|
string | parameter | RoboDK parameter |
Returns
Type | Description |
---|---|
string | parameter value. Null if parameter does not exist. |
GetParameterList()
Gets all the user parameters from the open RoboDK station. The parameters can also be modified by right clicking the station and selecting "shared parameters" User parameters can be added or modified by the user
Declaration
List<KeyValuePair<string, string>> GetParameterList()
Returns
Type | Description |
---|---|
List<KeyValuePair<string, string>> | list of param-value pair |
GetRunMode()
Returns the behavior of the RoboDK API. By default, robodk shows the path simulation for movement instructions (RunMode.Simulate)
Declaration
RunMode GetRunMode()
Returns
Type | Description |
---|---|
RunMode | Returns the currently active RunMode. |
GetSelectedItems()
Returns the list of items selected (it can be one or more items)
Declaration
List<IItem> GetSelectedItems()
Returns
Type | Description |
---|---|
List<IItem> | Returns the list of selected items. |
GetSimulationSpeed()
Gets the current simulation speed. A speed if 1 means real-time simulation.
Declaration
double GetSimulationSpeed()
Returns
Type | Description |
---|---|
double | Simulation Speed. 1.0=real-time simulation. |
GetViewPose(ViewPoseType)
Get the pose of the wold reference frame with respect to the view (camera/screen)
Declaration
Mat GetViewPose(ViewPoseType preset = ViewPoseType.ActiveView)
Parameters
Type | Name | Description |
---|---|---|
ViewPoseType | preset | Optionally specify a ViewPoseType to retrieve the pose for a specific view |
Returns
Type | Description |
---|---|
Mat | Returns the current view pose. |
GetWindowHandle()
Get RoboDK's main window handle
Declaration
IntPtr GetWindowHandle()
Returns
Type | Description |
---|---|
IntPtr |
HideRoboDK()
Hides the RoboDK window.
Declaration
void HideRoboDK()
IsInside(IItem, IItem)
Check if objectInside is inside the objectParent.
Declaration
bool IsInside(IItem objectInside, IItem objectParent)
Parameters
Type | Name | Description |
---|---|---|
IItem | objectInside | |
IItem | objectParent |
Returns
Type | Description |
---|---|
bool | Returns true if objectInside is inside the objectParent |
ItemUserPick(string, ItemType)
Shows a RoboDK popup to select one object from the open station. An item type can be specified to filter desired items. If no type is specified, all items are selectable. The method always returns an IItem. Use item.Valid() to check if the selected item is a valid item. E.g. if the user exits the dialog without selecting an item, the method still returns an item object, but item.Valid() will return False.
Declaration
IItem ItemUserPick(string message = "Pick one item", ItemType itemType = ItemType.Any)
Parameters
Type | Name | Description |
---|---|---|
string | message | Message to pop up |
ItemType | itemType | optionally filter by ItemType |
Returns
Type | Description |
---|---|
IItem | User selected item. Use item.Valid() to check if the item is valid |
Joints(List<IItem>)
Get Joint positions of all robots defined in the robotItemList.
Declaration
List<double[]> Joints(List<IItem> robotItemList)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | robotItemList | list of robot items |
Returns
Type | Description |
---|---|
List<double[]> | list of robot joints (double x nDOF) |
JointsConfig(List<IItem>, List<double[]>)
Returns the robot configuration state for a set of robot joints.
Declaration
List<double[]> JointsConfig(List<IItem> robotList, List<double[]> jointsList)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | robotList | list of items |
List<double[]> | jointsList | array of joints |
Returns
Type | Description |
---|---|
List<double[]> | 3-array -> configuration status as [REAR, LOWERARM, FLIP] |
LaserTrackerMeasure(double[], bool)
Takes a laser tracker measurement with respect to its own reference frame. If an estimate point is provided, the laser tracker will first move to those coordinates.
Declaration
double[] LaserTrackerMeasure(double[] estimate, bool search = false)
Parameters
Type | Name | Description |
---|---|---|
double[] | estimate | estimate point [x,y,z] |
bool | search | If search is True, the tracker will search for a target. |
Returns
Type | Description |
---|---|
double[] | Returns the XYZ coordinates of the target (in mm). If the target was not found it retuns a null pointer. |
MergeItems(List<IItem>)
Merge multiple object items as one. Source objects are not deleted and a new object is created.
Declaration
IItem MergeItems(List<IItem> item_list)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | item_list |
Returns
Type | Description |
---|---|
IItem | New item |
OpenRoboDkEventChannel()
Start the event communication channel. Use WaitForEvent to wait for a new event.
Declaration
IRoboDKEventSource OpenRoboDkEventChannel()
Returns
Type | Description |
---|---|
IRoboDKEventSource | new event channel instance |
Paste(IItem, int)
Paste the copied item as a dependency of another item (same as Ctrl+V). Paste should be used after Copy(). It returns the newly created item.
Declaration
List<IItem> Paste(IItem paste_to, int paste_times)
Parameters
Type | Name | Description |
---|---|---|
IItem | paste_to | Item to attach the copied item |
int | paste_times | Number of times to replicate the copied object |
Returns
Type | Description |
---|---|
List<IItem> | New item created |
Paste(IItem)
Paste the copied item as a dependency of another item (same as Ctrl+V). Paste should be used after Copy(). It returns the newly created item.
Declaration
IItem Paste(IItem paste_to = null)
Parameters
Type | Name | Description |
---|---|---|
IItem | paste_to | Item to attach the copied item (optional) |
Returns
Type | Description |
---|---|
IItem | New item created |
Popup_ISO9283_CubeProgram(IItem)
Show the popup menu to create the ISO9283 path for path accuracy and performance testing
Declaration
IItem Popup_ISO9283_CubeProgram(IItem robot = null)
Parameters
Type | Name | Description |
---|---|---|
IItem | robot |
Returns
Type | Description |
---|---|
IItem | IS9283 Program |
ProgramStart(string, string, string, IItem)
Defines the name of the program when the program is generated. It is also possible to specify the name of the post processor as well as the folder to save the program. This method must be called before any program output is generated (before any robot movement or other instruction).
Declaration
int ProgramStart(string progname, string defaultfolder = "", string postprocessor = "", IItem robot = null)
Parameters
Type | Name | Description |
---|---|---|
string | progname | name of the program |
string | defaultfolder | folder to save the program, leave empty to use the default program folder |
string | postprocessor | name of the post processor (for a post processor in C:/RoboDK/Posts/Fanuc_post.py it is possible to provide "Fanuc_post.py" or simply "Fanuc_post") |
IItem | robot | Robot to link |
Returns
Type | Description |
---|---|
int | TODO: Document return value. |
ProjectPoints(Mat, IItem, ProjectionType)
Projects a point 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, IItem objectProject, ProjectionType projectionType = ProjectionType.AlongNormalRecalc)
Parameters
Type | Name | Description |
---|---|---|
Mat | points | matrix 3xN or 6xN -> list of points to project |
IItem | objectProject | object to project |
ProjectionType | projectionType | 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 | It returns the projected points as a list of points (empty matrix if failed). |
Render(bool)
Display/render the scene: update the display. This function turns default rendering (rendering after any modification of the station unless alwaysRender is set to true). Use Update to update the internal links of the complete station without rendering (when a robot or item has been moved).
Declaration
void Render(bool alwaysRender = false)
Parameters
Type | Name | Description |
---|---|---|
bool | alwaysRender | Set to True to update the screen every time the station is modified (default behavior when Render() is not used). |
RunCode(string, bool)
Adds code to run in the program output. If the program exists it will also run the program in simulate mode.
Declaration
int RunCode(string code, bool codeIsFunctionCall = false)
Parameters
Type | Name | Description |
---|---|---|
string | code | program name or code to generate |
bool | codeIsFunctionCall | Set to True if the provided code corresponds to a function call (same as RunProgram()), if so, RoboDK will handle the syntax when the code is generated for a specific robot. |
Returns
Type | Description |
---|---|
int | TODO: Document possible return values. |
RunMessage(string, bool)
Shows a message or a comment in the output robot program.
Declaration
void RunMessage(string message, bool messageIsComment = false)
Parameters
Type | Name | Description |
---|---|---|
string | message | message or comment to display. |
bool | messageIsComment | Set to True to generate a comment in the generated code instead of displaying a message on the teach pendant of the robot. |
RunProgram(string)
Adds a function call in the program output. RoboDK will handle the syntax when the code is generated for a specific robot. If the program exists it will also run the program in simulate mode.
Declaration
int RunProgram(string function)
Parameters
Type | Name | Description |
---|---|---|
string | function | Function name with parameters (if any) |
Returns
Type | Description |
---|---|
int | TODO: Document possible return values. |
Save(string, IItem)
Save an item to a file. If no item is provided, the open station is saved.
Declaration
void Save(string filename, IItem itemsave = null)
Parameters
Type | Name | Description |
---|---|---|
string | filename | absolute path to save the file |
IItem | itemsave | object or station to save. Leave empty to automatically save the current station. |
SetActiveStation(IItem)
Set the active station (project currently visible)
Declaration
void SetActiveStation(IItem station)
Parameters
Type | Name | Description |
---|---|---|
IItem | station | station item, it can be previously loaded as an RDK file |
SetCollisionActive(CollisionCheckOptions)
Set collision checking ON or OFF (CollisionCheckOff/CollisionCheckOn) according to the collision map. If collision check is activated it returns the number of pairs of objects that are currently in a collision state.
Declaration
int SetCollisionActive(CollisionCheckOptions collisionCheck = CollisionCheckOptions.CollisionCheckOn)
Parameters
Type | Name | Description |
---|---|---|
CollisionCheckOptions | collisionCheck | collision checking ON or OFF |
Returns
Type | Description |
---|---|
int | Number of pairs of objects in a collision state |
SetCollisionActivePair(CollisionCheckOptions, CollisionPair)
Set collision checking ON or OFF (COLLISION_ON/COLLISION_OFF) for a specific pair of objects. This allows altering the collision map for Collision checking. Specify the link id for robots or moving mechanisms (id 0 is the base).
Declaration
bool SetCollisionActivePair(CollisionCheckOptions collisionCheck, CollisionPair collisionPair)
Parameters
Type | Name | Description |
---|---|---|
CollisionCheckOptions | collisionCheck | Set to COLLISION_ON or COLLISION_OFF |
CollisionPair | collisionPair | Collision pair (item1, id1, item2, id2) to set |
Returns
Type | Description |
---|---|
bool | Returns true if succeeded. Returns false if setting the pair failed (wrong id was provided) |
SetCollisionActivePair(List<CollisionCheckOptions>, IReadOnlyList<CollisionPair>)
Set collision checking ON or OFF (COLLISION_ON/COLLISION_OFF) for a specific list of pairs of objects. This allows altering the collision map for Collision checking. Specify the link id for robots or moving mechanisms (id 0 is the base).
Declaration
bool SetCollisionActivePair(List<CollisionCheckOptions> checkState, IReadOnlyList<CollisionPair> collisionPairs)
Parameters
Type | Name | Description |
---|---|---|
List<CollisionCheckOptions> | checkState | Set to COLLISION_ON or COLLISION_OFF |
IReadOnlyList<CollisionPair> | collisionPairs | List of collision pairs to set |
Returns
Type | Description |
---|---|
bool | Returns true if succeeded. Returns false if setting the pair failed (wrong id was provided) |
SetColor(List<IItem>, List<double[]>)
Sets the color for a list of items given a 4D, 3D or 1D array of doubles
Declaration
void SetColor(List<IItem> item_list, List<double[]> color_list)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | item_list | list of items |
List<double[]> | color_list | list of colors as an array of doubles. Valid colors and alpha channel must be within the range [0-1]. Each array of doubles can be provided as a 4D, 3D or 1D array. Options: [r,g,b,a], [r,g,b], [a]. If you provide [-1,-1,-1,a] only the alpha channel is modified. |
SetColor(List<IItem>, List<Color>)
Sets the color for a list of items given the a color object
Declaration
void SetColor(List<IItem> item_list, List<Color> color_list)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | item_list | list of items |
List<Color> | color_list | list of colors |
SetInteractiveMode(InteractiveType, DisplayRefType, List<IItem>, List<DisplayRefType>)
Set the interactive mode to define the behavior when navigating and selecting items in RoboDK's 3D view.
Declaration
void SetInteractiveMode(InteractiveType modeType = InteractiveType.MoveReferences, DisplayRefType defaultRefFlags = (DisplayRefType)-1, List<IItem> customItems = null, List<DisplayRefType> customRefFlags = null)
Parameters
Type | Name | Description |
---|---|---|
InteractiveType | modeType | The mode type defines what accion occurs when the 3D view is selected (Select object, Pan, Rotate, Zoom, Move Objects, ...) |
DisplayRefType | defaultRefFlags | When a movement is specified, we can provide what motion we allow by default with respect to the coordinate system (set apropriate flags) |
List<IItem> | customItems | Provide a list of optional items to customize the move behavior for these specific items (important: the lenght of custom_ref_flags must match) |
List<DisplayRefType> | customRefFlags | Provide a matching list of flags to customize the movement behavior for specific items |
SetItemFlags(ItemFlags)
Update global item flags. Item flags allow defining how much access the user has to item-specific features. Use FLAG_ITEM_* flags to set one or more flags.
Declaration
void SetItemFlags(ItemFlags itemFlags = ItemFlags.All)
Parameters
Type | Name | Description |
---|---|---|
ItemFlags | itemFlags |
SetJoints(List<IItem>, List<double[]>)
Sets the current robot joints for a list of robot items and a list of a set of joints.
Declaration
void SetJoints(List<IItem> robotItemList, List<double[]> jointsList)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | robotItemList | list of robot items. |
List<double[]> | jointsList | list of robot joints (double x nDOF). |
SetParameter(string, double)
Sets a global parameter from the RoboDK station. If the parameters exists, it will be modified. If not, it will be added to the station. The parameters can also be modified by right clicking the station and selecting "shared parameters"
Declaration
void SetParameter(string parameter, double value)
Parameters
Type | Name | Description |
---|---|---|
string | parameter | RoboDK parameter name |
double | value | parameter value (number) |
SetParameter(string, string)
Sets a global parameter from the RoboDK station. If the parameters exists, it will be modified. If not, it will be added to the station. The parameters can also be modified by right clicking the station and selecting "shared parameters"
Declaration
void SetParameter(string parameter, string value)
Parameters
Type | Name | Description |
---|---|---|
string | parameter | RoboDK parameter name |
string | value | parameter value |
SetRobotParams(IItem, double[][], Mat, Mat)
Gets the nominal robot parameters.
Declaration
bool SetRobotParams(IItem robot, double[][] dhm, Mat poseBase, Mat poseTool)
Parameters
Type | Name | Description |
---|---|---|
IItem | robot | |
double[][] | dhm | |
Mat | poseBase | |
Mat | poseTool |
Returns
Type | Description |
---|---|
bool |
SetRunMode(RunMode)
Sets the behavior of the RoboDK API. By default, robodk shows the path simulation for movement instructions (RunMode.Simulate). Setting the run_mode to RunMode.QuickValidate allows performing a quick check to see if the path is feasible. If robot.Connect() is used, RUNMODE_RUN_FROM_PC is selected automatically.
Declaration
void SetRunMode(RunMode runMode = RunMode.Simulate)
Parameters
Type | Name | Description |
---|---|---|
RunMode | runMode | program run mode. |
SetSelectedItems(List<IItem>)
Set the selection in the tree
Declaration
void SetSelectedItems(List<IItem> item_list)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | item_list |
SetSimulationSpeed(double)
Set the simulation speed. A simulation speed of 5 (default) means that 1 second of simulation time equals to 5 seconds in a real application. The slowest speed ratio allowed is 0.001. Set a large simmulation ratio (>100) for fast simulation results.
Declaration
void SetSimulationSpeed(double speed)
Parameters
Type | Name | Description |
---|---|---|
double | speed | simulation ratio. |
SetViewPose(Mat)
Set the pose of the wold reference frame with respect to the view (camera/screen).
Declaration
void SetViewPose(Mat pose)
Parameters
Type | Name | Description |
---|---|---|
Mat | pose | view pose frame. |
SetVisible(List<IItem>, List<bool>, List<int>)
Sets the visibility for a list of items
Declaration
void SetVisible(List<IItem> itemList, List<bool> visibleList, List<int> visibleFrames = null)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | itemList | list of items |
List<bool> | visibleList | list visible flags (bool) |
List<int> | visibleFrames | list visible frames (optional, hidden by default) |
SetWindowFlags(WindowFlags)
Update the RoboDK flags. RoboDK flags allow defining how much access the user has to RoboDK features. Use the flags defined in WindowFlags to set one or more flags.
Declaration
void SetWindowFlags(WindowFlags flags)
Parameters
Type | Name | Description |
---|---|---|
WindowFlags | flags | RoboDk Window Flags |
SetWindowState(WindowState)
Set the state of the RoboDK window
Declaration
void SetWindowState(WindowState windowState = WindowState.Normal)
Parameters
Type | Name | Description |
---|---|---|
WindowState | windowState | Window state to be set. |
ShowAsCollided(List<IItem>, List<bool>, List<int>)
Show a list of objects or a robot link as collided (red) or as not collided (normal color)
Declaration
void ShowAsCollided(List<IItem> item_list, List<bool> collided_list, List<int> robot_link_id = null)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | item_list | List of items |
List<bool> | collided_list | List of collided flags (True=show as collided) |
List<int> | robot_link_id | Robot link ID, when applicable |
ShowMessage(string, bool)
Show a message in RoboDK (it can be blocking or non blocking in the status bar)
Declaration
void ShowMessage(string message, bool popup = true)
Parameters
Type | Name | Description |
---|---|---|
string | message | Message to display |
bool | popup | Set to true to make the message blocking or set to false to make it non blocking |
ShowRoboDK()
Shows or raises the RoboDK window.
Declaration
void ShowRoboDK()
SolveFK(List<IItem>, List<double[]>, List<bool>)
Calculate the forward kinematics solution for multiple robots at the same time (faster)
Declaration
List<Mat> SolveFK(List<IItem> robotList, List<double[]> jointsList, List<bool> solutionOkList = null)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | robotList | list of items |
List<double[]> | jointsList | list of joint |
List<bool> | solutionOkList | optional list of bool flags to notify about failed/invalid result |
Returns
Type | Description |
---|---|
List<Mat> |
SolveIK_All(List<IItem>, List<Mat>)
Calculate the inverse kinematics solution for multiple robots at the same time. This call allows you to have a bulk calculation for faster performance.
Declaration
List<Mat> SolveIK_All(List<IItem> robotList, List<Mat> poseList)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | robotList | list of items |
List<Mat> | poseList | list of poses |
Returns
Type | Description |
---|---|
List<Mat> |
SolveIK(List<IItem>, List<Mat>, List<double[]>)
Calculate the inverse kinematics solution for multiple robots at the same time (faster)
Declaration
List<double[]> SolveIK(List<IItem> robotList, List<Mat> poseList, List<double[]> japroxList)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | robotList | list of items |
List<Mat> | poseList | list of poses |
List<double[]> | japroxList |
Returns
Type | Description |
---|---|
List<double[]> |
SolveIK(List<IItem>, List<Mat>)
Calculate the inverse kinematics solution for multiple robots at the same time (faster)
Declaration
List<double[]> SolveIK(List<IItem> robotList, List<Mat> poseList)
Parameters
Type | Name | Description |
---|---|---|
List<IItem> | robotList | list of items |
List<Mat> | poseList | list of poses |
Returns
Type | Description |
---|---|
List<double[]> |
StereoCameraMeasure(out Mat, out Mat, out int, out int, out int, out int)
Takes a measurement with the C-Track stereocamera. It returns two poses, the base reference frame and the measured object reference frame.Status is 0 if measurement succeeded.
Declaration
void StereoCameraMeasure(out Mat pose1, out Mat pose2, out int npoints1, out int npoints2, out int time, out int status)
Parameters
Type | Name | Description |
---|---|---|
Mat | pose1 | Pose of the measurement reference |
Mat | pose2 | Pose of the tool measurement |
int | npoints1 | number of visible targets for the measurement pose |
int | npoints2 | number of visible targets for the tool pose |
int | time | time stamp in milliseconds |
int | status | Status is 0 if measurement succeeded |
Update()
Update the screen. This updates the position of all robots and internal links according to previously set values.
Declaration
void Update()
Version()
Return the vesion of RoboDK as a 4 digit string: Major.Minor.Revision.Build
Declaration
string Version()
Returns
Type | Description |
---|---|
string |