Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
.cxx
local.properties
/.idea/
secrets.properties
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,19 @@ private List<FloorShapes> parseMapShapes(String mapShapesJson) {
while (it.hasNext()) {
keys.add(it.next());
}
Collections.sort(keys);
//Collections.sort(keys);
List<String> Keys = new ArrayList<>();
String[] physicalOrder = {"LG", "GF", "F1", "F2", "F3"};
for (String pKey : physicalOrder) {
if (root.has(pKey)) {
Keys.add(pKey);
}
}
Iterator<String> allKeys = root.keys();
while (allKeys.hasNext()) {
String k = allKeys.next();
if (!Keys.contains(k)) Keys.add(k);
}

for (String key : keys) {
JSONObject floorCollection = root.getJSONObject(key);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.openpositioning.PositionMe.fusion;

public class MapBounds {
public final float minX;
public final float maxX;
public final float minY;
public final float maxY;

public MapBounds(float minX, float maxX, float minY, float maxY) {
this.minX = minX;
this.maxX = maxX;
this.minY = minY;
this.maxY = maxY;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.openpositioning.PositionMe.fusion;

/** Represents a position measurement with an accuracy estimate. */
public class Measurement {
public final float x;
public final float y;
public final double accuracy;

public Measurement(float x, float y, double accuracy) {
this.x = x;
this.y = y;
this.accuracy = accuracy;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.openpositioning.PositionMe.fusion;

/** Represents a planar PDR displacement for a single update step. */
public class PDRMovement {
public final float deltaX;
public final float deltaY;

public PDRMovement(float deltaX, float deltaY) {
this.deltaX = deltaX;
this.deltaY = deltaY;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.openpositioning.PositionMe.fusion;

import java.util.Random;

/** Represents a single particle in the particle filter. */
public class Particle {
float x;
float y;
public float oldX;
public float oldY;
int floor;
double weight;

/**
* Creates a particle with an initial position and floor.
*
* @param x initial x coordinate in meters
* @param y initial y coordinate in meters
* @param floor initial floor index
*/
public Particle(float x, float y, int floor) {
this.x = x;
this.y = y;
this.oldX = x;
this.oldY = y;
this.floor = floor;
this.weight = 1.0;
}

/**
* Moves the particle using the default motion noise.
*
* @param deltaX movement along the x axis in meters
* @param deltaY movement along the y axis in meters
* @param random random source used to sample motion noise
*/
public void move(float deltaX, float deltaY, Random random) {
move(deltaX, deltaY, random, 0.03f);
}

/**
* Moves the particle and adds Gaussian motion noise.
*
* @param deltaX movement along the x axis in meters
* @param deltaY movement along the y axis in meters
* @param random random source used to sample motion noise
* @param noiseStdDev standard deviation of the motion noise in meters
*/
public void move(float deltaX, float deltaY, Random random, float noiseStdDev) {
this.oldX = this.x;
this.oldY = this.y;
this.x += deltaX;
this.y += deltaY;
this.x += random.nextGaussian() * noiseStdDev;
this.y += random.nextGaussian() * noiseStdDev;
}
}
Loading