diff --git a/geo/Heading.h b/geo/Heading.h index 172e124..ca2c293 100644 --- a/geo/Heading.h +++ b/geo/Heading.h @@ -64,13 +64,13 @@ public: float getRAD() const {return rad;} - /** get a random heading */ - static Heading rnd() { - static std::minstd_rand gen(1234); - static std::uniform_real_distribution dist(0, _2PI); - const float rnd = dist(gen); - return Heading(rnd); - } +// /** get a random heading */ +// static Heading rnd() { +// static std::minstd_rand gen(1234); +// static std::uniform_real_distribution dist(0, _2PI); +// const float rnd = dist(gen); +// return Heading(rnd); +// } #undef _2PI diff --git a/grid/walk/GridWalkPathControl.h b/grid/walk/GridWalkPathControl.h index afae95c..7701af6 100644 --- a/grid/walk/GridWalkPathControl.h +++ b/grid/walk/GridWalkPathControl.h @@ -61,18 +61,22 @@ public: } + Distribution::Normal dHead = Distribution::Normal(1, 0.01); + Distribution::Normal dWalk = Distribution::Normal(1, 0.10); + Distribution::Normal sWalk = Distribution::Normal(0, 0.15); + GridWalkState getDestination(Grid& grid, const GridWalkState& start, float distance_m, float headChange_rad, Activity act) { // proportional change of the heading - static Distribution::Normal dHead(1, 0.01); + //static Distribution::Normal dHead(1, 0.01); // proportional change of the to-be-walked distance - static Distribution::Normal dWalk(1, 0.10); + //static Distribution::Normal dWalk(1, 0.10); distance_m = distance_m*dWalk.draw()*1.4; // TODO: why *2? headChange_rad = headChange_rad*dHead.draw(); - static Distribution::Normal sWalk(0, 0.15); + //static Distribution::Normal sWalk(0, 0.15); if (distance_m == 0) { distance_m = std::abs( sWalk.draw() ); } return walk(grid, start, distance_m, headChange_rad, act); @@ -114,12 +118,14 @@ private: } + Distribution::Uniform dChange = Distribution::Uniform(Angle::degToRad(0), +Angle::degToRad(359)); + GridWalkState walk(Grid& grid, const GridWalkState& start, const float distance_m, const float headChange_rad, Activity act) { // try-again distribution //static Distribution::Normal dHead(0, Angle::degToRad(10)); //static Distribution::Normal dUpdate(0, Angle::degToRad(3)); - static Distribution::Uniform dChange(Angle::degToRad(0), +Angle::degToRad(359)); + // static Distribution::Uniform dChange(Angle::degToRad(0), +Angle::degToRad(359)); int retries = 5; float walked_m = 0; diff --git a/grid/walk/GridWalkSimpleControl.h b/grid/walk/GridWalkSimpleControl.h index d5911ab..f736561 100644 --- a/grid/walk/GridWalkSimpleControl.h +++ b/grid/walk/GridWalkSimpleControl.h @@ -39,20 +39,22 @@ public: gen.seed(1234); } - + Distribution::Normal dHead = Distribution::Normal(1, 0.01); + Distribution::Normal dWalk = Distribution::Normal(1, 0.10); + Distribution::Normal sWalk = Distribution::Normal(0, 0.10); GridWalkState getDestination(Grid& grid, const GridWalkState& start, float distance_m, float headChange_rad, Activity act) { // proportional change of the heading - static Distribution::Normal dHead(1, 0.01); + // proportional change of the to-be-walked distance - static Distribution::Normal dWalk(1, 0.10); + //static Distribution::Normal dWalk(1, 0.10); distance_m = distance_m*dWalk.draw()*1.4; // TODO: why * X? headChange_rad = headChange_rad*dHead.draw(); - static Distribution::Normal sWalk(0, 0.10); + //static Distribution::Normal sWalk(0, 0.10); if (distance_m == 0) { distance_m = std::abs( sWalk.draw() ); } return walk(grid, start, distance_m, headChange_rad); @@ -90,12 +92,14 @@ private: } + Distribution::Uniform dChange = Distribution::Uniform(Angle::degToRad(0), +Angle::degToRad(359)); + GridWalkState walk(Grid& grid, const GridWalkState& start, const float distance_m, const float headChange_rad) { // try-again distribution //static Distribution::Normal dHead(0, Angle::degToRad(10)); //static Distribution::Normal dUpdate(0, Angle::degToRad(3)); - static Distribution::Uniform dChange(Angle::degToRad(0), +Angle::degToRad(359)); + // static Distribution::Uniform dChange(Angle::degToRad(0), +Angle::degToRad(359)); int retries = 5; float walked_m = 0; diff --git a/math/Interpolator.h b/math/Interpolator.h index 765a196..55ef39f 100644 --- a/math/Interpolator.h +++ b/math/Interpolator.h @@ -34,6 +34,12 @@ public: entries.push_back(InterpolatorEntry(key, value)); } + /** get the smallest added key */ + Key getMinKey() const {return entries.front().key;} + + /** get the largest added key */ + Key getMaxKey() const {return entries.back().key;} + /** get the interpolated value for the given key */ Value get(const Key key) const {