From a346c9c7e14c49d31b6eb308bb62c3c96a6a3235 Mon Sep 17 00:00:00 2001 From: VDm Date: Thu, 27 Nov 2025 14:51:44 +0400 Subject: [PATCH 1/5] feat(C++): add CollisionActivePairList method --- C++/robodk_api.cpp | 39 +++++++++++++++++++++++++++++++++++++++ C++/robodk_api.h | 9 +++++++++ 2 files changed, 48 insertions(+) diff --git a/C++/robodk_api.cpp b/C++/robodk_api.cpp index d018395..4b81657 100644 --- a/C++/robodk_api.cpp +++ b/C++/robodk_api.cpp @@ -3196,6 +3196,45 @@ int RoboDK::Collision(Item item1, Item item2) return ncollisions; } +/// +/// Returns the pairs of objects that are currently in a collision state. +/// +/// List of the first colliding objects +/// List of the second colliding objects +/// List of Joint IDs for the first colliding objects +/// List of Joint IDs for the second colliding objects +void RoboDK::CollisionActivePairList(QList& item1, QList& item2, QList& id1, QList& id2) +{ + _check_connection(); + _send_Line("Collision_GetPairList"); + int nitems = _recv_Int(); + + item1.clear(); + item2.clear(); + id1.clear(); + id2.clear(); + + item1.reserve(nitems); + item2.reserve(nitems); + id1.reserve(nitems); + id2.reserve(nitems); + + for (int i = 0; i < nitems; ++i) + { + item1.append(_recv_Item()); + id1.append(_recv_Int()); + item2.append(_recv_Item()); + id2.append(_recv_Int()); + } + + _check_status(); +} + +/// +/// Return the list of items that are in a collision state. This function can be used after calling Collisions() to retrieve the items that are in a collision state. +/// +/// List of robot link IDs that are in collision (0 for objects and tools). +/// List of items that are in a collision state. QList RoboDK::getCollisionItems(QList& link_id_list) { link_id_list.clear(); diff --git a/C++/robodk_api.h b/C++/robodk_api.h index e5f4e8b..06b81d6 100644 --- a/C++/robodk_api.h +++ b/C++/robodk_api.h @@ -1068,6 +1068,15 @@ class ROBODK RoboDK { /// 0 if no collisions are found. int Collision(Item item1, Item item2); + /// + /// Returns the pairs of objects that are currently in a collision state. + /// + /// List of the first colliding objects + /// List of the second colliding objects + /// List of Joint IDs for the first colliding objects + /// List of Joint IDs for the second colliding objects + void CollisionActivePairList(QList& item1, QList& item2, QList& id1, QList& id2); + /// /// Return the list of items that are in a collision state. This function can be used after calling Collisions() to retrieve the items that are in a collision state. /// From ce74869924747ae697d6da1f2b44ddeedb739a38 Mon Sep 17 00:00:00 2001 From: VDm Date: Thu, 27 Nov 2025 15:57:03 +0400 Subject: [PATCH 2/5] feat(C#): add CollisionActivePairList method --- C#/API/IRoboDk.cs | 8 +++++++- C#/API/RoboDK.cs | 19 +++++++++++++++++++ C#/Example/RoboDKSampleProject/RoboDK.cs | 21 +++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/C#/API/IRoboDk.cs b/C#/API/IRoboDk.cs index 9b5bea9..d8f3542 100644 --- a/C#/API/IRoboDk.cs +++ b/C#/API/IRoboDk.cs @@ -554,9 +554,15 @@ IItem AddCurve(Mat curvePoints, IItem referenceObject = null, bool addToRef = fa /// /// 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). /// - /// + /// List of items that are in a collision state List GetCollisionPairs(); + /// + /// Returns the list of pairs of items that are in a collision state. + /// + /// List of items that are in a collision state + List CollisionActivePairList(); + /// /// 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. diff --git a/C#/API/RoboDK.cs b/C#/API/RoboDK.cs index 9c55727..29db8ad 100644 --- a/C#/API/RoboDK.cs +++ b/C#/API/RoboDK.cs @@ -1296,6 +1296,25 @@ public List GetCollisionPairs() return list_items; } + /// + public List CollisionActivePairList() + { + check_connection(); + send_line("Collision_GetPairList"); + int nitems = rec_int(); + List list_items = new List(nitems); + for (int i = 0; i < nitems; i++) + { + IItem item1 = rec_item(); + int id1 = rec_int(); + IItem item2 = rec_item(); + int id2 = rec_int(); + CollisionPair collisionPair = new CollisionPair(item1, id1, item2, id2); + list_items.Add(collisionPair); + } + check_status(); + return list_items; + } /// public void SetSimulationSpeed(double speed) diff --git a/C#/Example/RoboDKSampleProject/RoboDK.cs b/C#/Example/RoboDKSampleProject/RoboDK.cs index 4aa3eb3..d437209 100644 --- a/C#/Example/RoboDKSampleProject/RoboDK.cs +++ b/C#/Example/RoboDKSampleProject/RoboDK.cs @@ -3934,6 +3934,27 @@ public List CollisionItems(List link_id_list = null) return item_list; } + /// + /// Returns the list of pairs of items that are in a collision state. + /// + /// List of items that are in a collision state + public List> CollisionActivePairList() + { + _check_connection(); + _send_Line("Collision_GetPairList"); + int nitems = _recv_Int(); + List> list_items = new List>(nitems); + for (int i = 0; i < nitems; i++) + { + Item item1 = _recv_Item(); + int id1 = _recv_Int(); + Item item2 = _recv_Item(); + int id2 = _recv_Int(); + list_items.Add(new Tuple(item1, item2, id1, id2)); + } + _check_status(); + return list_items; + } /// /// Sets the current simulation speed. Set the speed to 1 for a real-time simulation. The slowest speed allowed is 0.001 times the real speed. Set to a high value (>100) for fast simulation results. From 32cde6b7b8622c8105082a0a984f9f973adae797 Mon Sep 17 00:00:00 2001 From: VDm Date: Thu, 27 Nov 2025 18:35:54 +0400 Subject: [PATCH 3/5] feat: add new instruction types for C++ and C# APIs (RDK-1094) --- C#/API/Model/InstructionType.cs | 17 +++++++++++------ C#/Example/RoboDKSampleProject/RoboDK.cs | 3 +++ C++/robodk_api.h | 11 ++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/C#/API/Model/InstructionType.cs b/C#/API/Model/InstructionType.cs index 761bfee..ebac4c1 100644 --- a/C#/API/Model/InstructionType.cs +++ b/C#/API/Model/InstructionType.cs @@ -40,6 +40,8 @@ +using System; + namespace RoboDk.API.Model { // Instruction types @@ -47,15 +49,18 @@ public enum InstructionType { Invalid = -1, Move = 0, - Movec = 1, - Changespeed = 2, - Changeframe = 3, - Changetool = 4, - Changerobot = 5, + MoveC = 1, + ChangeSpeed = 2, + ChangeFrame = 3, + ChangeTool = 4, + ChangeRobot = 5, Pause = 6, Event = 7, Code = 8, - Print = 9 + Print = 9, + Rounding = 10, + IO = 11, + Custom = 12 } } diff --git a/C#/Example/RoboDKSampleProject/RoboDK.cs b/C#/Example/RoboDKSampleProject/RoboDK.cs index d437209..0251ed5 100644 --- a/C#/Example/RoboDKSampleProject/RoboDK.cs +++ b/C#/Example/RoboDKSampleProject/RoboDK.cs @@ -1715,6 +1715,9 @@ public RDKException(string Message) public const int INS_TYPE_EVENT = 7; public const int INS_TYPE_CODE = 8; public const int INS_TYPE_PRINT = 9; + public const int INS_TYPE_ROUNDING = 10; + public const int INS_TYPE_IO = 11; + public const int INS_TYPE_CUSTOM = 12; // Move types public const int MOVE_TYPE_INVALID = -1; diff --git a/C++/robodk_api.h b/C++/robodk_api.h index 06b81d6..99e9d14 100644 --- a/C++/robodk_api.h +++ b/C++/robodk_api.h @@ -1415,7 +1415,16 @@ class ROBODK RoboDK { INS_TYPE_CODE = 8, /// Display message on the teach pendant. - INS_TYPE_PRINT = 9 + INS_TYPE_PRINT = 9, + + /// Rounding instruction. + INS_TYPE_ROUNDING = 10, + + /// Set or Wait I/O instruction. + INS_TYPE_IO = 11, + + /// Custom instruction. + INS_TYPE_CUSTOM = 12 }; /// Movement types From d7d694e4559f043d95dc1e46e28ff052902e9b79 Mon Sep 17 00:00:00 2001 From: VDm Date: Mon, 1 Dec 2025 17:59:42 +0400 Subject: [PATCH 4/5] chore: update doxygen comments for CollisionActivePairList --- C#/API/IRoboDk.cs | 4 ++-- C#/Example/RoboDKSampleProject/RoboDK.cs | 4 ++-- C++/robodk_api.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C#/API/IRoboDk.cs b/C#/API/IRoboDk.cs index d8f3542..8e1db74 100644 --- a/C#/API/IRoboDk.cs +++ b/C#/API/IRoboDk.cs @@ -558,9 +558,9 @@ IItem AddCurve(Mat curvePoints, IItem referenceObject = null, bool addToRef = fa List GetCollisionPairs(); /// - /// Returns the list of pairs of items that are in a collision state. + /// Returns the list of pairs of items that are in the collision map. /// - /// List of items that are in a collision state + /// List of items that are in the collision map List CollisionActivePairList(); /// diff --git a/C#/Example/RoboDKSampleProject/RoboDK.cs b/C#/Example/RoboDKSampleProject/RoboDK.cs index 0251ed5..c4d1e12 100644 --- a/C#/Example/RoboDKSampleProject/RoboDK.cs +++ b/C#/Example/RoboDKSampleProject/RoboDK.cs @@ -3938,9 +3938,9 @@ public List CollisionItems(List link_id_list = null) } /// - /// Returns the list of pairs of items that are in a collision state. + /// Returns the list of pairs of items that are in the collision map. /// - /// List of items that are in a collision state + /// List of items that are in the collision map public List> CollisionActivePairList() { _check_connection(); diff --git a/C++/robodk_api.h b/C++/robodk_api.h index 99e9d14..cd9a5d2 100644 --- a/C++/robodk_api.h +++ b/C++/robodk_api.h @@ -1069,7 +1069,7 @@ class ROBODK RoboDK { int Collision(Item item1, Item item2); /// - /// Returns the pairs of objects that are currently in a collision state. + /// Returns the pairs of objects that are currently in the collision map. /// /// List of the first colliding objects /// List of the second colliding objects From d24774dd7c8d05c00dd9dddad6e81f99014b5430 Mon Sep 17 00:00:00 2001 From: VDm Date: Tue, 2 Dec 2025 20:40:20 +0400 Subject: [PATCH 5/5] chore: update doxygen comments for CollisionActivePairList --- C#/API/IRoboDk.cs | 1 + C#/Example/RoboDKSampleProject/RoboDK.cs | 1 + C++/robodk_api.h | 1 + 3 files changed, 3 insertions(+) diff --git a/C#/API/IRoboDk.cs b/C#/API/IRoboDk.cs index 8e1db74..6ad5602 100644 --- a/C#/API/IRoboDk.cs +++ b/C#/API/IRoboDk.cs @@ -559,6 +559,7 @@ IItem AddCurve(Mat curvePoints, IItem referenceObject = null, bool addToRef = fa /// /// Returns the list of pairs of items that are in the collision map. + /// Items that are not visible will still be included, regardless of the "Include hidden objects" option. /// /// List of items that are in the collision map List CollisionActivePairList(); diff --git a/C#/Example/RoboDKSampleProject/RoboDK.cs b/C#/Example/RoboDKSampleProject/RoboDK.cs index c4d1e12..2f009cc 100644 --- a/C#/Example/RoboDKSampleProject/RoboDK.cs +++ b/C#/Example/RoboDKSampleProject/RoboDK.cs @@ -3939,6 +3939,7 @@ public List CollisionItems(List link_id_list = null) /// /// Returns the list of pairs of items that are in the collision map. + /// Items that are not visible will still be included, regardless of the "Include hidden objects" option. /// /// List of items that are in the collision map public List> CollisionActivePairList() diff --git a/C++/robodk_api.h b/C++/robodk_api.h index cd9a5d2..7f8939b 100644 --- a/C++/robodk_api.h +++ b/C++/robodk_api.h @@ -1070,6 +1070,7 @@ class ROBODK RoboDK { /// /// Returns the pairs of objects that are currently in the collision map. + /// Items that are not visible will still be included, regardless of the "Include hidden objects" option. /// /// List of the first colliding objects /// List of the second colliding objects