added new sanity checks and compile-time assertions to prevent errors
fixed stair-building issue new test-cases added elevator support fixed/improved some walker modules
This commit is contained in:
@@ -4,10 +4,52 @@
|
||||
#include "WalkModule.h"
|
||||
#include "WalkStateHeading.h"
|
||||
|
||||
#include "../../../../Assertions.h"
|
||||
|
||||
#include "../../../../geo/Heading.h"
|
||||
#include "../../../../math/Distributions.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) {;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** keep the state's heading */
|
||||
template <typename Node, typename WalkState> class WalkModuleHeading : public WalkModule<Node, WalkState> {
|
||||
|
||||
@@ -23,7 +65,10 @@ public:
|
||||
|
||||
/** ctor */
|
||||
WalkModuleHeading() : dist(Distribution::VonMises<double>(0.0f, 1.0f).getLUT()), draw(dist.getDrawList()) {
|
||||
;
|
||||
|
||||
// ensure the template WalkState inherits from 'WalkStateHeading'!
|
||||
StaticAssert::AinheritsB<WalkState, WalkStateHeading>();
|
||||
|
||||
}
|
||||
|
||||
virtual void updateBefore(WalkState& state) override {
|
||||
|
||||
Reference in New Issue
Block a user