From ac57b6bcedf2c4c8659e7be998103625619ba7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 14:29:45 +0100 Subject: [PATCH 01/15] [DQ_Kinematics.h Added the DQ_ParameterDH enum class. --- include/dqrobotics/robot_modeling/DQ_Kinematics.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/dqrobotics/robot_modeling/DQ_Kinematics.h b/include/dqrobotics/robot_modeling/DQ_Kinematics.h index fbd52b3..95553fb 100644 --- a/include/dqrobotics/robot_modeling/DQ_Kinematics.h +++ b/include/dqrobotics/robot_modeling/DQ_Kinematics.h @@ -17,7 +17,12 @@ This file is part of DQ Robotics. along with DQ Robotics. If not, see . Contributors: -- Murilo M. Marinho (murilomarinho@ieee.org) +1. Murilo M. Marinho (murilomarinho@ieee.org) + - Responsible for the original implementation. + +2. Juan Jose Quiroz Omana (juanjqogm@gmail.com) + - Added the enum class DQ_ParameterDH + */ #ifndef DQ_ROBOT_MODELLING_DQ_KINEMATICS_H @@ -29,6 +34,8 @@ namespace DQ_robotics { class DQ_Kinematics { +public: + enum class DQ_ParameterDH{THETA, D, A, ALPHA}; protected: std::string name_; From a00a30e0381b2872a892575d2711c8dfcebb9be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 14:34:18 +0100 Subject: [PATCH 02/15] [DQ_SerialManipulatorDH.{h, .cpp}] Added methods to get and set the DH parameters. --- .../robot_modeling/DQ_SerialManipulatorDH.h | 15 ++- src/robot_modeling/DQ_SerialManipulatorDH.cpp | 92 +++++++++++++++++++ 2 files changed, 105 insertions(+), 2 deletions(-) diff --git a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h index b0bbf7d..660cc1c 100644 --- a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h +++ b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h @@ -18,8 +18,11 @@ This file is part of DQ Robotics. along with DQ Robotics. If not, see . Contributors: -- Murilo M. Marinho (murilomarinho@ieee.org) -- Juan Jose Quiroz Omana (juanjqo@g.ecc.u-tokyo.ac.jp) +1. Murilo M. Marinho (murilomarinho@ieee.org) + - Responsible for the original implementation. + +2. Juan Jose Quiroz Omana (juanjqogm@gmail.com) + - Added methods to get and set the DH parameters. */ @@ -36,6 +39,14 @@ class DQ_SerialManipulatorDH: public DQ_SerialManipulator DQ _get_w(const int& ith) const; DQ _dh2dq(const double& q, const int& ith) const; public: + VectorXd get_parameters(const DQ_ParameterDH& parameter_type) const; + double get_parameter(const DQ_ParameterDH& parameter_type, + const int& to_ith_link) const; + void set_parameters(const DQ_ParameterDH& parameter_type, + const VectorXd& vector_parameters); + void set_parameter(const DQ_ParameterDH& parameter_type, + const int& to_ith_link, + const double& parameter); // Deprecated on 22.04, will be removed on the next release. enum [[deprecated("Use ? instead.")]] JOINT_TYPES{ JOINT_ROTATIONAL=0, JOINT_PRISMATIC }; diff --git a/src/robot_modeling/DQ_SerialManipulatorDH.cpp b/src/robot_modeling/DQ_SerialManipulatorDH.cpp index c40f0d9..5e8017f 100644 --- a/src/robot_modeling/DQ_SerialManipulatorDH.cpp +++ b/src/robot_modeling/DQ_SerialManipulatorDH.cpp @@ -99,6 +99,98 @@ DQ DQ_SerialManipulatorDH::_dh2dq(const double &q, const int &ith) const ); } +/** + * @brief DQ_SerialManipulatorDH::get_parameters returns a vector containing the DH parameters. + * @param parameter_type Parameter type, which which corresponds to THETA, D, A, or ALPHA. + * @return A vector containing the desired DH parameters. + */ +VectorXd DQ_SerialManipulatorDH::get_parameters(const DQ_ParameterDH ¶meter_type) const +{ + switch (parameter_type) { + case DQ_ParameterDH::THETA: + return dh_matrix_.row(0); + case DQ_ParameterDH::D: + return dh_matrix_.row(1); + case DQ_ParameterDH::A: + return dh_matrix_.row(2); + case DQ_ParameterDH::ALPHA: + return dh_matrix_.row(3); + } +} + +/** + * @brief DQ_SerialManipulatorDH::get_parameter returns the DH parameter of the ith joint. + * @param parameter_type Parameter type, which which corresponds to THETA, D, A, or ALPHA. + * @param to_ith_link The joint number. + * @return The desired DH parameter. + */ +double DQ_SerialManipulatorDH::get_parameter(const DQ_ParameterDH ¶meter_type, + const int &to_ith_link) const +{ + _check_to_ith_link(to_ith_link); + switch (parameter_type) { + case DQ_ParameterDH::THETA: + return dh_matrix_(0, to_ith_link); + case DQ_ParameterDH::D: + return dh_matrix_(1, to_ith_link); + case DQ_ParameterDH::A: + return dh_matrix_(2, to_ith_link); + case DQ_ParameterDH::ALPHA: + return dh_matrix_(3, to_ith_link); + } +} + +/** + * @brief DQ_SerialManipulatorDH::set_parameters sets the DH parameters. + * @param parameter_type Parameter type, which which corresponds to THETA, D, A, or ALPHA. + * @param vector_parameters A vector containing the new parameters. + */ +void DQ_SerialManipulatorDH::set_parameters(const DQ_ParameterDH ¶meter_type, + const VectorXd &vector_parameters) +{ + _check_q_vec(vector_parameters); + switch (parameter_type) { + case DQ_ParameterDH::THETA: + dh_matrix_.row(0) = vector_parameters; + break; + case DQ_ParameterDH::D: + dh_matrix_.row(1) = vector_parameters; + break; + case DQ_ParameterDH::A: + dh_matrix_.row(2) = vector_parameters; + break; + case DQ_ParameterDH::ALPHA: + dh_matrix_.row(3) = vector_parameters; + break; + } +} + +/** + * @brief DQ_SerialManipulatorDH::set_parameter sets the DH parameter of the ith joint. + * @param parameter_type Parameter type, which which corresponds to THETA, D, A, or ALPHA. + * @param to_ith_link The joint number. + * @param parameter The new parameter. + */ +void DQ_SerialManipulatorDH::set_parameter(const DQ_ParameterDH ¶meter_type, + const int &to_ith_link, const double ¶meter) +{ + _check_to_ith_link(to_ith_link); + switch (parameter_type) { + case DQ_ParameterDH::THETA: + dh_matrix_(0, to_ith_link) = parameter; + break; + case DQ_ParameterDH::D: + dh_matrix_(1, to_ith_link) = parameter; + break; + case DQ_ParameterDH::A: + dh_matrix_(2, to_ith_link) = parameter; + break; + case DQ_ParameterDH::ALPHA: + dh_matrix_(3, to_ith_link) = parameter; + break; + } +} + /** * @brief This protected method computes the dual quaternion related with the time derivative of the From c29aeab310921a498c258ed4869400b52ed8b9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 14:37:07 +0100 Subject: [PATCH 03/15] [DQ_SerialManipulatorMDH.h] Updated the description of the contributions in the header --- .../robot_modeling/DQ_SerialManipulatorMDH.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h index 03e6874..2530137 100644 --- a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h +++ b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h @@ -18,8 +18,11 @@ This file is part of DQ Robotics. along with DQ Robotics. If not, see . Contributors: -- Murilo M. Marinho (murilomarinho@ieee.org) -- Juan Jose Quiroz Omana - juanjqo@g.ecc.u-tokyo.ac.jp +1. Murilo M. Marinho (murilomarinho@ieee.org) + - Responsible for the original implementation. + +2. Juan Jose Quiroz Omana (juanjqogm@gmail.com) + - Added methods to get and set the DH parameters. */ #include @@ -35,6 +38,14 @@ class DQ_SerialManipulatorMDH: public DQ_SerialManipulator DQ _get_w(const int& ith) const; DQ _mdh2dq(const double& q, const int& ith) const; public: + VectorXd get_parameters(const DQ_ParameterDH& parameter_type) const; + double get_parameter(const DQ_ParameterDH& parameter_type, + const int& to_ith_link) const; + void set_parameters(const DQ_ParameterDH& parameter_type, + const VectorXd& vector_parameters); + void set_parameter(const DQ_ParameterDH& parameter_type, + const int& to_ith_link, + const double& parameter); // Deprecated on 22.04, will be removed on the next release. enum [[deprecated("Use ? instead.")]] JOINT_TYPES{ JOINT_ROTATIONAL=0, JOINT_PRISMATIC }; From 045dec49d23f5981519547706ac6666274d4f380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 14:37:48 +0100 Subject: [PATCH 04/15] [DQ_SerialManipulatorDH.h] Updated the description of the contributions in the header --- src/robot_modeling/DQ_SerialManipulatorDH.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/robot_modeling/DQ_SerialManipulatorDH.cpp b/src/robot_modeling/DQ_SerialManipulatorDH.cpp index 5e8017f..e1be146 100644 --- a/src/robot_modeling/DQ_SerialManipulatorDH.cpp +++ b/src/robot_modeling/DQ_SerialManipulatorDH.cpp @@ -17,8 +17,11 @@ This file is part of DQ Robotics. along with DQ Robotics. If not, see . Contributors: -- Murilo M. Marinho (murilomarinho@ieee.org) -- Juan Jose Quiroz Omana (juanjqo@g.ecc.u-tokyo.ac.jp) +1. Murilo M. Marinho (murilomarinho@ieee.org) + - Responsible for the original implementation. + +2. Juan Jose Quiroz Omana (juanjqogm@gmail.com) + - Added methods to get and set the DH parameters. */ #include From e54a34896a704b302db463ba2abfdbb5bdae63f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 14:38:23 +0100 Subject: [PATCH 05/15] [DQ_SerialManipulatorMDH.cpp] Updated the description of the contributions in the header --- .../DQ_SerialManipulatorMDH.cpp | 99 ++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/src/robot_modeling/DQ_SerialManipulatorMDH.cpp b/src/robot_modeling/DQ_SerialManipulatorMDH.cpp index d7f8305..ae17ebe 100644 --- a/src/robot_modeling/DQ_SerialManipulatorMDH.cpp +++ b/src/robot_modeling/DQ_SerialManipulatorMDH.cpp @@ -17,8 +17,11 @@ This file is part of DQ Robotics. along with DQ Robotics. If not, see . Contributors: -- Murilo M. Marinho (murilomarinho@ieee.org) -- Juan Jose Quiroz Omana - juanjqo@g.ecc.u-tokyo.ac.jp +1. Murilo M. Marinho (murilomarinho@ieee.org) + - Responsible for the original implementation. + +2. Juan Jose Quiroz Omana (juanjqogm@gmail.com) + - Added methods to get and set the DH parameters. */ #include @@ -110,6 +113,98 @@ DQ DQ_SerialManipulatorMDH::_mdh2dq(const double &q, const int &ith) const ); } +/** + * @brief DQ_SerialManipulatorMDH::get_parameters returns a vector containing the MDH parameters. + * @param parameter_type Parameter type, which which corresponds to THETA, D, A, or ALPHA. + * @return A vector containing the desired MDH parameters. + */ +VectorXd DQ_SerialManipulatorMDH::get_parameters(const DQ_ParameterDH ¶meter_type) const +{ + switch (parameter_type) { + case DQ_ParameterDH::THETA: + return mdh_matrix_.row(0); + case DQ_ParameterDH::D: + return mdh_matrix_.row(1); + case DQ_ParameterDH::A: + return mdh_matrix_.row(2); + case DQ_ParameterDH::ALPHA: + return mdh_matrix_.row(3); + } +} + +/** + * @brief DQ_SerialManipulatorMDH::get_parameter returns the MDH parameter of the ith joint. + * @param parameter_type Parameter type, which which corresponds to THETA, D, A, or ALPHA. + * @param to_ith_link The joint number. + * @return The desired MDH parameter. + */ +double DQ_SerialManipulatorMDH::get_parameter(const DQ_ParameterDH ¶meter_type, + const int &to_ith_link) const +{ + _check_to_ith_link(to_ith_link); + switch (parameter_type) { + case DQ_ParameterDH::THETA: + return mdh_matrix_(0, to_ith_link); + case DQ_ParameterDH::D: + return mdh_matrix_(1, to_ith_link); + case DQ_ParameterDH::A: + return mdh_matrix_(2, to_ith_link); + case DQ_ParameterDH::ALPHA: + return mdh_matrix_(3, to_ith_link); + } +} + +/** + * @brief DQ_SerialManipulatorMDH::set_parameters sets the MDH parameters. + * @param parameter_type Parameter type, which which corresponds to THETA, D, A, or ALPHA. + * @param vector_parameters A vector containing the new parameters. + */ +void DQ_SerialManipulatorMDH::set_parameters(const DQ_ParameterDH ¶meter_type, + const VectorXd &vector_parameters) +{ + _check_q_vec(vector_parameters); + switch (parameter_type) { + case DQ_ParameterDH::THETA: + mdh_matrix_.row(0) = vector_parameters; + break; + case DQ_ParameterDH::D: + mdh_matrix_.row(1) = vector_parameters; + break; + case DQ_ParameterDH::A: + mdh_matrix_.row(2) = vector_parameters; + break; + case DQ_ParameterDH::ALPHA: + mdh_matrix_.row(3) = vector_parameters; + break; + } +} + +/** + * @brief DQ_SerialManipulatorMDH::set_parameter sets the MDH parameter of the ith joint. + * @param parameter_type Parameter type, which which corresponds to THETA, D, A, or ALPHA. + * @param to_ith_link The joint number. + * @param parameter The new parameter. + */ +void DQ_SerialManipulatorMDH::set_parameter(const DQ_ParameterDH ¶meter_type, + const int &to_ith_link, const double ¶meter) +{ + _check_to_ith_link(to_ith_link); + switch (parameter_type) { + case DQ_ParameterDH::THETA: + mdh_matrix_(0, to_ith_link) = parameter; + break; + case DQ_ParameterDH::D: + mdh_matrix_(1, to_ith_link) = parameter; + break; + case DQ_ParameterDH::A: + mdh_matrix_(2, to_ith_link) = parameter; + break; + case DQ_ParameterDH::ALPHA: + mdh_matrix_(3, to_ith_link) = parameter; + break; + } +} + /** * @brief This protected method computes the dual quaternion related with the time derivative of the * unit dual quaternion pose using the MDH convention. From 1ea3ae8aa494493ae43a9f2a2bb994b561835e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 14:39:41 +0100 Subject: [PATCH 06/15] Updated the copyright year --- include/dqrobotics/robot_modeling/DQ_Kinematics.h | 2 +- include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h | 2 +- include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h | 2 +- src/robot_modeling/DQ_Kinematics.cpp | 2 +- src/robot_modeling/DQ_SerialManipulatorDH.cpp | 2 +- src/robot_modeling/DQ_SerialManipulatorMDH.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/dqrobotics/robot_modeling/DQ_Kinematics.h b/include/dqrobotics/robot_modeling/DQ_Kinematics.h index 95553fb..5bc5662 100644 --- a/include/dqrobotics/robot_modeling/DQ_Kinematics.h +++ b/include/dqrobotics/robot_modeling/DQ_Kinematics.h @@ -1,5 +1,5 @@ /** -(C) Copyright 2019 DQ Robotics Developers +(C) Copyright 2011-2025 DQ Robotics Developers This file is part of DQ Robotics. diff --git a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h index 660cc1c..ab60cab 100644 --- a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h +++ b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h @@ -1,6 +1,6 @@ #pragma once /** -(C) Copyright 2020-2022 DQ Robotics Developers +(C) Copyright 2011-2025 DQ Robotics Developers This file is part of DQ Robotics. diff --git a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h index 2530137..ec969b3 100644 --- a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h +++ b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h @@ -1,6 +1,6 @@ #pragma once /** -(C) Copyright 2022 DQ Robotics Developers +(C) Copyright 2011-2025 DQ Robotics Developers This file is part of DQ Robotics. diff --git a/src/robot_modeling/DQ_Kinematics.cpp b/src/robot_modeling/DQ_Kinematics.cpp index 8a38b59..8654b0b 100644 --- a/src/robot_modeling/DQ_Kinematics.cpp +++ b/src/robot_modeling/DQ_Kinematics.cpp @@ -1,5 +1,5 @@ /** -(C) Copyright 2019-2020 DQ Robotics Developers +(C) Copyright 2011-2025 DQ Robotics Developers This file is part of DQ Robotics. diff --git a/src/robot_modeling/DQ_SerialManipulatorDH.cpp b/src/robot_modeling/DQ_SerialManipulatorDH.cpp index e1be146..d4c9c78 100644 --- a/src/robot_modeling/DQ_SerialManipulatorDH.cpp +++ b/src/robot_modeling/DQ_SerialManipulatorDH.cpp @@ -1,5 +1,5 @@ /** -(C) Copyright 2020-2022 DQ Robotics Developers +(C) Copyright 2011-2025 DQ Robotics Developers This file is part of DQ Robotics. diff --git a/src/robot_modeling/DQ_SerialManipulatorMDH.cpp b/src/robot_modeling/DQ_SerialManipulatorMDH.cpp index ae17ebe..4d88561 100644 --- a/src/robot_modeling/DQ_SerialManipulatorMDH.cpp +++ b/src/robot_modeling/DQ_SerialManipulatorMDH.cpp @@ -1,5 +1,5 @@ /** -(C) Copyright 2022 DQ Robotics Developers +(C) Copyright 2011-2025 DQ Robotics Developers This file is part of DQ Robotics. From 423591f4ea4ff984ac87f968019bdbfc0d665a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 15:09:43 +0100 Subject: [PATCH 07/15] [DQ_Kinematics.h, DQ_SerialManipulator.{h,cpp}] Moved the DQ_ParameterDH enum class from DQ_Kinematics to DQ_SerialManipulator --- include/dqrobotics/robot_modeling/DQ_Kinematics.h | 6 ------ .../dqrobotics/robot_modeling/DQ_SerialManipulator.h | 10 +++++++--- src/robot_modeling/DQ_SerialManipulator.cpp | 10 ++++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/dqrobotics/robot_modeling/DQ_Kinematics.h b/include/dqrobotics/robot_modeling/DQ_Kinematics.h index 5bc5662..c7fbd40 100644 --- a/include/dqrobotics/robot_modeling/DQ_Kinematics.h +++ b/include/dqrobotics/robot_modeling/DQ_Kinematics.h @@ -19,10 +19,6 @@ This file is part of DQ Robotics. Contributors: 1. Murilo M. Marinho (murilomarinho@ieee.org) - Responsible for the original implementation. - -2. Juan Jose Quiroz Omana (juanjqogm@gmail.com) - - Added the enum class DQ_ParameterDH - */ #ifndef DQ_ROBOT_MODELLING_DQ_KINEMATICS_H @@ -34,8 +30,6 @@ namespace DQ_robotics { class DQ_Kinematics { -public: - enum class DQ_ParameterDH{THETA, D, A, ALPHA}; protected: std::string name_; diff --git a/include/dqrobotics/robot_modeling/DQ_SerialManipulator.h b/include/dqrobotics/robot_modeling/DQ_SerialManipulator.h index a4c609b..4835393 100644 --- a/include/dqrobotics/robot_modeling/DQ_SerialManipulator.h +++ b/include/dqrobotics/robot_modeling/DQ_SerialManipulator.h @@ -18,9 +18,11 @@ This file is part of DQ Robotics. along with DQ Robotics. If not, see . Contributors: -- Murilo M. Marinho (murilomarinho@ieee.org) -- Mateus Rodrigues Martins (martinsrmateus@gmail.com) -- Juan Jose Quiroz Omana (juanjqo@g.ecc.u-tokyo.ac.jp) +1. Murilo M. Marinho (murilomarinho@ieee.org) +2. Mateus Rodrigues Martins (martinsrmateus@gmail.com) + +3. Juan Jose Quiroz Omana (juanjqogm@gmail.com) + - Added the enum class DQ_ParameterDH */ #include @@ -30,6 +32,8 @@ namespace DQ_robotics class DQ_SerialManipulator: public DQ_Kinematics { +public: + enum class DQ_ParameterDH{THETA, D, A, ALPHA}; protected: DQ curr_effector_; diff --git a/src/robot_modeling/DQ_SerialManipulator.cpp b/src/robot_modeling/DQ_SerialManipulator.cpp index 1d923af..ec685b1 100644 --- a/src/robot_modeling/DQ_SerialManipulator.cpp +++ b/src/robot_modeling/DQ_SerialManipulator.cpp @@ -1,5 +1,5 @@ /** -(C) Copyright 2011-2020 DQ Robotics Developers +(C) Copyright 2011-2025 DQ Robotics Developers This file is part of DQ Robotics. @@ -17,9 +17,11 @@ This file is part of DQ Robotics. along with DQ Robotics. If not, see . Contributors: -- Murilo M. Marinho (murilomarinho@ieee.org) -- Mateus Rodrigues Martins (martinsrmateus@gmail.com) -- Juan Jose Quiroz Omana (juanjqo@g.ecc.u-tokyo.ac.jp) +1. Murilo M. Marinho (murilomarinho@ieee.org) +2. Mateus Rodrigues Martins (martinsrmateus@gmail.com) + +3. Juan Jose Quiroz Omana (juanjqogm@gmail.com) + - Added the enum class DQ_ParameterDH */ #include From 79b371cec5fb614680f45d730d3c3c054aaf9bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 16:05:37 +0100 Subject: [PATCH 08/15] [DQ_Kinematics] Removed all modifications in this class --- include/dqrobotics/robot_modeling/DQ_Kinematics.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/dqrobotics/robot_modeling/DQ_Kinematics.h b/include/dqrobotics/robot_modeling/DQ_Kinematics.h index c7fbd40..fbd52b3 100644 --- a/include/dqrobotics/robot_modeling/DQ_Kinematics.h +++ b/include/dqrobotics/robot_modeling/DQ_Kinematics.h @@ -1,5 +1,5 @@ /** -(C) Copyright 2011-2025 DQ Robotics Developers +(C) Copyright 2019 DQ Robotics Developers This file is part of DQ Robotics. @@ -17,8 +17,7 @@ This file is part of DQ Robotics. along with DQ Robotics. If not, see . Contributors: -1. Murilo M. Marinho (murilomarinho@ieee.org) - - Responsible for the original implementation. +- Murilo M. Marinho (murilomarinho@ieee.org) */ #ifndef DQ_ROBOT_MODELLING_DQ_KINEMATICS_H From 3f864365be57f0003a9a22d2b7a4fe0607150136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 16:07:12 +0100 Subject: [PATCH 09/15] [DQ_Kinematics.pp] Removed all modifications in this class --- src/robot_modeling/DQ_Kinematics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/robot_modeling/DQ_Kinematics.cpp b/src/robot_modeling/DQ_Kinematics.cpp index 8654b0b..8a38b59 100644 --- a/src/robot_modeling/DQ_Kinematics.cpp +++ b/src/robot_modeling/DQ_Kinematics.cpp @@ -1,5 +1,5 @@ /** -(C) Copyright 2011-2025 DQ Robotics Developers +(C) Copyright 2019-2020 DQ Robotics Developers This file is part of DQ Robotics. From e76d0fe2596177305923cb6e1af1ce2df091d958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 21:19:16 +0100 Subject: [PATCH 10/15] [DQ_ParameterDH.h] Added a new enum class for the DH parameters --- .../robot_modeling/DQ_ParameterDH.h | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 include/dqrobotics/robot_modeling/DQ_ParameterDH.h diff --git a/include/dqrobotics/robot_modeling/DQ_ParameterDH.h b/include/dqrobotics/robot_modeling/DQ_ParameterDH.h new file mode 100644 index 0000000..2d77641 --- /dev/null +++ b/include/dqrobotics/robot_modeling/DQ_ParameterDH.h @@ -0,0 +1,37 @@ +/** +(C) Copyright 2011-2025 DQ Robotics Developers + +This file is part of DQ Robotics. + + DQ Robotics is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + DQ Robotics is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with DQ Robotics. If not, see . + +Contributors: +1. Juan Jose Quiroz Omana (juanjose.quirozomana@manchester.ac.uk) + - Responsible for the original implementation. +*/ + +#pragma once + +namespace DQ_robotics +{ +enum class DQ_ParameterDH +{ + THETA, + D, + A, + ALPHA +}; +} + + From 2beff91b7c5efa66eeee64182336535d75a35cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 21:23:04 +0100 Subject: [PATCH 11/15] [DQ_SerialManipulator.{h,cpp}] Removed the nested enum class related to the DH parameters. This class is now a standalone class. --- include/dqrobotics/robot_modeling/DQ_SerialManipulator.h | 5 ----- src/robot_modeling/DQ_SerialManipulator.cpp | 3 --- 2 files changed, 8 deletions(-) diff --git a/include/dqrobotics/robot_modeling/DQ_SerialManipulator.h b/include/dqrobotics/robot_modeling/DQ_SerialManipulator.h index 4835393..0f577ea 100644 --- a/include/dqrobotics/robot_modeling/DQ_SerialManipulator.h +++ b/include/dqrobotics/robot_modeling/DQ_SerialManipulator.h @@ -20,9 +20,6 @@ This file is part of DQ Robotics. Contributors: 1. Murilo M. Marinho (murilomarinho@ieee.org) 2. Mateus Rodrigues Martins (martinsrmateus@gmail.com) - -3. Juan Jose Quiroz Omana (juanjqogm@gmail.com) - - Added the enum class DQ_ParameterDH */ #include @@ -32,8 +29,6 @@ namespace DQ_robotics class DQ_SerialManipulator: public DQ_Kinematics { -public: - enum class DQ_ParameterDH{THETA, D, A, ALPHA}; protected: DQ curr_effector_; diff --git a/src/robot_modeling/DQ_SerialManipulator.cpp b/src/robot_modeling/DQ_SerialManipulator.cpp index ec685b1..cc2192a 100644 --- a/src/robot_modeling/DQ_SerialManipulator.cpp +++ b/src/robot_modeling/DQ_SerialManipulator.cpp @@ -19,9 +19,6 @@ This file is part of DQ Robotics. Contributors: 1. Murilo M. Marinho (murilomarinho@ieee.org) 2. Mateus Rodrigues Martins (martinsrmateus@gmail.com) - -3. Juan Jose Quiroz Omana (juanjqogm@gmail.com) - - Added the enum class DQ_ParameterDH */ #include From ac2ea289abeefabaea848d07f2244f9a9a6aa1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 21:23:55 +0100 Subject: [PATCH 12/15] [DQ_SerialManipulator{DH,MDH}.h] Added the DQ_ParameterDH class in the header. --- include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h | 1 + include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h | 1 + 2 files changed, 2 insertions(+) diff --git a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h index ab60cab..09964cf 100644 --- a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h +++ b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorDH.h @@ -27,6 +27,7 @@ This file is part of DQ Robotics. #include +#include namespace DQ_robotics { diff --git a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h index ec969b3..3795ecd 100644 --- a/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h +++ b/include/dqrobotics/robot_modeling/DQ_SerialManipulatorMDH.h @@ -26,6 +26,7 @@ This file is part of DQ Robotics. */ #include +#include namespace DQ_robotics { From d28eb64114f391ee5a063e982c984beaad6e02d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Thu, 8 May 2025 22:01:20 +0100 Subject: [PATCH 13/15] [DQ_SerialManipulatorDH,MDH.cpp] Added the default case in the get_parameter and get_parameters methods to check if this fixes the compilation on Ubuntu. --- src/robot_modeling/DQ_SerialManipulatorDH.cpp | 4 ++++ src/robot_modeling/DQ_SerialManipulatorMDH.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/robot_modeling/DQ_SerialManipulatorDH.cpp b/src/robot_modeling/DQ_SerialManipulatorDH.cpp index d4c9c78..6020509 100644 --- a/src/robot_modeling/DQ_SerialManipulatorDH.cpp +++ b/src/robot_modeling/DQ_SerialManipulatorDH.cpp @@ -118,6 +118,8 @@ VectorXd DQ_SerialManipulatorDH::get_parameters(const DQ_ParameterDH ¶meter_ return dh_matrix_.row(2); case DQ_ParameterDH::ALPHA: return dh_matrix_.row(3); + default: + throw std::runtime_error("Wrong type of parameter"); } } @@ -140,6 +142,8 @@ double DQ_SerialManipulatorDH::get_parameter(const DQ_ParameterDH ¶meter_typ return dh_matrix_(2, to_ith_link); case DQ_ParameterDH::ALPHA: return dh_matrix_(3, to_ith_link); + default: + throw std::runtime_error("Wrong type of parameter"); } } diff --git a/src/robot_modeling/DQ_SerialManipulatorMDH.cpp b/src/robot_modeling/DQ_SerialManipulatorMDH.cpp index 4d88561..3196355 100644 --- a/src/robot_modeling/DQ_SerialManipulatorMDH.cpp +++ b/src/robot_modeling/DQ_SerialManipulatorMDH.cpp @@ -129,6 +129,8 @@ VectorXd DQ_SerialManipulatorMDH::get_parameters(const DQ_ParameterDH ¶meter return mdh_matrix_.row(2); case DQ_ParameterDH::ALPHA: return mdh_matrix_.row(3); + default: + throw std::runtime_error("Wrong type of parameter"); } } @@ -151,6 +153,8 @@ double DQ_SerialManipulatorMDH::get_parameter(const DQ_ParameterDH ¶meter_ty return mdh_matrix_(2, to_ith_link); case DQ_ParameterDH::ALPHA: return mdh_matrix_(3, to_ith_link); + default: + throw std::runtime_error("Wrong type of parameter"); } } From 52f2691b37390d62ceb7d987a46ab1d645c6ac99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Mon, 12 May 2025 15:09:02 +0100 Subject: [PATCH 14/15] [DQ_ParameterDH.h] Modified the class to support string and char constructors, as discussed in #69. --- .../robot_modeling/DQ_ParameterDH.h | 57 +++++++++++++++++-- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/include/dqrobotics/robot_modeling/DQ_ParameterDH.h b/include/dqrobotics/robot_modeling/DQ_ParameterDH.h index 2d77641..a660493 100644 --- a/include/dqrobotics/robot_modeling/DQ_ParameterDH.h +++ b/include/dqrobotics/robot_modeling/DQ_ParameterDH.h @@ -21,16 +21,63 @@ This file is part of DQ Robotics. - Responsible for the original implementation. */ +#include +#include #pragma once namespace DQ_robotics { -enum class DQ_ParameterDH +class DQ_ParameterDH { - THETA, - D, - A, - ALPHA +public: + enum PARAMETER{ + THETA, + D, + A, + ALPHA + }; +private: + PARAMETER parameter_; + const std::unordered_map + map_ = {{"THETA", THETA}, + {"D" , D}, + {"A" , A}, + {"ALPHA", ALPHA}, + }; + + /** + * @brief _get_parameter sets the parameter member using a string as argument. + * @param parameter The desired parameter to be set. Example: "THETA", "D", "A", or "ALPHA". + */ + void _set_parameter(const std::string& parameter) + { + try { + parameter_ = map_.at(parameter); + } catch (...) { + throw std::runtime_error("The parameter \""+ parameter+ "\" is not supported. Use THETA, D, A, or ALPHA"); + } + } +public: + DQ_ParameterDH() = default; + DQ_ParameterDH(const PARAMETER& parameter): parameter_{parameter}{}; + + // This definition enables switch cases and comparisons. + constexpr operator PARAMETER() const { return parameter_; } + + // This constructor allows string parameters. This is done to keep the + // language compatibility between Matlab and Python/C++, as discussed in + //https://github.com/dqrobotics/cpp/pull/69 + DQ_ParameterDH(const std::string& parameter){ + _set_parameter(parameter); + } + + // This constructor allows char parameters. This is done to keep the + // language compatibility between Matlab and Python/C++, as discussed in + //https://github.com/dqrobotics/cpp/pull/69 + DQ_ParameterDH(const char* parameter_c){ + _set_parameter(parameter_c); + } + }; } From 512d9957677e0d89a3b469f17f184988fe5e37c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Quiroz=20Oma=C3=B1a?= Date: Tue, 13 May 2025 11:24:00 +0100 Subject: [PATCH 15/15] [DQ_ParameterDH.h] Updated the documentation of the class. --- .../robot_modeling/DQ_ParameterDH.h | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/include/dqrobotics/robot_modeling/DQ_ParameterDH.h b/include/dqrobotics/robot_modeling/DQ_ParameterDH.h index a660493..696a650 100644 --- a/include/dqrobotics/robot_modeling/DQ_ParameterDH.h +++ b/include/dqrobotics/robot_modeling/DQ_ParameterDH.h @@ -58,22 +58,39 @@ class DQ_ParameterDH } } public: + /** + * @brief DQ_ParameterDH Default constructor method. + */ DQ_ParameterDH() = default; + + /** + * @brief DQ_ParameterDH Constructor method + * @param parameter The desired DH parameter. Example: THETA, D, A, or ALPHA. + */ DQ_ParameterDH(const PARAMETER& parameter): parameter_{parameter}{}; // This definition enables switch cases and comparisons. constexpr operator PARAMETER() const { return parameter_; } - // This constructor allows string parameters. This is done to keep the - // language compatibility between Matlab and Python/C++, as discussed in - //https://github.com/dqrobotics/cpp/pull/69 + /** + * @brief DQ_ParameterDH Constructor method that allows string parameters. + * This is done to keep the language compatibility between + * Matlab and Python/C++, as discussed in + * https://github.com/dqrobotics/cpp/pull/69 + * @param parameter The desired DH parameter. Example: "THETA", "D", "A", or "ALPHA". + */ DQ_ParameterDH(const std::string& parameter){ _set_parameter(parameter); } - // This constructor allows char parameters. This is done to keep the - // language compatibility between Matlab and Python/C++, as discussed in - //https://github.com/dqrobotics/cpp/pull/69 + + /** + * @brief DQ_ParameterDH Constructor method that allows char parameters. + * This is done to keep the language compatibility between + * Matlab and Python/C++, as discussed in + * https://github.com/dqrobotics/cpp/pull/69 + * @param parameter_c The desired DH parameter. Example: "THETA", "D", "A", or "ALPHA". + */ DQ_ParameterDH(const char* parameter_c){ _set_parameter(parameter_c); }