Hello. We are of Barcelona and we are making a project of a system of wireless positioning based on Pleases Lab. We are inexperienced in this and we needed aid because the Java code of an application does not work to us, in concrete the PlacaLabExample. We have modified a little the code and we do not understand porqué does not work.... It would please us that the program recalculara the Access list points whenever one became disconnected or was connected and updated the position of the user to each change. If somebody has a solution, or can help us or has the same problem we would be thankful answered to us. Thank you very much!
This is the code:
package org.placelab.example;
import org.placelab.client.PlacelabWithProxy;
import org.placelab.client.tracker.Estimate;
import org.placelab.client.tracker.EstimateListener;
import org.placelab.client.tracker.Tracker;
import org.placelab.core.Coordinate;
import org.placelab.core.Measurement;
import org.placelab.core.BeaconMeasurement;
import org.placelab.spotter.LogSpotter;
import org.placelab.spotter.WiFiSpotter;
import org.placelab.mapper.CompoundMapper;
import org.placelab.mapper.Mapper;
import org.placelab.client.tracker.CentroidTracker;
/**
* This sample shows how to use the PlacelabWithProxy object to manage
* spotters and trackers for you.
*/
public class PlaceLabExample implements EstimateListener {
Estimate lastEstimate=null;
WiFiSpotter wifispotter = null;
PlacelabWithProxy placelab;
Mapper mapper;
CentroidTracker tracker;
public PlaceLabExample() {
mapper = CompoundMapper.createDefaultMapper(true, true);
tracker = new CentroidTracker(mapper);
wifispotter = new WiFiSpotter();
wifispotter.addListener(tracker);
try {
// Create a placelab (with an explicit log spotter)
placelab = new PlacelabWithProxy(wifispotter,
tracker,
mapper,
2000 // poll spotter every 2s
);
placelab.addEstimateListener(this);
placelab.createProxy();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
new PlaceLabExample();
}
public void estimateUpdated(Tracker t, Estimate e, Measurement m) {
System.out.println("Estimated position: " + e.getCoord());
System.out.println("Num: " + ((BeaconMeasurement)m).numberOfReadings());
lastEstimate = e;
}
}