From 6ea294ace26ec29cc321e4f1a5b1f418f0c11b77 Mon Sep 17 00:00:00 2001
From: Patrick Dormanns <patrick.dormanns@student.kit.edu>
Date: Sun, 25 Feb 2024 23:31:25 +0100
Subject: [PATCH] code quality

---
 .../armarx/control/pointing/core/Pointing.cpp | 10 +++---
 .../armarx/control/pointing/core/Pointing.h   | 35 ++++++++++---------
 .../control/pointing/skills/PointAt.cpp       |  4 +--
 .../armarx/control/pointing/skills/PointAt.h  |  5 +++
 4 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/source/armarx/control/pointing/core/Pointing.cpp b/source/armarx/control/pointing/core/Pointing.cpp
index d39ff8b9..2cf69328 100644
--- a/source/armarx/control/pointing/core/Pointing.cpp
+++ b/source/armarx/control/pointing/core/Pointing.cpp
@@ -64,7 +64,7 @@ namespace armarx::control::pointing::core
         if (not robot)
         {
             ARMARX_ERROR << "Could not get synchronized robot '" << remote_.robotName << "'";
-            throw PointingFailedException();
+            throw armarx::exceptions::local::PointingFailedException();
         }
         return robot;
     }
@@ -96,12 +96,12 @@ namespace armarx::control::pointing::core
             if (ik.optimize() < 1e-6)
             {
                 ARMARX_WARNING << "PointingIK didn't find a solution";
-                throw PointingFailedException();
+                throw armarx::exceptions::local::PointingFailedException();
             }
             if (aborted)
             {
                 ARMARX_INFO << "Pointing aborted.";
-                throw PointingAbortedException();
+                throw armarx::exceptions::local::PointingAbortedException();
             }
         } while (not ik.isTargetReached());
 
@@ -160,7 +160,7 @@ namespace armarx::control::pointing::core
             {
                 ARMARX_INFO << "Pointing aborted. Stopping trajectory";
                 remote_.trajectoryPlayer->stopTrajectoryPlayer();
-                throw PointingAbortedException();
+                throw armarx::exceptions::local::PointingAbortedException();
             }
             clock.waitFor(Duration::MilliSeconds(10));
         }
@@ -179,7 +179,7 @@ namespace armarx::control::pointing::core
         if (not shape)
         {
             ARMARX_ERROR << "Hand '" << eefName << "' has no shape '" << shape << "'";
-            throw PointingFailedException();
+            throw armarx::exceptions::local::PointingFailedException();
         }
         return shape->getRobotNodeJointValueMap();
     }
diff --git a/source/armarx/control/pointing/core/Pointing.h b/source/armarx/control/pointing/core/Pointing.h
index bd03e63a..0de3de67 100644
--- a/source/armarx/control/pointing/core/Pointing.h
+++ b/source/armarx/control/pointing/core/Pointing.h
@@ -10,6 +10,21 @@
 
 #include "Side.h"
 
+namespace armarx::exceptions::local
+{
+    class PointingException : public armarx::LocalException
+    {
+    };
+
+    class PointingFailedException : public PointingException
+    {
+    };
+
+    class PointingAbortedException : public PointingException
+    {
+    };
+} // namespace armarx::exceptions::local
+
 namespace armarx::control::pointing::core
 {
 
@@ -50,19 +65,6 @@ namespace armarx::control::pointing::core
             double maxAcceleration;
         };
 
-        class PointingException : public std::exception
-        {
-        };
-
-        class PointingFailedException : public PointingException
-        {
-        };
-
-        class PointingAbortedException : public PointingException
-        {
-        };
-
-
     public:
         Pointing(const Remote& remote);
 
@@ -74,9 +76,10 @@ namespace armarx::control::pointing::core
          *
          * @param params Parameterization of the pointing gesture.
          *
-         * @throws PointingFailedException Thrown if the pointing gesture could not be executed.
-         * @throws Thrown when the execution is aborted with @ref abort before reaching the target
-         *         configuration.
+         * @throws armarx::exceptions::local::PointingFailedException Thrown if the pointing gesture
+         *         could not be executed.
+         * @throws armarx::exceptions::local::PointingAbortedException Thrown when the execution is
+         *         aborted with @ref abort() before reaching the target configuration.
          */
         void execute(const Parameters params);
 
diff --git a/source/armarx/control/pointing/skills/PointAt.cpp b/source/armarx/control/pointing/skills/PointAt.cpp
index fbe895cf..b10fa328 100644
--- a/source/armarx/control/pointing/skills/PointAt.cpp
+++ b/source/armarx/control/pointing/skills/PointAt.cpp
@@ -37,11 +37,11 @@ namespace armarx::control::pointing::skills
         {
             impl_->execute(parameters);
         }
-        catch (core::Pointing::PointingFailedException&)
+        catch (armarx::exceptions::local::PointingFailedException&)
         {
             return MakeFailedResult();
         }
-        catch (core::Pointing::PointingAbortedException&)
+        catch (armarx::exceptions::local::PointingAbortedException&)
         {
             return MakeAbortedResult();
         }
diff --git a/source/armarx/control/pointing/skills/PointAt.h b/source/armarx/control/pointing/skills/PointAt.h
index ff3655fd..3e52906b 100644
--- a/source/armarx/control/pointing/skills/PointAt.h
+++ b/source/armarx/control/pointing/skills/PointAt.h
@@ -7,6 +7,11 @@
 
 namespace armarx::control::pointing::skills
 {
+    /**
+     * @brief Implementation of the PointAt-skill
+     *
+     * @ingroup Library-pointing
+     */
     class PointAt : public armarx::skills::SimpleSpecializedSkill<arondto::PointAtParams>
     {
     public:
-- 
GitLab