many changes and updates
- changed the wifi-estimation api - adjusted test-cases - worked on grid-bulding and grid-importance - new walking modules - fixed some minor issues
This commit is contained in:
@@ -24,9 +24,10 @@
|
||||
#include <KLib/misc/gnuplot/GnuplotPlotElementLines.h>
|
||||
|
||||
|
||||
struct MyNode : public GridPoint, public GridNode, public GridNodeImportance, public WiFiGridNode<10> {
|
||||
MyNode() {;}
|
||||
MyNode(const int x, const int y, const int z) : GridPoint(x,y,z) {;}
|
||||
// ENSURE UNIQUE CLASS NAME
|
||||
struct MyNode1239 : public GridPoint, public GridNode, public GridNodeImportance, public WiFiGridNode<10> {
|
||||
MyNode1239() {;}
|
||||
MyNode1239(const int x, const int y, const int z) : GridPoint(x,y,z) {;}
|
||||
static void staticDeserialize(std::istream& inp) {
|
||||
WiFiGridNode::staticDeserialize(inp);
|
||||
}
|
||||
@@ -36,16 +37,17 @@ struct MyNode : public GridPoint, public GridNode, public GridNodeImportance, pu
|
||||
}
|
||||
};
|
||||
|
||||
struct MyState : public WalkState, public WalkStateHeading {
|
||||
MyState(const GridPoint& pos, const Heading head) : WalkState(pos), WalkStateHeading(head) {;}
|
||||
// ENSURE UNIQUE CLASS NAME
|
||||
struct MyState23452 : public WalkState, public WalkStateHeading {
|
||||
MyState23452(const GridPoint& pos, const Heading head) : WalkState(pos), WalkStateHeading(head) {;}
|
||||
};
|
||||
|
||||
|
||||
TEST(GridWalk2, error) {
|
||||
TEST(GridWalk2, LIVE_error) {
|
||||
|
||||
|
||||
Grid<MyNode> grid(20);
|
||||
GridFactory<MyNode> gf(grid);
|
||||
Grid<MyNode1239> grid(20);
|
||||
GridFactory<MyNode1239> gf(grid);
|
||||
|
||||
Floorplan::Floor floor;
|
||||
Floorplan::FloorOutlinePolygon poly;
|
||||
@@ -61,13 +63,13 @@ TEST(GridWalk2, error) {
|
||||
float turnAngle = 0; // keep the angle as-is!
|
||||
} ctrl;
|
||||
|
||||
GridWalker<MyNode, MyState> walker;
|
||||
WalkModuleHeadingControl<MyNode, MyState, Control> modHead(&ctrl);
|
||||
GridWalker<MyNode1239, MyState23452> walker;
|
||||
WalkModuleHeadingControl<MyNode1239, MyState23452, Control> modHead(&ctrl);
|
||||
|
||||
walker.addModule(&modHead);
|
||||
|
||||
|
||||
MyState state(GridPoint(800,800,0), Heading(3.1415/2));
|
||||
MyState23452 state(GridPoint(800,800,0), Heading(3.1415/2));
|
||||
|
||||
K::Gnuplot gp;
|
||||
gp << "set xrange[0:5000]\n";
|
||||
@@ -98,9 +100,9 @@ TEST(GridWalk2, error) {
|
||||
}
|
||||
|
||||
|
||||
TEST(GgridWalk2, walkHeading) {
|
||||
TEST(GgridWalk2, LIVE_walkHeading) {
|
||||
|
||||
Grid<MyNode> grid(20);
|
||||
Grid<MyNode1239> grid(20);
|
||||
std::ifstream inp("/tmp/grid.dat");
|
||||
grid.read(inp);
|
||||
|
||||
@@ -118,9 +120,9 @@ TEST(GgridWalk2, walkHeading) {
|
||||
// GridFactory<MyNode> fac(grid);
|
||||
// fac.addFloor(&floor);
|
||||
|
||||
GridWalker<MyNode, MyState> walker;
|
||||
WalkModuleHeading<MyNode, MyState> wmHead;
|
||||
WalkModuleFollowDestination<MyNode, MyState> wmDest(grid, grid.getNodeFor(GridPoint(7200,4800,400+340+340)));
|
||||
GridWalker<MyNode1239, MyState23452> walker;
|
||||
WalkModuleHeading<MyNode1239, MyState23452> wmHead;
|
||||
WalkModuleFollowDestination<MyNode1239, MyState23452> wmDest(grid, grid.getNodeFor(GridPoint(7200,4800,400+340+340)));
|
||||
//walker.addModule(&wmHead);
|
||||
walker.addModule(&wmDest);
|
||||
|
||||
@@ -132,7 +134,7 @@ TEST(GgridWalk2, walkHeading) {
|
||||
K::GnuplotSplotElementPoints nodes; nodes.setPointSize(0.1); nodes.setColorHex("#888888"); splot.add(&nodes);
|
||||
K::GnuplotSplotElementPoints states; states.setPointSize(0.5); states.setColorHex("#0000ff"); splot.add(&states);
|
||||
|
||||
for (const MyNode& n : grid) {
|
||||
for (const MyNode1239& n : grid) {
|
||||
static int cnt = 0;
|
||||
if (++cnt % 5 == 0) {
|
||||
nodes.add(K::GnuplotPoint3(n.x_cm, n.y_cm, n.z_cm));
|
||||
@@ -143,8 +145,8 @@ TEST(GgridWalk2, walkHeading) {
|
||||
for (int j = 0; j < 500; ++j) {
|
||||
states.clear();
|
||||
for (int i = 0; i < points.size(); ++i) {
|
||||
MyState start(points[i], Heading(0.0));
|
||||
MyState next = walker.getDestination(grid, start, 2.0);
|
||||
MyState23452 start(points[i], Heading(0.0));
|
||||
MyState23452 next = walker.getDestination(grid, start, 2.0);
|
||||
points[i] = next.startPos;
|
||||
states.add(K::GnuplotPoint3(points[i].x_cm, points[i].y_cm, points[i].z_cm));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user