[Fawkes Git] branch/tneumann/angle_distance_fix: created (0.5.0-3081-g3e6dc9b)

Tobias Neumann tobias.neumann at alumni.fh-aachen.de
Tue Feb 9 18:32:18 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, tneumann/angle_distance_fix has been created
        at  3e6dc9b4ae238afffd4ba42684802b4534a8e97a (commit)

http://git.fawkesrobotics.org/fawkes.git/tneumann/angle_distance_fix

- *Log* ---------------------------------------------------------------
commit 3e6dc9b4ae238afffd4ba42684802b4534a8e97a
Author:     Tobias Neumann <t.neumann at fh-aachen.de>
AuthorDate: Tue Feb 9 18:29:09 2016 +0100
Commit:     Tobias Neumann <t.neumann at fh-aachen.de>
CommitDate: Tue Feb 9 18:29:09 2016 +0100

    math/angle: fixed angle_distance
    
    the calculation was not correct. This is the code of the corresponding
    lua function.

http://git.fawkesrobotics.org/fawkes.git/commit/3e6dc9b
http://trac.fawkesrobotics.org/changeset/3e6dc9b

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------


- *Diffs* -------------------------------------------------------------

- *commit* 3e6dc9b4ae238afffd4ba42684802b4534a8e97a - - - - - - - - - -
Author:  Tobias Neumann <t.neumann at fh-aachen.de>
Date:    Tue Feb 9 18:29:09 2016 +0100
Subject: math/angle: fixed angle_distance

 src/libs/utils/math/angle.h |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/utils/math/angle.h b/src/libs/utils/math/angle.h
index b1420ab..059caa4 100644
--- a/src/libs/utils/math/angle.h
+++ b/src/libs/utils/math/angle.h
@@ -130,7 +130,19 @@ inline float
 angle_distance(float angle_rad1,
 	       float angle_rad2)
 {
-  return normalize_mirror_rad(angle_rad2 - angle_rad1);
+  if (angle_rad2 > angle_rad1) {
+    if (angle_rad2 - angle_rad1 < M_PI) {
+      return angle_rad2 - angle_rad1;
+    } else {
+      return - 2.0 * M_PI + angle_rad2 - angle_rad1;
+    }
+  } else {
+    if (angle_rad1 - angle_rad2 < M_PI) {
+      return angle_rad2 - angle_rad1;
+    } else {
+      return 2.0 * M_PI - angle_rad1 + angle_rad2;
+    }
+  }
 }
 
 




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list