From 02bf665fee1bbe5b48e47f1b0e9f27153bad245a Mon Sep 17 00:00:00 2001 From: jontje Date: Tue, 18 Feb 2020 16:17:42 +0100 Subject: [PATCH 1/9] Updated wrapper protocol with RobotWare version enum --- proto/egm_wrapper.proto | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proto/egm_wrapper.proto b/proto/egm_wrapper.proto index 5260bad..a2c77c5 100644 --- a/proto/egm_wrapper.proto +++ b/proto/egm_wrapper.proto @@ -25,6 +25,14 @@ message Header DATA = 1; // Message contains data sent by the robot controller. } + enum RWVersion + { + RW_UNKNOWN = 0; + RW_LATER = 1; + RW_BETWEEN_6_AND_6_06_03 = 2; + RW_BETWEEN_6_07_AND_6_09_02 = 3; + } + optional uint32 sequence_number = 1; // Sequence number (to be able to detect lost messages). optional uint32 time_stamp = 2; // Time stamp in milliseconds. optional MessageType message_type = 3 [default = UNDEFINED]; From 6f3a9ba23545363f7cbe68b187c5ff7e95c03bc8 Mon Sep 17 00:00:00 2001 From: jontje Date: Tue, 18 Feb 2020 16:18:32 +0100 Subject: [PATCH 2/9] Updated wrapper protocol with EGM version enum --- proto/egm_wrapper.proto | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proto/egm_wrapper.proto b/proto/egm_wrapper.proto index a2c77c5..e60e2ae 100644 --- a/proto/egm_wrapper.proto +++ b/proto/egm_wrapper.proto @@ -33,6 +33,13 @@ message Header RW_BETWEEN_6_07_AND_6_09_02 = 3; } + enum EGMVersion + { + EGM_UNKNOWN = 0; + EGM_1_0 = 1; + EGM_1_1 = 2; + } + optional uint32 sequence_number = 1; // Sequence number (to be able to detect lost messages). optional uint32 time_stamp = 2; // Time stamp in milliseconds. optional MessageType message_type = 3 [default = UNDEFINED]; From 764d77e27e829fe6c4c61e1a040dd6427015c16b Mon Sep 17 00:00:00 2001 From: jontje Date: Tue, 18 Feb 2020 16:20:56 +0100 Subject: [PATCH 3/9] Updated wrapper protocol with RW and EGM version fields --- proto/egm_wrapper.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proto/egm_wrapper.proto b/proto/egm_wrapper.proto index e60e2ae..ed6310d 100644 --- a/proto/egm_wrapper.proto +++ b/proto/egm_wrapper.proto @@ -43,6 +43,8 @@ message Header optional uint32 sequence_number = 1; // Sequence number (to be able to detect lost messages). optional uint32 time_stamp = 2; // Time stamp in milliseconds. optional MessageType message_type = 3 [default = UNDEFINED]; + optional RWVersion rw_version = 4 [default = RW_UNKNOWN]; + optional EGMVersion egm_version = 5 [default = EGM_UNKNOWN]; } // Note: Status of the robot controller, and the active EGM motion. From a3a3178d03cdf699dbeb4780160098dd801d6f4f Mon Sep 17 00:00:00 2001 From: jontje Date: Tue, 18 Feb 2020 16:45:39 +0100 Subject: [PATCH 4/9] Implemented detection of RW and EGM versions --- include/abb_libegm/egm_base_interface.h | 5 ++++ src/egm_base_interface.cpp | 31 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/abb_libegm/egm_base_interface.h b/include/abb_libegm/egm_base_interface.h index c6bbeff..8bd7d91 100644 --- a/include/abb_libegm/egm_base_interface.h +++ b/include/abb_libegm/egm_base_interface.h @@ -196,6 +196,11 @@ class EGMBaseInterface : public AbstractUDPServerInterface bool statesOk() const; private: + /** + * \brief Detect RobotWare and EGM protocol versions from a received EGM message. + */ + void detectRWAndEGMVersions(); + /** * \brief Estimate the sample time. * diff --git a/src/egm_base_interface.cpp b/src/egm_base_interface.cpp index e3eedb5..70846a0 100644 --- a/src/egm_base_interface.cpp +++ b/src/egm_base_interface.cpp @@ -84,6 +84,8 @@ bool EGMBaseInterface::InputContainer::extractParsedInformation(const RobotAxes& { bool success = false; + detectRWAndEGMVersions(); + if (has_new_data_ && parse(current_.mutable_header(), egm_robot_.header()) && parse(current_.mutable_feedback(), egm_robot_.feedback(), axes) && @@ -121,6 +123,35 @@ bool EGMBaseInterface::InputContainer::statesOk() const * Auxiliary methods */ +void EGMBaseInterface::InputContainer::detectRWAndEGMVersions() +{ + if(has_new_data_) + { + if(egm_robot_.feedback().has_time()) + { + if(egm_robot_.has_utilizationrate()) + { + current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_LATER); + } + else + { + current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_BETWEEN_6_07_AND_6_09_02); + } + current_.mutable_header()->set_egm_version(wrapper::Header_EGMVersion_EGM_1_1); + } + else + { + current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_BETWEEN_6_AND_6_06_03); + current_.mutable_header()->set_egm_version(wrapper::Header_EGMVersion_EGM_1_0); + } + } + else + { + current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_UNKNOWN); + current_.mutable_header()->set_egm_version(wrapper::Header_EGMVersion_EGM_UNKNOWN); + } +} + double EGMBaseInterface::InputContainer::estimateSampleTime() { double estimate = 0.0; From 491e695eec48dfab17659ff73b4ec9c161e22300 Mon Sep 17 00:00:00 2001 From: jontje Date: Wed, 19 Feb 2020 08:02:51 +0100 Subject: [PATCH 5/9] Renamed latest RobotWare version indicator in the wrapper protocol --- proto/egm_wrapper.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/egm_wrapper.proto b/proto/egm_wrapper.proto index ed6310d..8c0e43c 100644 --- a/proto/egm_wrapper.proto +++ b/proto/egm_wrapper.proto @@ -28,7 +28,7 @@ message Header enum RWVersion { RW_UNKNOWN = 0; - RW_LATER = 1; + RW_6_10_AND_NEWER = 1; RW_BETWEEN_6_AND_6_06_03 = 2; RW_BETWEEN_6_07_AND_6_09_02 = 3; } From 03f1444d26210353bb5d9a821a6b20c2b634c00a Mon Sep 17 00:00:00 2001 From: jontje Date: Wed, 19 Feb 2020 08:04:17 +0100 Subject: [PATCH 6/9] Updated version detection with new enum name --- src/egm_base_interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egm_base_interface.cpp b/src/egm_base_interface.cpp index 70846a0..a79348a 100644 --- a/src/egm_base_interface.cpp +++ b/src/egm_base_interface.cpp @@ -131,7 +131,7 @@ void EGMBaseInterface::InputContainer::detectRWAndEGMVersions() { if(egm_robot_.has_utilizationrate()) { - current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_LATER); + current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_6_10_AND_NEWER); } else { From 0314fb7c04fa8fea31c533e05af0882efcb4061f Mon Sep 17 00:00:00 2001 From: jontje Date: Wed, 19 Feb 2020 08:14:43 +0100 Subject: [PATCH 7/9] Added a clarification comment to the version detection method --- include/abb_libegm/egm_base_interface.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/abb_libegm/egm_base_interface.h b/include/abb_libegm/egm_base_interface.h index 8bd7d91..bf88ce6 100644 --- a/include/abb_libegm/egm_base_interface.h +++ b/include/abb_libegm/egm_base_interface.h @@ -198,6 +198,8 @@ class EGMBaseInterface : public AbstractUDPServerInterface private: /** * \brief Detect RobotWare and EGM protocol versions from a received EGM message. + * + * Note: Only a rough version detection is possible based on if certain fields are present or not. */ void detectRWAndEGMVersions(); From 20f4692a36ccb35160ce3424abea71fa71afd5e3 Mon Sep 17 00:00:00 2001 From: jontje Date: Wed, 19 Feb 2020 10:54:18 +0100 Subject: [PATCH 8/9] Update include/abb_libegm/egm_base_interface.h Co-Authored-By: G.A. vd. Hoorn --- include/abb_libegm/egm_base_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/abb_libegm/egm_base_interface.h b/include/abb_libegm/egm_base_interface.h index bf88ce6..5476859 100644 --- a/include/abb_libegm/egm_base_interface.h +++ b/include/abb_libegm/egm_base_interface.h @@ -199,7 +199,7 @@ class EGMBaseInterface : public AbstractUDPServerInterface /** * \brief Detect RobotWare and EGM protocol versions from a received EGM message. * - * Note: Only a rough version detection is possible based on if certain fields are present or not. + * Note: Only a rough version detection is possible based on whether certain fields are present or not. */ void detectRWAndEGMVersions(); From ae7fb5994c6944ac28030f3a0c5e1f77d1820343 Mon Sep 17 00:00:00 2001 From: jontje Date: Wed, 19 Feb 2020 13:23:07 +0100 Subject: [PATCH 9/9] Added comments to clarify the version detection --- proto/egm_wrapper.proto | 12 +++++++----- src/egm_base_interface.cpp | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/proto/egm_wrapper.proto b/proto/egm_wrapper.proto index 8c0e43c..be31f00 100644 --- a/proto/egm_wrapper.proto +++ b/proto/egm_wrapper.proto @@ -25,19 +25,21 @@ message Header DATA = 1; // Message contains data sent by the robot controller. } + // Note: EGM messages received during runtime are inspected to detect the RobotWare version. enum RWVersion { RW_UNKNOWN = 0; - RW_6_10_AND_NEWER = 1; - RW_BETWEEN_6_AND_6_06_03 = 2; - RW_BETWEEN_6_07_AND_6_09_02 = 3; + RW_6_10_AND_NEWER = 1; // Selected if all the fields mentioned below exist. + RW_BETWEEN_6_AND_6_06_03 = 2; // Selected if no time field exist (was added in RW6.07). + RW_BETWEEN_6_07_AND_6_09_02 = 3; // Selected if no utilization rate field exist (was added in RW6.10). } + // Note: EGM messages received during runtime are inspected to detect the EGM version. enum EGMVersion { EGM_UNKNOWN = 0; - EGM_1_0 = 1; - EGM_1_1 = 2; + EGM_1_0 = 1; // Selected if no time field exist (was added in 6.07). + EGM_1_1 = 2; // Selected if the field mentioned below exist. } optional uint32 sequence_number = 1; // Sequence number (to be able to detect lost messages). diff --git a/src/egm_base_interface.cpp b/src/egm_base_interface.cpp index a79348a..b4d37c5 100644 --- a/src/egm_base_interface.cpp +++ b/src/egm_base_interface.cpp @@ -127,20 +127,33 @@ void EGMBaseInterface::InputContainer::detectRWAndEGMVersions() { if(has_new_data_) { + // Time field was added in RobotWare '6.07', as well as fix of inconsistent units (e.g. radians and degrees). if(egm_robot_.feedback().has_time()) { + // If time field present: + // - RW greater than or equal to '6.07'. + // - EGM protocol '1.1' (with consistent units). + current_.mutable_header()->set_egm_version(wrapper::Header_EGMVersion_EGM_1_1); + + // Utilization field was added in RobotWare '6.10'. if(egm_robot_.has_utilizationrate()) { + // If utilization field present: + // - RW greater than or equal to '6.10'. current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_6_10_AND_NEWER); } else { + // If utilization field absent: + // - RW between '6.07' and '6.09.02'. current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_BETWEEN_6_07_AND_6_09_02); } - current_.mutable_header()->set_egm_version(wrapper::Header_EGMVersion_EGM_1_1); } else { + // If time field absent: + // - RW between '6.0' and '6.06.03'. + // - EGM protocol '1.0' (with inconsistent units). current_.mutable_header()->set_rw_version(wrapper::Header_RWVersion_RW_BETWEEN_6_AND_6_06_03); current_.mutable_header()->set_egm_version(wrapper::Header_EGMVersion_EGM_1_0); }