From a7cec2e9464c6ee74ed9a830d4fa8b15d376c747 Mon Sep 17 00:00:00 2001 From: FrankE Date: Tue, 13 Sep 2016 15:41:06 +0200 Subject: [PATCH] fixed compile issue --- grid/walk/v2/modules/WalkModuleHeading.h | 35 ------------------ .../v2/modules/WalkModuleHeadingControl.h | 5 ++- grid/walk/v2/modules/WalkStateHeading.h | 37 +++++++++++++++++++ tests/grid/TestStairs.cpp | 4 +- 4 files changed, 43 insertions(+), 38 deletions(-) diff --git a/grid/walk/v2/modules/WalkModuleHeading.h b/grid/walk/v2/modules/WalkModuleHeading.h index 827200c..02e6453 100644 --- a/grid/walk/v2/modules/WalkModuleHeading.h +++ b/grid/walk/v2/modules/WalkModuleHeading.h @@ -12,41 +12,6 @@ #include "../../../../geo/Heading.h" -/** - * base-class e.g. needed for GridWalkHeading and GridWalkHeadingControl to work - */ -struct WalkStateHeading { - - /** used for better naming: heading.error instead of headingError */ - struct _Heading { - - /** - * the direction [0:2pi] the walk should move to - * e.g. indiciated by: - * compass - * integration over gyroscope values - */ - Heading direction; - - /** - * (cumulative) error between walked edges and requested direction (above). - * is used to ensure that (even though the grid contains only 45° edges) we - * approximately walk into the requested direction. - */ - float error = 0; - - /** ctor */ - _Heading(const Heading direction, const float error) : direction(direction), error(error) {;} - - } heading; - - - - - /** ctor */ - explicit WalkStateHeading(const Heading& direction, const float error) : heading(direction, error) {;} - -}; diff --git a/grid/walk/v2/modules/WalkModuleHeadingControl.h b/grid/walk/v2/modules/WalkModuleHeadingControl.h index 319d1b1..a5b804c 100644 --- a/grid/walk/v2/modules/WalkModuleHeadingControl.h +++ b/grid/walk/v2/modules/WalkModuleHeadingControl.h @@ -30,7 +30,10 @@ public: dist(Distribution::VonMises(0.0f, 2.0).getLUT()), distNoise(0, Angle::degToRad(sensorNoiseDegreesSigma)), ctrl(ctrl) { - ; + + // ensure the template WalkState inherits from 'WalkStateHeading'! + StaticAssert::AinheritsB(); + } diff --git a/grid/walk/v2/modules/WalkStateHeading.h b/grid/walk/v2/modules/WalkStateHeading.h index 12519bb..89a0e2d 100644 --- a/grid/walk/v2/modules/WalkStateHeading.h +++ b/grid/walk/v2/modules/WalkStateHeading.h @@ -1,6 +1,43 @@ #ifndef WALKSTATEHEADING_H #define WALKSTATEHEADING_H +#include "../../../../geo/Heading.h" + +/** + * base-class e.g. needed for GridWalkHeading and GridWalkHeadingControl to work + */ +struct WalkStateHeading { + + /** used for better naming: heading.error instead of headingError */ + struct _Heading { + + /** + * the direction [0:2pi] the walk should move to + * e.g. indiciated by: + * compass + * integration over gyroscope values + */ + Heading direction; + + /** + * (cumulative) error between walked edges and requested direction (above). + * is used to ensure that (even though the grid contains only 45° edges) we + * approximately walk into the requested direction. + */ + float error = 0; + + /** ctor */ + _Heading(const Heading direction, const float error) : direction(direction), error(error) {;} + + } heading; + + + + + /** ctor */ + explicit WalkStateHeading(const Heading& direction, const float error) : heading(direction, error) {;} + +}; diff --git a/tests/grid/TestStairs.cpp b/tests/grid/TestStairs.cpp index a727007..b65282c 100644 --- a/tests/grid/TestStairs.cpp +++ b/tests/grid/TestStairs.cpp @@ -65,13 +65,13 @@ TEST(Stairs, live_testWalk) { WalkModuleFavorZ modFavorZ; WalkModuleSpread modSpread; WalkModuleNodeImportance modImp; - WalkModulePreventVisited modSkipDup; + //WalkModulePreventVisited modSkipDup; //WalkModuleHeading modHead; gw.addModule(&modImp); gw.addModule(&modFavorZ); gw.addModule(&modSpread); - gw.addModule(&modSkipDup); + //gw.addModule(&modSkipDup); //gw.addModule(&modHead); for (int run = 0; run < 5000; ++run) {