├── location-service-library ├── .gitignore ├── lib │ └── .gitignore ├── src │ ├── META-INF │ │ ├── MANIFEST.MF │ │ └── services │ │ │ ├── hulo.localization.pf.Resampler │ │ │ ├── hulo.localization.likelihood.LikelihoodModel │ │ │ ├── hulo.localization.project.TestDataReader │ │ │ ├── hulo.localization.project.TrainDataReader │ │ │ ├── hulo.localization.models.sys.SystemModelFactory │ │ │ ├── hulo.localization.project.MapDataReader │ │ │ ├── hulo.localization.models.obs.ObservationModelFactory │ │ │ └── hulo.localization.beacon.BeaconFilter │ └── hulo │ │ └── localization │ │ ├── StateTransition.java │ │ ├── project │ │ ├── DataReader.java │ │ ├── MapDataReader.java │ │ ├── SampleVisualizer.java │ │ ├── TestDataReader.java │ │ ├── TrainData.java │ │ ├── TrainDataReader.java │ │ ├── TestData.java │ │ ├── MapData.java │ │ └── DataUnit.java │ │ ├── kernels │ │ ├── KernelFunction.java │ │ └── GaussianKernel.java │ │ ├── models │ │ ├── sys │ │ │ ├── PoseSystemModel.java │ │ │ ├── SystemModelFactory.java │ │ │ ├── SystemModelOnFloorsMap.java │ │ │ ├── SystemModelWithSensor.java │ │ │ ├── SystemModel.java │ │ │ └── RandomWalkerOnFloorsFree.java │ │ ├── obs │ │ │ ├── ObservationModelFactory.java │ │ │ ├── ObservationModelWithSensor.java │ │ │ ├── ObservationModel.java │ │ │ ├── GaussianProcessLDPLMeanModelFactory.java │ │ │ └── ParticleFilterModelFactory.java │ │ └── ModelFactory.java │ │ ├── LocalizationService.java │ │ ├── sensor │ │ ├── OrientationMeter.java │ │ ├── Pedometer.java │ │ ├── OrientationMeterRandom.java │ │ ├── PedometerRandom.java │ │ ├── OrientationMeterFactory.java │ │ ├── PedometerWalkingState.java │ │ └── PedometerDirect.java │ │ ├── pf │ │ ├── Resampler.java │ │ ├── ParticlePreprocessorFactory.java │ │ ├── ResamplerProvider.java │ │ ├── ParticlePreprocessor.java │ │ └── ParticlePreprocessorProvider.java │ │ ├── extention │ │ ├── PostProcessor.java │ │ ├── PostProcessorFactory.java │ │ └── PostProcessorProvider.java │ │ ├── map │ │ └── FloorModel.java │ │ ├── DataManager.java │ │ ├── likelihood │ │ ├── LikelihoodModel.java │ │ ├── NormalDist.java │ │ └── LikelihoodModelFactory.java │ │ ├── utils │ │ ├── RandomExtended.java │ │ ├── ListUtils.java │ │ ├── NumberUtils.java │ │ ├── StatUtils.java │ │ ├── JSONUtils.java │ │ └── ResourceUtils.java │ │ ├── beacon │ │ ├── BeaconFilter.java │ │ ├── AbstractBeaconFilter.java │ │ └── BeaconFilterFactory.java │ │ ├── thread │ │ └── ExecutorServiceHolder.java │ │ ├── State.java │ │ ├── synthe │ │ └── VirtualRoomMapDataReader.java │ │ └── data │ │ └── CSVUtils.java ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── com.ibm.ws.ast.st.migration.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── de.loskutov.anyedit.AnyEditTools.prefs │ └── org.eclipse.jdt.core.prefs ├── requirements.txt ├── .project └── .classpath ├── .gitignore ├── LocationTools ├── WebContent │ ├── WEB-INF │ │ ├── lib │ │ │ └── .gitignore │ │ ├── web.xml │ │ └── urlrewriterules.xml │ ├── META-INF │ │ └── MANIFEST.MF │ ├── images │ │ ├── blank.gif │ │ ├── loading.gif │ │ ├── marker.png │ │ ├── marker-blue.png │ │ ├── marker-gold.png │ │ └── marker-green.png │ ├── js │ │ ├── lib │ │ │ └── .gitignore │ │ ├── util.js │ │ └── list.js │ ├── css │ │ └── common.css │ ├── user_login.jsp │ ├── index.jsp │ └── user_password.jsp ├── .gitignore ├── .settings │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.jdt.apt.core.prefs │ ├── com.ibm.ws.ast.st.migration.prefs │ ├── com.ibm.etools.common.migration.prefs │ ├── org.eclipse.wst.common.project.facet.core.prefs.xml │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.jdt.core.prefs │ ├── .jsdtscope │ └── org.eclipse.wst.common.component ├── requirements.txt ├── .factorypath ├── download-lib.sh ├── src │ └── hulo │ │ ├── model │ │ └── utils │ │ │ └── EPSG-CRS-3857.txt │ │ ├── localization │ │ ├── utils │ │ │ ├── NumberUtils.java │ │ │ └── CloudUtils.java │ │ ├── State.java │ │ └── servlet │ │ │ └── JSONBodyHandler.java │ │ └── commons │ │ ├── bean │ │ └── DatabaseBean.java │ │ └── users │ │ └── UserDB.java ├── LICENSE ├── .project ├── .classpath ├── pom.xml └── README.md ├── LocationService ├── .gitignore ├── .settings │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── com.ibm.ws.ast.st.migration.prefs │ ├── org.eclipse.jdt.apt.core.prefs │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.jdt.core.prefs │ ├── .jsdtscope │ └── org.eclipse.wst.common.component ├── WebContent │ ├── META-INF │ │ └── MANIFEST.MF │ ├── js │ │ ├── lib │ │ │ └── .gitignore │ │ └── util.js │ ├── 2dMapData │ │ ├── jsoneditor.js.placeholder │ │ └── index.html │ ├── WEB-INF │ │ ├── ibm-web-ext.xml │ │ └── urlrewriterules.xml │ └── index.html ├── requirements.txt ├── .factorypath ├── resource │ └── hulo │ │ └── localization │ │ └── resource │ │ └── settings │ │ └── deployment.json ├── .classpath ├── .project └── src │ └── hulo │ └── localization │ └── servlet │ ├── DBServlet.java │ └── JSONBodyHandler.java ├── location-service-resource ├── .gitignore ├── .settings │ ├── org.eclipse.jdt.apt.core.prefs │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.common.component │ └── org.eclipse.jdt.core.prefs ├── projects │ └── hulo │ │ └── localization │ │ └── resource │ │ └── projects │ │ ├── example001 │ │ └── format.json │ │ └── example002 │ │ └── format.json ├── .factorypath ├── example │ ├── generatorSetting001.json │ └── generatorSetting002.json ├── .classpath ├── .project └── models │ └── hulo │ └── localization │ └── resource │ └── models │ ├── PF_PedoWKRW_GPLDPLMulti │ └── example001 │ │ └── model.json │ └── PF_PedoWKAttRW_GPLDPLMulti │ └── example001 │ └── model.json ├── LICENSE └── download-lib.sh /location-service-library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.jar 2 | /.project 3 | /.gitignore 4 | -------------------------------------------------------------------------------- /LocationTools/WebContent/WEB-INF/lib/.gitignore: -------------------------------------------------------------------------------- 1 | *.jar -------------------------------------------------------------------------------- /LocationService/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated 2 | /build 3 | -------------------------------------------------------------------------------- /LocationTools/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated 2 | /build 3 | /target/ 4 | -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /location-service-resource/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated 2 | /build 3 | -------------------------------------------------------------------------------- /LocationService/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /LocationTools/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | 3 | -------------------------------------------------------------------------------- /LocationService/WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | 3 | -------------------------------------------------------------------------------- /location-service-library/lib/.gitignore: -------------------------------------------------------------------------------- 1 | /commons-math3-3.3.jar 2 | /wink-1.4.jar 3 | -------------------------------------------------------------------------------- /location-service-library/src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /location-service-library/src/META-INF/services/hulo.localization.pf.Resampler: -------------------------------------------------------------------------------- 1 | hulo.localization.pf.GridResampler -------------------------------------------------------------------------------- /LocationService/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /LocationService/WebContent/js/lib/.gitignore: -------------------------------------------------------------------------------- 1 | /jquery 2 | /OpenLayers-2.13.1 3 | /DataTables-1.10.6 4 | /jquery-ui-1.11.4 5 | -------------------------------------------------------------------------------- /location-service-library/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /location-service-library/src/META-INF/services/hulo.localization.likelihood.LikelihoodModel: -------------------------------------------------------------------------------- 1 | hulo.localization.likelihood.NormalDist -------------------------------------------------------------------------------- /location-service-library/src/META-INF/services/hulo.localization.project.TestDataReader: -------------------------------------------------------------------------------- 1 | hulo.localization.project.TestDataReaderBase -------------------------------------------------------------------------------- /location-service-library/src/META-INF/services/hulo.localization.project.TrainDataReader: -------------------------------------------------------------------------------- 1 | hulo.localization.project.TrainDataReaderBase -------------------------------------------------------------------------------- /LocationTools/WebContent/images/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hulop/BLELocalization/HEAD/LocationTools/WebContent/images/blank.gif -------------------------------------------------------------------------------- /LocationTools/WebContent/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hulop/BLELocalization/HEAD/LocationTools/WebContent/images/loading.gif -------------------------------------------------------------------------------- /LocationTools/WebContent/images/marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hulop/BLELocalization/HEAD/LocationTools/WebContent/images/marker.png -------------------------------------------------------------------------------- /location-service-library/src/META-INF/services/hulo.localization.models.sys.SystemModelFactory: -------------------------------------------------------------------------------- 1 | hulo.localization.models.sys.RandomWalkerModelFactory -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /LocationTools/WebContent/images/marker-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hulop/BLELocalization/HEAD/LocationTools/WebContent/images/marker-blue.png -------------------------------------------------------------------------------- /LocationTools/WebContent/images/marker-gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hulop/BLELocalization/HEAD/LocationTools/WebContent/images/marker-gold.png -------------------------------------------------------------------------------- /LocationTools/WebContent/images/marker-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hulop/BLELocalization/HEAD/LocationTools/WebContent/images/marker-green.png -------------------------------------------------------------------------------- /LocationTools/WebContent/js/lib/.gitignore: -------------------------------------------------------------------------------- 1 | /jquery 2 | /OpenLayers-2.13.1 3 | /OpenLayers-4.6.4 4 | /DataTables-1.10.10 5 | /jquery-ui-1.11.4 6 | *.zip -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=true 3 | org.eclipse.jdt.apt.reconcileEnabled=true 4 | -------------------------------------------------------------------------------- /LocationService/.settings/com.ibm.ws.ast.st.migration.prefs: -------------------------------------------------------------------------------- 1 | #Wed Oct 07 22:49:22 JST 2015 2 | com.ibm.ws.ast.st.migration.lastKnownVersion=8.5 3 | eclipse.preferences.version=1 4 | -------------------------------------------------------------------------------- /LocationService/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=true 3 | org.eclipse.jdt.apt.reconcileEnabled=true 4 | -------------------------------------------------------------------------------- /LocationTools/.settings/com.ibm.ws.ast.st.migration.prefs: -------------------------------------------------------------------------------- 1 | #Wed Oct 07 22:49:22 JST 2015 2 | com.ibm.ws.ast.st.migration.lastKnownVersion=8.5 3 | eclipse.preferences.version=1 4 | -------------------------------------------------------------------------------- /LocationTools/.settings/com.ibm.etools.common.migration.prefs: -------------------------------------------------------------------------------- 1 | #Sat Mar 10 09:49:13 JST 2018 2 | eclipse.preferences.version=1 3 | com.ibm.etools.common.migration.lastKnownVersion=8.5 4 | -------------------------------------------------------------------------------- /location-service-library/src/META-INF/services/hulo.localization.project.MapDataReader: -------------------------------------------------------------------------------- 1 | hulo.localization.project.MapDataReaderBase 2 | hulo.localization.synthe.VirtualRoomMapDataReader -------------------------------------------------------------------------------- /location-service-library/.settings/com.ibm.ws.ast.st.migration.prefs: -------------------------------------------------------------------------------- 1 | #Wed Oct 07 22:49:22 JST 2015 2 | com.ibm.ws.ast.st.migration.lastKnownVersion=8.5 3 | eclipse.preferences.version=1 4 | -------------------------------------------------------------------------------- /location-service-resource/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=true 3 | org.eclipse.jdt.apt.reconcileEnabled=true 4 | -------------------------------------------------------------------------------- /location-service-library/src/META-INF/services/hulo.localization.models.obs.ObservationModelFactory: -------------------------------------------------------------------------------- 1 | hulo.localization.models.obs.ParticleFilterModelFactory 2 | hulo.localization.models.obs.GaussianProcessLDPLMeanModelFactory -------------------------------------------------------------------------------- /LocationService/WebContent/2dMapData/jsoneditor.js.placeholder: -------------------------------------------------------------------------------- 1 | Use json-editor library 2 | 3 | https://github.com/jdorn/json-editor 4 | 5 | copy jsoneditor.js file into here 6 | 7 | https://github.com/jdorn/json-editor/tree/master/dist -------------------------------------------------------------------------------- /location-service-library/src/META-INF/services/hulo.localization.beacon.BeaconFilter: -------------------------------------------------------------------------------- 1 | hulo.localization.beacon.AbstractBeaconFilter 2 | hulo.localization.beacon.ClosestBeaconFilter 3 | hulo.localization.beacon.NormedStrongestBeaconFilter -------------------------------------------------------------------------------- /location-service-library/requirements.txt: -------------------------------------------------------------------------------- 1 | Please put libraries as below. 2 | 3 | LocationService 4 | - WebContent 5 | - js 6 | - lib 7 | - jquery 8 | - OpenLayers-2.13.1 9 | 10 | location-service-library 11 | - lib 12 | - commons-math3-3.3.jar 13 | - wink-1.4.jar -------------------------------------------------------------------------------- /location-service-library/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /location-service-library/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /location-service-resource/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /LocationTools/requirements.txt: -------------------------------------------------------------------------------- 1 | Please put libraries as below. 2 | 3 | LocationTools 4 | - WebContent 5 | - js 6 | - lib 7 | - jquery 8 | - jquery-1.11.3.min.js 9 | - OpenLayers-2.13.1 10 | - jquery-ui-1.11.4 11 | - DataTables-1.10.10 12 | - WEB-INF 13 | - lib 14 | mongo-java-driver-2.12.0.jar 15 | 16 | location-service-library 17 | - lib 18 | - commons-math3-3.3.jar 19 | - wink-1.4.jar -------------------------------------------------------------------------------- /LocationService/requirements.txt: -------------------------------------------------------------------------------- 1 | Please put libraries as below. 2 | 3 | LocationService 4 | - WebContent 5 | - js 6 | - lib 7 | - jquery 8 | - jquery-1.11.2.min.js 9 | - OpenLayers-2.13.1 10 | - jquery-ui-1.11.4 11 | - DataTables-1.10.6 12 | - WEB-INF 13 | - lib 14 | mongo-java-driver-2.12.0.jar 15 | 16 | location-service-library 17 | - lib 18 | - commons-math3-3.3.jar 19 | - wink-1.4.jar -------------------------------------------------------------------------------- /location-service-resource/projects/hulo/localization/resource/projects/example001/format.json: -------------------------------------------------------------------------------- 1 | { 2 | "training":{ 3 | "readMethod":"readJSONSamples" 4 | }, 5 | "test":{ 6 | "readMethod":"readCSVWalkingSamples" 7 | }, 8 | "map":{ 9 | "beacons":{ 10 | "readMethod":"readMapBLEBeacons" 11 | } 12 | }, 13 | "information":{ 14 | "UUID":"00000000-0000-0000-0000-000000000000", 15 | "site_id":"SAMPLE_SYNTHETIC_PLACE" 16 | } 17 | } -------------------------------------------------------------------------------- /location-service-resource/projects/hulo/localization/resource/projects/example002/format.json: -------------------------------------------------------------------------------- 1 | { 2 | "training":{ 3 | "readMethod":"readJSONSamples" 4 | }, 5 | "test":{ 6 | "readMethod":"readCSVWalkingSamples" 7 | }, 8 | "map":{ 9 | "beacons":{ 10 | "readMethod":"readMapBLEBeacons" 11 | } 12 | }, 13 | "information":{ 14 | "UUID":"00000000-0000-0000-0000-000000000000", 15 | "site_id":"SAMPLE_SYNTHETIC_PLACE" 16 | } 17 | } -------------------------------------------------------------------------------- /LocationService/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /location-service-resource/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LocationService/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.processAnnotations=enabled 8 | org.eclipse.jdt.core.compiler.source=1.7 9 | -------------------------------------------------------------------------------- /location-service-resource/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 4 | org.eclipse.jdt.core.compiler.compliance=1.6 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.processAnnotations=enabled 8 | org.eclipse.jdt.core.compiler.source=1.6 9 | -------------------------------------------------------------------------------- /LocationService/WebContent/2dMapData/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 2D localizer data editor 6 | 7 | 8 | 9 |

2D localizer data editor

10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /LocationTools/.factorypath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /LocationService/.factorypath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /location-service-resource/.factorypath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /LocationService/resource/hulo/localization/resource/settings/deployment.json: -------------------------------------------------------------------------------- 1 | { 2 | "models_path": "/hulo/localization/resource/models", 3 | "projects_path": "/hulo/localization/resource/projects", 4 | 5 | "configurations":[ 6 | { 7 | "site_id": "SAMPLE_SYNTHETIC_PLACE", 8 | "uuid": "00000000-0000-0000-0000-000000000000", 9 | "project": "example001", 10 | "_model": "PF_PedoWKRW_GPLDPLMulti/example001", 11 | "model": "PF_PedoWKAttRW_GPLDPLMulti/example001", 12 | } 13 | ], 14 | 15 | "options":{ 16 | "nThreads":3 17 | } 18 | } -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.processAnnotations=enabled 9 | org.eclipse.jdt.core.compiler.source=1.7 10 | -------------------------------------------------------------------------------- /LocationTools/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /LocationService/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /location-service-library/.settings/de.loskutov.anyedit.AnyEditTools.prefs: -------------------------------------------------------------------------------- 1 | activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF 2 | addNewLine=true 3 | convertActionOnSaave=AnyEdit.CnvrtTabToSpaces 4 | eclipse.preferences.version=1 5 | ignoreBlankLinesWhenTrimming=false 6 | inActiveContentFilterList= 7 | javaTabWidthForJava=true 8 | org.eclipse.jdt.ui.editor.tab.width=2 9 | projectPropsEnabled=false 10 | removeTrailingSpaces=true 11 | replaceAllSpaces=false 12 | replaceAllTabs=false 13 | saveAndAddLine=false 14 | saveAndConvert=false 15 | saveAndTrim=true 16 | useModulo4Tabs=false 17 | -------------------------------------------------------------------------------- /LocationService/WebContent/WEB-INF/ibm-web-ext.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /location-service-library/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /LocationService/WebContent/WEB-INF/urlrewriterules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ^/location/beacons/([^/]+)/(.+)$ 5 | /location/beacons?action=$1&user_id=$2 6 | 7 | 8 | 9 | ^/location/beacons/(.+)$ 10 | /location/beacons?user_id=$1 11 | 12 | 13 | 14 | ^/data/([^/]+)/?$ 15 | /data?type=$1 16 | 17 | 18 | 19 | ^/data/([^/]+)/([^/]+)/?$ 20 | /data?type=$1&id=$2 21 | 22 | 23 | 24 | ^/data/([^/]+)/(.+)$ 25 | /data?type=$1&id=$2 26 | 27 | 28 | -------------------------------------------------------------------------------- /LocationTools/download-lib.sh: -------------------------------------------------------------------------------- 1 | pwd=`pwd` 2 | 3 | cd ./WebContent/js/lib/ 4 | 5 | jquery=jquery 6 | 7 | mkdir $jquery 8 | cd $jquery 9 | curl -O https://code.jquery.com/jquery-1.11.3.js 10 | curl -O https://code.jquery.com/jquery-1.11.3.min.js 11 | 12 | cd .. 13 | 14 | curl -L -O https://github.com/openlayers/openlayers/releases/download/v4.6.4/v4.6.4-dist.zip 15 | unzip v4.6.4-dist.zip && rm v4.6.4-dist.zip 16 | mv v4.6.4-dist OpenLayers-4.6.4 17 | 18 | 19 | curl -L -O https://jqueryui.com/resources/download/jquery-ui-1.11.4.zip 20 | unzip -o jquery-ui-1.11.4.zip && rm jquery-ui-1.11.4.zip 21 | 22 | curl -L -O https://github.com/DataTables/DataTables/archive/1.10.10.zip 23 | unzip -o 1.10.10.zip -x "DataTables-1.10.10/examples/**" && rm 1.10.10.zip 24 | 25 | cd $pwd 26 | -------------------------------------------------------------------------------- /LocationTools/WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | LocationTools 6 | 7 | index.html 8 | index.htm 9 | index.jsp 10 | default.html 11 | default.htm 12 | default.jsp 13 | 14 | 15 | 1440 16 | 17 | -------------------------------------------------------------------------------- /LocationTools/src/hulo/model/utils/EPSG-CRS-3857.txt: -------------------------------------------------------------------------------- 1 | PROJCRS["WGS 84 / Pseudo-Mercator", 2 | BASEGEODCRS["WGS 84", 3 | DATUM["World Geodetic System 1984", 4 | ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1.0]]]], 5 | CONVERSION["Popular Visualisation Pseudo-Mercator", 6 | METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]], 7 | PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.01745329252]], 8 | PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.01745329252]], 9 | PARAMETER["False easting",0,LENGTHUNIT["metre",1.0]], 10 | PARAMETER["False northing",0,LENGTHUNIT["metre",1.0]]], 11 | CS[cartesian,2], 12 | AXIS["easting (X)",east,ORDER[1]], 13 | AXIS["northing (Y)",north,ORDER[2]], 14 | LENGTHUNIT["metre",1.0], 15 | ID["EPSG",3857]] -------------------------------------------------------------------------------- /LocationTools/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /location-service-resource/example/generatorSetting001.json: -------------------------------------------------------------------------------- 1 | { 2 | "Data":{ 3 | "project" : "../location-service-resource/projects/hulo/localization/resource/projects/example001", 4 | "map" :"map.json", 5 | "train":"trainDataSample.json", 6 | "test":"00000000-0000-0000-0000-000000000000_Example001.csv", 7 | }, 8 | "Beacon": { 9 | "GP": { 10 | "sigma_a": 1.0, 11 | "lengthes": [1.0, 12 | 1.0, 13 | 0.01], 14 | "sigma_n": 0.0001 15 | }, 16 | "LDPL": { 17 | "n":2.0, 18 | "A": -70, 19 | "fa": 4.0, 20 | "fb": 15.0, 21 | "distOffset": 0.1 22 | }, 23 | "Noise": { 24 | "sigma":2.0 25 | } 26 | }, 27 | "Motion": { 28 | "accStds": [0.0, 29 | 0.0, 30 | 0.0], 31 | "attStds": [0.0, 32 | 0.0, 33 | 0.0], 34 | "freq": 100, 35 | "ampG": 2.5, 36 | "stepPerSec": 2.0 37 | }, 38 | "Random":{ 39 | "seed":1234 40 | } 41 | } -------------------------------------------------------------------------------- /location-service-resource/example/generatorSetting002.json: -------------------------------------------------------------------------------- 1 | { 2 | "Data":{ 3 | "project" : "../location-service-resource/projects/hulo/localization/resource/projects/example002", 4 | "map" :"map.json", 5 | "train":"trainDataSample.json", 6 | "test":"00000000-0000-0000-0000-000000000000_Example002.csv", 7 | }, 8 | "Beacon": { 9 | "GP": { 10 | "sigma_a": 1.0, 11 | "lengthes": [1.0, 12 | 1.0, 13 | 0.01], 14 | "sigma_n": 0.0001 15 | }, 16 | "LDPL": { 17 | "n":2.0, 18 | "A": -70, 19 | "fa": 4.0, 20 | "fb": 15.0, 21 | "distOffset": 0.1 22 | }, 23 | "Noise": { 24 | "sigma":2.0 25 | } 26 | }, 27 | "Motion": { 28 | "accStds": [0.0, 29 | 0.0, 30 | 0.0], 31 | "attStds": [0.0, 32 | 0.0, 33 | 0.0], 34 | "freq": 100, 35 | "ampG": 2.5, 36 | "stepPerSec": 2.0 37 | }, 38 | "Random":{ 39 | "seed":1234 40 | } 41 | } -------------------------------------------------------------------------------- /location-service-resource/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /location-service-library/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | location-service-library 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jem.workbench.JavaEMFNature 26 | org.eclipse.wst.common.modulecore.ModuleCoreNature 27 | org.eclipse.wst.common.project.facet.core.nature 28 | org.eclipse.jdt.core.javanature 29 | 30 | 31 | -------------------------------------------------------------------------------- /location-service-resource/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | location-service-resource 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jem.workbench.JavaEMFNature 26 | org.eclipse.wst.common.modulecore.ModuleCoreNature 27 | org.eclipse.wst.common.project.facet.core.nature 28 | org.eclipse.jdt.core.javanature 29 | 30 | 31 | -------------------------------------------------------------------------------- /LocationService/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014, 2015 IBM Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /LocationTools/WebContent/WEB-INF/urlrewriterules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ^/dbs$ 6 | /dbs 7 | 8 | 9 | 10 | ^/js/(.*)$ 11 | /js/$1 12 | 13 | 14 | 15 | ^/([^/]+)/data([^/]*)$ 16 | /data$2?db=$1& 17 | 18 | 19 | 20 | ^/([^/]+)/data/([^/]+)/?$ 21 | /data?db=$1&type=$2 22 | 23 | 24 | 25 | ^/([^/]+)/data/([^/]+)/([^/]+)/?$ 26 | /data?db=$1&type=$2&id=$3 27 | 28 | 29 | 30 | ^/([^/]+)/data/([^/]+)/(.+)$ 31 | /data?db=$1&type=$2&id=$3 32 | 33 | 34 | 35 | 36 | ^/$ 37 | /list.jsp 38 | 39 | 40 | 41 | ^/([^/]+)/$ 42 | /index.jsp?db=$1 43 | 44 | 45 | 46 | ^/([^/]+)/(.*)\.jsp$ 47 | /$2.jsp?db=$1 48 | 49 | 50 | 51 | ^/([^/]+)/(.*)\.(js|css|png)$ 52 | /$2.$3 53 | 54 | 55 | -------------------------------------------------------------------------------- /LocationTools/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014, 2023 IBM Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /LocationService/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | uses 9 | 10 | 11 | uses 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /LocationService/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LocationService 4 | 5 | 6 | location-service-library 7 | location-service-resource 8 | 9 | 10 | 11 | org.eclipse.wst.jsdt.core.javascriptValidator 12 | 13 | 14 | 15 | 16 | org.eclipse.jdt.core.javabuilder 17 | 18 | 19 | 20 | 21 | org.eclipse.wst.common.project.facet.core.builder 22 | 23 | 24 | 25 | 26 | org.eclipse.wst.validation.validationbuilder 27 | 28 | 29 | 30 | 31 | 32 | org.eclipse.jem.workbench.JavaEMFNature 33 | org.eclipse.wst.common.modulecore.ModuleCoreNature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | org.eclipse.jdt.core.javanature 36 | org.eclipse.wst.jsdt.core.jsNature 37 | 38 | 39 | -------------------------------------------------------------------------------- /location-service-resource/models/hulo/localization/resource/models/PF_PedoWKRW_GPLDPLMulti/example001/model.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ParticleFilterWithSensor", 3 | "parameters": { 4 | "initialLocations": "trainingSamples", 5 | "nParticles": 1000, 6 | "averagingType":"simpleAverage", 7 | "resamplingMethod":"systematicResampling", 8 | "alphaWeaken":1.0, 9 | 10 | "ObservationModel": { 11 | "name": "GaussianProcessLDPLMeanMultiModel", 12 | "parameters": { 13 | "LDPLParameters": { 14 | "heightDifference": 0.1, 15 | "A": -72, 16 | "n": 2.4, 17 | "fa": 0.0, 18 | "fb": 0.0, 19 | "lambdas": [1000.0, 0.001, 1.0, 1.0] 20 | }, 21 | "GPParameters": { 22 | "lengthes": [2.0, 2.0, 0.01], 23 | "sigmaP": 4.0, 24 | "sigmaN": 2.0, 25 | "constVar": 1, 26 | "useMask": 1 27 | }, 28 | "BeaconFilter":{ 29 | "name":"NormedStrongestBeaconFilter", 30 | "parameters":{ 31 | "doNormalize":false, 32 | "kBeacons":100, 33 | }, 34 | }, 35 | "options": { 36 | "optimizeHyperParameters": 1 37 | } 38 | } 39 | }, 40 | "SystemModel": { 41 | "name": "RandomWalkerOnFloorsFreeWithSensor", 42 | "parameters": { 43 | "sigma": 1.5, 44 | "sigmaStay":0.05, 45 | "sigmaWalk":1.5, 46 | "Pedometer": { 47 | "name": "PedometerDirect", 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /location-service-library/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /download-lib.sh: -------------------------------------------------------------------------------- 1 | pwd=`pwd` 2 | 3 | cd LocationService/WebContent/js/lib/ 4 | 5 | jquery=jquery 6 | 7 | mkdir $jquery 8 | cd $jquery 9 | curl -O https://code.jquery.com/jquery-1.11.2.js 10 | curl -O https://code.jquery.com/jquery-1.11.2.min.js 11 | 12 | cd .. 13 | 14 | curl -L -O https://github.com/openlayers/ol2/releases/download/release-2.13.1/OpenLayers-2.13.1.zip 15 | unzip -o -q OpenLayers-2.13.1.zip && rm OpenLayers-2.13.1.zip 16 | 17 | 18 | curl -L -O https://jqueryui.com/resources/download/jquery-ui-1.11.4.zip 19 | unzip -o -q jquery-ui-1.11.4.zip && rm jquery-ui-1.11.4.zip 20 | 21 | curl -L -O https://github.com/DataTables/DataTables/archive/1.10.6.zip 22 | unzip -o -q 1.10.6.zip && rm 1.10.6.zip 23 | 24 | cd $pwd 25 | mkdir LocationService/WebContent/WEB-INF/lib 26 | cd LocationService/WebContent/WEB-INF/lib 27 | 28 | curl -L -O https://github.com/mongodb/mongo-java-driver/releases/download/r2.12.0/mongo-java-driver-2.12.0.jar 29 | 30 | cd $pwd 31 | cd location-service-library/lib 32 | 33 | curl -L -O http://archive.apache.org/dist/commons/math/binaries/commons-math3-3.3-bin.zip 34 | unzip commons-math3-3.3-bin.zip commons-math3-3.3/commons-math3-3.3.jar && rm commons-math3-3.3-bin.zip 35 | mv commons-math3-3.3/commons-math3-3.3.jar ./ 36 | 37 | curl -L -O http://archive.apache.org/dist/wink/1.4.0/apache-wink-1.4.zip 38 | unzip apache-wink-1.4.zip apache-wink-1.4/dist/wink-1.4.jar && rm apache-wink-1.4.zip 39 | mv apache-wink-1.4/dist/wink-1.4.jar ./ 40 | -------------------------------------------------------------------------------- /LocationTools/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LocationTools 4 | 5 | 6 | location-service-library 7 | location-service-resource 8 | 9 | 10 | 11 | org.eclipse.wst.jsdt.core.javascriptValidator 12 | 13 | 14 | 15 | 16 | org.eclipse.jdt.core.javabuilder 17 | 18 | 19 | 20 | 21 | org.eclipse.wst.common.project.facet.core.builder 22 | 23 | 24 | 25 | 26 | org.eclipse.wst.validation.validationbuilder 27 | 28 | 29 | 30 | 31 | org.eclipse.m2e.core.maven2Builder 32 | 33 | 34 | 35 | 36 | 37 | org.eclipse.m2e.core.maven2Nature 38 | org.eclipse.jem.workbench.JavaEMFNature 39 | org.eclipse.wst.common.modulecore.ModuleCoreNature 40 | org.eclipse.wst.common.project.facet.core.nature 41 | org.eclipse.jdt.core.javanature 42 | org.eclipse.wst.jsdt.core.jsNature 43 | 44 | 45 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/StateTransition.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization; 24 | 25 | public interface StateTransition { 26 | public State predict(State state); 27 | } 28 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/DataReader.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | public interface DataReader { 26 | public boolean hasReadMethod(String readMethod); 27 | } 28 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/kernels/KernelFunction.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.kernels; 24 | 25 | public interface KernelFunction{ 26 | public double computeKernel(double[] x1, double[] x2); 27 | } -------------------------------------------------------------------------------- /LocationTools/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/sys/PoseSystemModel.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.sys; 24 | 25 | import hulo.localization.State; 26 | 27 | public interface PoseSystemModel extends SystemModel{ 28 | public State toPoseData(State state); 29 | } 30 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/sys/SystemModelFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.sys; 24 | 25 | import hulo.localization.models.ModelFactory; 26 | 27 | public interface SystemModelFactory extends ModelFactory { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/obs/ObservationModelFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.obs; 24 | 25 | import hulo.localization.models.ModelFactory; 26 | 27 | public interface ObservationModelFactory extends ModelFactory { 28 | } 29 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/LocalizationService.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization; 24 | 25 | public interface LocalizationService { 26 | public abstract LocalizationStatus update(LocalizationStatus status, LocalizationInput input); 27 | public abstract void destroy(); 28 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/sys/SystemModelOnFloorsMap.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.sys; 24 | 25 | import hulo.localization.map.MapFloorsModel; 26 | 27 | public interface SystemModelOnFloorsMap extends SystemModel{ 28 | public MapFloorsModel getMapFloorsModel(); 29 | } 30 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/sensor/OrientationMeter.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.sensor; 24 | 25 | import java.util.List; 26 | 27 | public interface OrientationMeter { 28 | public abstract void setSensorDataList(List sensors); 29 | public abstract double getOrientationMeasured(); 30 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/pf/Resampler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.pf; 24 | 25 | import hulo.localization.State; 26 | 27 | public interface Resampler { 28 | 29 | public boolean hasResamplingMethod(String resamplingMethod); 30 | public State[] resampling(State[] states, double[] weights); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/MapDataReader.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | import org.apache.wink.json4j.JSONObject; 26 | 27 | public interface MapDataReader { 28 | public boolean hasReadMethod(JSONObject formatJSON); 29 | public MapData read(String projectPath, JSONObject formatJSON); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/SampleVisualizer.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | import hulo.localization.Sample; 26 | 27 | import java.util.List; 28 | 29 | public interface SampleVisualizer { 30 | public void setSamples(List samples); 31 | public void visualizeMeanRssi(String projectPath); 32 | } 33 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/sys/SystemModelWithSensor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.sys; 24 | 25 | import hulo.localization.LocalizationInput; 26 | import hulo.localization.State; 27 | 28 | public interface SystemModelWithSensor extends SystemModel { 29 | public State[] predict(State[] states, LocalizationInput input); 30 | } 31 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/extention/PostProcessor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.extention; 24 | 25 | import hulo.localization.LocalizationInput; 26 | import hulo.localization.LocalizationStatus; 27 | 28 | public interface PostProcessor { 29 | public LocalizationStatus update(LocalizationStatus locStatus, LocalizationInput locInput); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/ModelFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models; 24 | 25 | import hulo.localization.project.ProjectData; 26 | 27 | import org.apache.wink.json4j.JSONObject; 28 | 29 | public interface ModelFactory { 30 | boolean hasModel(JSONObject json); 31 | public E create(JSONObject json, ProjectData projData); 32 | } 33 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/TestDataReader.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | import org.apache.wink.json4j.JSONObject; 26 | 27 | public interface TestDataReader { 28 | public boolean hasReadMethod(JSONObject formatJSON); 29 | public TestData read(String projectPath, JSONObject formatJSON, MapData mapData, String group); 30 | } 31 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/map/FloorModel.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.map; 24 | 25 | import hulo.localization.State; 26 | 27 | public interface FloorModel { 28 | 29 | public boolean isStairs(State state); 30 | public boolean isElevator(State state); 31 | public boolean isOutside(State state); 32 | public boolean isValidPoint(State state); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/TrainData.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | import hulo.localization.Sample; 26 | 27 | import java.util.List; 28 | 29 | public class TrainData extends DataUnit{ 30 | public TrainData(){ 31 | super(); 32 | } 33 | public TrainData(String srcName, List samples){ 34 | super(srcName, samples); 35 | } 36 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/obs/ObservationModelWithSensor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.obs; 24 | 25 | import hulo.localization.LocalizationInput; 26 | import hulo.localization.State; 27 | 28 | public interface ObservationModelWithSensor extends ObservationModel { 29 | public double[] getLogLikelihoods(LocalizationInput locInput, State[] locations); 30 | } 31 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/TrainDataReader.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | import org.apache.wink.json4j.JSONObject; 26 | 27 | public interface TrainDataReader { 28 | 29 | public boolean hasReadMethod(JSONObject formatJSON); 30 | 31 | public TrainData read(String projectPath, JSONObject formatJSON, MapData mapData, String group); 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/DataManager.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization; 24 | 25 | import org.apache.wink.json4j.JSONArray; 26 | import org.apache.wink.json4j.JSONObject; 27 | 28 | public interface DataManager { 29 | String getProjectsDir(); 30 | String getModelsDir(); 31 | JSONArray getConfigs(); 32 | JSONObject getOptions(); 33 | String getSite(LocalizationInput input); 34 | } 35 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/likelihood/LikelihoodModel.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.likelihood; 24 | 25 | import org.apache.wink.json4j.JSONObject; 26 | 27 | 28 | public interface LikelihoodModel { 29 | 30 | public double proba(double x, double mu, double sigma); 31 | public double logProba(double x, double mu, double sigma); 32 | 33 | public void settingFromJSON(JSONObject json); 34 | } 35 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/extention/PostProcessorFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.extention; 24 | 25 | import hulo.localization.impl.ObservationModelBuilder; 26 | 27 | import org.apache.wink.json4j.JSONObject; 28 | 29 | public interface PostProcessorFactory { 30 | 31 | public PostProcessor create(ObservationModelBuilder obsModelBuilder, JSONObject config, JSONObject options); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/pf/ParticlePreprocessorFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.pf; 24 | 25 | import hulo.localization.models.obs.ParticleFilter; 26 | 27 | import org.apache.wink.json4j.JSONObject; 28 | 29 | 30 | public interface ParticlePreprocessorFactory { 31 | public boolean hasModel(JSONObject json); 32 | public ParticlePreprocessor create(JSONObject json, ParticleFilter pf); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/sys/SystemModel.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.sys; 24 | import hulo.localization.State; 25 | 26 | public interface SystemModel{ 27 | 28 | public void setStates(State[] states); 29 | public State[] predict(State[] states); 30 | public State predict(State state); 31 | public State getLocationExpected(); 32 | public String toString(); 33 | public void print(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/TestData.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | 28 | public class TestData{ 29 | List data; 30 | public void add(DataUnit d){ data.add(d); } 31 | public DataUnit get(int index){ return data.get(index); } 32 | public int getSize(){return data.size();} 33 | public TestData(){ 34 | data = new ArrayList(); 35 | } 36 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/sensor/Pedometer.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.sensor; 24 | 25 | import java.util.List; 26 | 27 | import org.apache.wink.json4j.JSONObject; 28 | 29 | public interface Pedometer { 30 | public abstract void settingFromJSON(JSONObject json); 31 | public abstract void setSensorDataList(List sensors); 32 | public abstract double getNSteps(); 33 | public abstract double getNSteps(List sensors); 34 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/utils/RandomExtended.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.utils; 24 | 25 | import java.util.Random; 26 | 27 | public class RandomExtended extends Random{ 28 | public double nextTruncatedNormal(double mean, double stdev, double min, double max){ 29 | double value = 0; 30 | while(true){ 31 | value = mean + stdev*this.nextGaussian(); 32 | if(min List flatten(List> entriesList){ 31 | List entriesNew = new ArrayList(); 32 | for(List entriess: entriesList){ 33 | for(T entry: entriess){ 34 | entriesNew.add(entry); 35 | } 36 | } 37 | return entriesNew; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /LocationTools/WebContent/css/common.css: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2023 IBM Corporation, Carnegie Mellon University and 3 | * others 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | ******************************************************************************/ 23 | @charset "UTF-8"; 24 | 25 | .ui-button-text-only .ui-button-text { 26 | padding: 2px 6px; 27 | font-size: 16px; 28 | font-weight: normal; 29 | } 30 | 31 | .fileUpload { 32 | position: relative; 33 | overflow: hidden; 34 | margin: 4px 0px; 35 | } 36 | 37 | .fileUpload input.upload { 38 | position: absolute; 39 | top: 0; 40 | right: 0; 41 | margin: 0; 42 | padding: 0; 43 | font-size: 20px; 44 | cursor: pointer; 45 | opacity: 0; 46 | filter: alpha(opacity = 0); 47 | } -------------------------------------------------------------------------------- /LocationTools/src/hulo/localization/utils/NumberUtils.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2023 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.utils; 24 | 25 | public class NumberUtils { 26 | 27 | public static boolean isInt(String str){ 28 | try{ 29 | Integer.parseInt(str); 30 | return true; 31 | }catch(NumberFormatException e){ 32 | return false; 33 | } 34 | } 35 | 36 | public static boolean isNumber(String str){ 37 | try{ 38 | Double.parseDouble(str); 39 | return true; 40 | }catch(NumberFormatException e){ 41 | return false; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/pf/ResamplerProvider.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.pf; 24 | 25 | import java.util.ServiceLoader; 26 | 27 | public class ResamplerProvider { 28 | static ServiceLoader resamplerLoader = ServiceLoader.load(Resampler.class); 29 | 30 | static public Resampler getResampler(String resamplingMethod){ 31 | for(Resampler resampler : resamplerLoader){ 32 | if(resampler.hasResamplingMethod(resamplingMethod)){ 33 | return resampler; 34 | } 35 | } 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/utils/NumberUtils.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.utils; 24 | 25 | public class NumberUtils { 26 | 27 | public static boolean isInt(String str){ 28 | try{ 29 | Integer.parseInt(str); 30 | return true; 31 | }catch(NumberFormatException e){ 32 | return false; 33 | } 34 | } 35 | 36 | public static boolean isNumber(String str){ 37 | try{ 38 | Double.parseDouble(str); 39 | return true; 40 | }catch(NumberFormatException e){ 41 | return false; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/beacon/BeaconFilter.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.beacon; 24 | 25 | import hulo.localization.BLEBeacon; 26 | import hulo.localization.Beacon; 27 | import hulo.localization.State; 28 | 29 | import java.util.List; 30 | 31 | import org.apache.wink.json4j.JSONObject; 32 | 33 | public interface BeaconFilter { 34 | public void settingFromJSON(JSONObject json); 35 | public BeaconFilter setBLEBeacon(List bleBeacons); 36 | public List filter(List beacons, State[] states); 37 | } 38 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/sensor/OrientationMeterRandom.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.sensor; 24 | 25 | import java.util.List; 26 | import java.util.Random; 27 | 28 | public class OrientationMeterRandom implements OrientationMeter{ 29 | Random rand = new Random(); 30 | 31 | @Override 32 | public void setSensorDataList(List sensors) { 33 | 34 | } 35 | 36 | @Override 37 | public double getOrientationMeasured() { 38 | double orientation = 2.0*Math.PI*rand.nextDouble(); 39 | return orientation; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LocationTools/src/hulo/commons/bean/DatabaseBean.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2023 IBM Corporation, Carnegie Mellon University and others 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.commons.bean; 24 | 25 | import java.util.List; 26 | 27 | import hulo.localization.servlet.MongoService; 28 | 29 | public class DatabaseBean { 30 | 31 | public DatabaseBean() { 32 | } 33 | 34 | public static List getDBNames() { 35 | List list = MongoService.getInstance(null).getDBNames(); 36 | return list; 37 | } 38 | 39 | public static boolean existsDB(String db) { 40 | if (db == null) { return false; } 41 | return DatabaseBean.getDBNames().contains(MongoService.DB_NAME_PREFIX+db); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LocationService/WebContent/js/util.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function latlon2mercator(latlon) { 4 | var xy = new OpenLayers.LonLat(latlon.lon, latlon.lat); 5 | xy = xy.transform('EPSG:4326', 'EPSG:3857'); 6 | return {x:xy.lon, y:xy.lat}; 7 | } 8 | 9 | function mercator2latlon(mercator) { 10 | var latlon = new OpenLayers.Geometry.Point(mercator.x, mercator.y); 11 | latlon = latlon.transform('EPSG:3857', 'EPSG:4326'); 12 | return {lon:latlon.x, lat:latlon.y}; 13 | } 14 | 15 | function getPointResolution(anchor) { 16 | var p1 = new OpenLayers.Geometry.Point(anchor.x, anchor.y); 17 | var p2 = new OpenLayers.Geometry.Point(anchor.x+1, anchor.y); 18 | return (new OpenLayers.Geometry.LineString([p1, p2])).getGeodesicLength('EPSG:3857'); 19 | } 20 | 21 | 22 | function mercator2xy(src_mercator, anchor) { 23 | var r = getPointResolution(anchor); 24 | var dx = (src_mercator.x - anchor.x) * r; 25 | var dy = (src_mercator.y - anchor.y) * r; 26 | var rad = anchor.rotate / 180 * Math.PI; 27 | var c = Math.cos(rad); 28 | var s = Math.sin(rad); 29 | var x = dx * c - dy * s; 30 | var y = dx * s + dy * c; 31 | return {x:x, y:y}; 32 | } 33 | 34 | function xy2mercator(src_xy, anchor) { 35 | var r = getPointResolution(anchor); 36 | var x = src_xy.x; 37 | var y = src_xy.y; 38 | var rad = - anchor.rotate / 180 * Math.PI; 39 | var c = Math.cos(rad); 40 | var s = Math.sin(rad); 41 | var dx = (x * c - y * s) / r; 42 | var dy = (x * s + y * c) / r; 43 | return {x:anchor.x + dx, y:anchor.y + dy}; 44 | } 45 | 46 | function latlon2xy(latlon, anchor) { 47 | var temp = latlon2mercator(anchor); 48 | anchor.x = temp.x; 49 | anchor.y = temp.y; 50 | var mer = latlon2mercator(latlon); 51 | var xy = mercator2xy(mer, anchor); 52 | return xy; 53 | } 54 | 55 | function xy2latlon(xy, anchor) { 56 | var temp = latlon2mercator(anchor); 57 | anchor.x = temp.x; 58 | anchor.y = temp.y; 59 | var mer = xy2mercator(xy, anchor); 60 | var latlon = mercator2latlon(mer); 61 | return latlon; 62 | } 63 | -------------------------------------------------------------------------------- /LocationService/src/hulo/localization/servlet/DBServlet.java: -------------------------------------------------------------------------------- 1 | package hulo.localization.servlet; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import org.apache.wink.json4j.JSON; 13 | import org.apache.wink.json4j.JSONArray; 14 | import org.apache.wink.json4j.JSONException; 15 | 16 | /** 17 | * Servlet implementation class DBServlet 18 | */ 19 | @WebServlet("/dbs") 20 | public class DBServlet extends HttpServlet { 21 | private static final long serialVersionUID = 1L; 22 | 23 | /** 24 | * @see HttpServlet#HttpServlet() 25 | */ 26 | public DBServlet() { 27 | super(); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | /** 32 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 33 | */ 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 35 | // TODO Auto-generated method stub 36 | List list = MongoService.getInstance().getDBNames(); 37 | try { 38 | JSONArray json = new JSONArray(list); 39 | response.getWriter().append(json.toString()); 40 | } catch (JSONException e) { 41 | // TODO Auto-generated catch block 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | /** 47 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 48 | */ 49 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 50 | // TODO Auto-generated method stub 51 | 52 | boolean flag = false; 53 | String name = request.getParameter("name"); 54 | if (MongoService.getInstance().setDB(name)) { 55 | flag = true; 56 | } 57 | response.getWriter().append(flag?"SUCCESS":"FAIL"); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/likelihood/NormalDist.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.likelihood; 24 | 25 | import hulo.localization.utils.StatUtils; 26 | 27 | import org.apache.wink.json4j.JSONObject; 28 | 29 | public class NormalDist implements LikelihoodModel{ 30 | 31 | @Override 32 | public double proba(double x, double mu, double sigma){ 33 | return StatUtils.probaNormal(x, mu, sigma); 34 | } 35 | 36 | @Override 37 | public double logProba(double x, double mu, double sigma){ 38 | return StatUtils.logProbaNormal(x, mu, sigma); 39 | } 40 | 41 | @Override 42 | public void settingFromJSON(JSONObject json) { 43 | // Pass 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /LocationTools/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | LocationTools 6 | LocationTools 7 | 0.0.1-SNAPSHOT 8 | war 9 | 10 | 11 | net.wasdev.maven.tools.targets 12 | liberty-target 13 | 17.0.0.4 14 | pom 15 | provided 16 | 17 | 18 | commons-codec 19 | commons-codec 20 | 1.6 21 | 22 | 23 | org.apache.wink 24 | wink-json4j 25 | 1.4 26 | 27 | 28 | org.mongodb 29 | mongo-java-driver 30 | 3.4.3 31 | 32 | 33 | org.apache.sis.core 34 | sis-referencing 35 | 0.8 36 | 37 | 38 | 39 | src 40 | 41 | 42 | src 43 | 44 | **/*.java 45 | 46 | 47 | 48 | 49 | 50 | maven-war-plugin 51 | 3.0.0 52 | 53 | WebContent 54 | 55 | 56 | 57 | maven-compiler-plugin 58 | 3.7.0 59 | 60 | 1.7 61 | 1.7 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/pf/ParticlePreprocessor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.pf; 24 | 25 | import hulo.localization.LocalizationInput; 26 | import hulo.localization.State; 27 | import hulo.localization.models.obs.ParticleFilter; 28 | 29 | import org.apache.wink.json4j.JSONObject; 30 | 31 | public interface ParticlePreprocessor { 32 | 33 | static final String PARTICLE_PREPROCESSOR = "ParticlePreprocessor"; 34 | 35 | public ParticlePreprocessor settingFromJSON(JSONObject json); 36 | 37 | public ParticlePreprocessor setParticleFilter(ParticleFilter pf); 38 | 39 | public State[] process(State[] states, LocalizationInput input); 40 | 41 | public String toString(); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/obs/ObservationModel.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.obs; 24 | import hulo.localization.Beacon; 25 | import hulo.localization.LocalizationInput; 26 | import hulo.localization.LocalizationStatus; 27 | import hulo.localization.Sample; 28 | import hulo.localization.State; 29 | 30 | import java.util.List; 31 | 32 | import org.apache.wink.json4j.JSONObject; 33 | 34 | public interface ObservationModel{ 35 | public LocalizationStatus update(LocalizationStatus status, LocalizationInput input); 36 | public void settingFromJSON(JSONObject json); 37 | public double[] getLogLikelihoods(List beacons, State[] locations); 38 | public String toString(); 39 | public void train(List trainingSamples); 40 | 41 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/MapData.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | import hulo.localization.BLEBeacon; 26 | 27 | import java.util.ArrayList; 28 | import java.util.HashMap; 29 | import java.util.List; 30 | import java.util.Map; 31 | 32 | public class MapData{ 33 | List bleBeacons; 34 | Map objects; 35 | 36 | public MapData(){ 37 | bleBeacons = new ArrayList(); 38 | objects = new HashMap(); 39 | } 40 | 41 | public List getBLEBeacons(){ 42 | return bleBeacons; 43 | } 44 | 45 | public void setBLEBeacons(List bleBeacons){ 46 | this.bleBeacons = bleBeacons; 47 | } 48 | 49 | public Map getObjects(){ 50 | return objects; 51 | } 52 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/beacon/AbstractBeaconFilter.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.beacon; 24 | 25 | import hulo.localization.BLEBeacon; 26 | import hulo.localization.Beacon; 27 | import hulo.localization.State; 28 | 29 | import java.util.List; 30 | 31 | import org.apache.wink.json4j.JSONObject; 32 | 33 | public class AbstractBeaconFilter implements BeaconFilter{ 34 | 35 | List bleBeacons; 36 | public AbstractBeaconFilter(){} 37 | 38 | public void settingFromJSON(JSONObject json){ 39 | // pass 40 | } 41 | 42 | public BeaconFilter setBLEBeacon(List bleBeacons){ 43 | this.bleBeacons = bleBeacons; 44 | return this; 45 | } 46 | public List filter(List beacons, State[] states){ 47 | return beacons; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/sensor/PedometerRandom.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.sensor; 24 | 25 | import java.util.List; 26 | import java.util.Random; 27 | 28 | import org.apache.wink.json4j.JSONObject; 29 | 30 | public class PedometerRandom implements Pedometer{ 31 | Random rand = new Random(); 32 | 33 | @Override 34 | public void settingFromJSON(JSONObject json) { 35 | // Nothing to do// 36 | } 37 | 38 | @Override 39 | public void setSensorDataList(List sensors) { 40 | } 41 | 42 | @Override 43 | public double getNSteps(List sensors) { 44 | return getNSteps(); 45 | } 46 | 47 | @Override 48 | public double getNSteps() { 49 | double norm = 1.0 + 0.2*rand.nextGaussian(); 50 | return Math.abs(norm); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/project/DataUnit.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.project; 24 | 25 | import hulo.localization.Sample; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | public class DataUnit{ 31 | String srcName; 32 | List samples; 33 | public DataUnit(){ 34 | samples = new ArrayList(); 35 | } 36 | 37 | public DataUnit(String srcName, List samples){ 38 | this.srcName = srcName; 39 | this.samples = samples; 40 | } 41 | 42 | public String getSrcName(){ 43 | return srcName; 44 | } 45 | 46 | public List getSamples(){ 47 | return samples; 48 | } 49 | 50 | public void setSrcName(String srcName){ 51 | this.srcName = srcName; 52 | } 53 | 54 | public void setSamples(List samples){ 55 | this.samples = samples; 56 | } 57 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/thread/ExecutorServiceHolder.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.thread; 24 | 25 | import java.util.concurrent.ExecutorService; 26 | import java.util.concurrent.Executors; 27 | 28 | 29 | public class ExecutorServiceHolder { 30 | 31 | static int nThreads = 3; 32 | static ExecutorService ex = null; 33 | 34 | private ExecutorServiceHolder(){}; 35 | 36 | public static void setNThreads(int nThreads){ 37 | ExecutorServiceHolder.nThreads = nThreads; 38 | System.out.println("The number of threads ="+nThreads+" ."); 39 | } 40 | 41 | public static ExecutorService getExecutorService(){ 42 | if (ex == null) { 43 | ex = Executors.newFixedThreadPool(nThreads); 44 | } 45 | return ex; 46 | } 47 | 48 | public static void destroy() { 49 | if (ex != null) { 50 | ex.shutdownNow(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/extention/PostProcessorProvider.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.extention; 24 | 25 | import hulo.localization.impl.ObservationModelBuilder; 26 | 27 | import java.util.ServiceLoader; 28 | 29 | import org.apache.wink.json4j.JSONObject; 30 | 31 | public class PostProcessorProvider { 32 | 33 | static private ServiceLoader loader = ServiceLoader.load(PostProcessorFactory.class); 34 | 35 | private PostProcessorProvider() { 36 | }; 37 | 38 | static public PostProcessor create(ObservationModelBuilder obsModelBuilder, 39 | JSONObject config, JSONObject options) { 40 | 41 | PostProcessor postProcessor = null; 42 | 43 | for (PostProcessorFactory factory : loader) { 44 | postProcessor = factory.create(obsModelBuilder, config, options); 45 | } 46 | 47 | return postProcessor; 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/sensor/OrientationMeterFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.sensor; 24 | 25 | import org.apache.wink.json4j.JSONException; 26 | import org.apache.wink.json4j.JSONObject; 27 | 28 | public class OrientationMeterFactory { 29 | 30 | static final String RANDOM = "OrientationMeterRandom"; 31 | static final String AVERAGE_YAW = "OrientationMeterAverageYaw"; 32 | 33 | public static OrientationMeter create(JSONObject paramsJSON){ 34 | try { 35 | String name = paramsJSON.getString("name"); 36 | if(name.equals(AVERAGE_YAW)){ 37 | System.out.println(AVERAGE_YAW + " created."); 38 | return new OrientationMeterAverageYaw(); 39 | }else{ 40 | System.out.println(RANDOM + " created."); 41 | return new OrientationMeterRandom(); 42 | } 43 | } catch (JSONException e) { 44 | e.printStackTrace(); 45 | } 46 | return null; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LocationTools/README.md: -------------------------------------------------------------------------------- 1 | 23 | # LocationTools 24 | 25 | ## About 26 | [About HULOP](https://github.com/hulop/00Readme) 27 | 28 | ## License 29 | [MIT](http://opensource.org/licenses/MIT) 30 | 31 | ## Prerequisites 32 | - Java Runtime Environment 7 or later 33 | - Eclipse 4.3 or later 34 | - WebSphere Application Server V8.5 Liberty Profile [(Download WAS Liberty in Eclipse)](https://developer.ibm.com/wasdev/downloads/liberty-profile-using-eclipse/) 35 | 36 | ## Dependent libraries 37 | - [jQuery 1.11.3](https://jquery.com/) (MIT License) 38 | - [OpenLayers 2.13.1](http://openlayers.org/two/) (BSD License) 39 | - [jQuery-UI 1.11.4](https://jqueryui.com/) (MIT License) 40 | - [DataTables 1.10.10](https://datatables.net/) (MIT License) 41 | - [mongo-java-driver 3.4.0](https://github.com/mongodb/mongo-java-driver) (Apache License 2.0) 42 | 43 | ### library locations 44 | - LocationService/WebContent/js/lib/ 45 | - jquery/jquery-1.11.3.js 46 | - jquery/jquery-1.11.3.min.js 47 | - OpenLayers-2.13.1/ 48 | - jquery-ui-1.11.4/ 49 | - DataTables-1.10.10/ 50 | 51 | - LocationService/WebContent/WEB-INF/lib 52 | - mongo-java-driver-3.4.0.jar 53 | -------------------------------------------------------------------------------- /location-service-resource/models/hulo/localization/resource/models/PF_PedoWKAttRW_GPLDPLMulti/example001/model.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ParticleFilterWithSensor", 3 | "parameters": { 4 | "initialLocations": "trainingSamples", 5 | "nParticles": 1000, 6 | "averagingType":"simpleAverage", 7 | "resamplingMethod":"systematicResampling", 8 | "alphaWeaken":1.0, 9 | 10 | "ObservationModel": { 11 | "name": "GaussianProcessLDPLMeanMultiModel", 12 | "parameters": { 13 | "LDPLParameters": { 14 | "heightDifference": 0.1, 15 | "A": -72, 16 | "n": 2.4, 17 | "fa": 0.0, 18 | "fb": 0.0, 19 | "lambdas": [1000.0, 0.001, 1.0, 1.0] 20 | }, 21 | "GPParameters": { 22 | "lengthes": [2.0, 2.0, 0.01], 23 | "sigmaP": 4.0, 24 | "sigmaN": 2.0, 25 | "constVar": 1, 26 | "useMask": 1 27 | }, 28 | "BeaconFilter":{ 29 | "name":"NormedStrongestBeaconFilter", 30 | "parameters":{ 31 | "doNormalize":false, 32 | "kBeacons":100, 33 | }, 34 | }, 35 | "options": { 36 | "optimizeHyperParameters": true 37 | } 38 | } 39 | }, 40 | "SystemModel": { 41 | "name": "PoseRandomWalker", 42 | "parameters": { 43 | "sigma": 1.0, 44 | "Pedometer": { 45 | "name": "PedometerPeakDetect", 46 | "parameters": { 47 | "stepCountPeakWindow": 30, 48 | "walkDetectStdWindow": 80, 49 | "stepCountMovingAverageWindow": 30, 50 | "walkDetectSigmaThreshold": 0.6 51 | } 52 | }, 53 | "OrientationMeter": { 54 | "name": "OrientationMeterAverageYaw" 55 | }, 56 | "PoseSetting":{ 57 | "meanVelocityRep":1.0, 58 | "stdVelocityRep":0.2, 59 | "driftVelocityRep":0.05, 60 | "minVelocityRep":0.1, 61 | "maxVelocityRep":1.5, 62 | 63 | "meanStepLength":0.8, 64 | "stdStepLength":0.1, 65 | "minStepLength":0.1, 66 | "maxStepLength":0.7, 67 | 68 | "stdOrientation":5.0, 69 | "stdOrientationBias":2.0, 70 | "stdNSteps":0.0, 71 | "minNSteps":-1.0, 72 | "maxNSteps":3.0, 73 | 74 | "resetRate":0.0, 75 | 76 | "constantsPrior":"truncatedNormalDistribution", 77 | "velocityMode":"constantVelocity", 78 | "floorMoveMode":"floorsFree", 79 | 80 | "meanRssiBias":0.0, 81 | "stdRssiBias":0.0, 82 | } 83 | } 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/sensor/PedometerWalkingState.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.sensor; 24 | 25 | import java.util.List; 26 | 27 | public class PedometerWalkingState extends PedometerSimple implements Pedometer{ 28 | 29 | public double estimateNSteps(List sensorDataList){ 30 | tNear = 1*freq; 31 | List accList = SensorData.filter(sensorDataList, ACC); 32 | for(SensorData sd: accList){ 33 | addBuffer(sd); 34 | } 35 | SensorData[] sds = getNearSensorData(); 36 | double[] amps = computeAmplitude(sds, G); 37 | amps = SensorUtils.subtract(amps, G); // Subtract gravity component 38 | double[] devs = SensorUtils.computeSlidingWindowDeviation(amps, walkDetectStdWindow); 39 | double[] isWalkings = SensorUtils.thresholding(devs, walkDetectSigmaThreshold); 40 | double meanIsWalking = SensorUtils.computeAverage(isWalkings); 41 | 42 | return meanIsWalking; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /LocationTools/src/hulo/localization/State.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2023 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization; 24 | 25 | public interface State extends Cloneable{ 26 | 27 | public abstract void setX(float x); 28 | 29 | public abstract void setY(float y); 30 | 31 | public abstract void setZ(float z); 32 | 33 | public abstract float getX(); 34 | 35 | public abstract float getY(); 36 | 37 | public abstract float getZ(); 38 | 39 | public abstract boolean equals(State loc); 40 | 41 | public abstract double getDistance(State loc); 42 | 43 | public abstract double getFloorDifference(State loc); 44 | 45 | public abstract String toString(); 46 | 47 | public abstract void print(); 48 | 49 | public abstract State clone(); 50 | 51 | public abstract void setH(float h); 52 | 53 | public abstract float getH(); 54 | 55 | public void setWeight(double weight); 56 | public double getWeight(); 57 | 58 | public void setRssiBias(double rssiBias); 59 | public double getRssiBias(); 60 | 61 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/State.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization; 24 | 25 | public interface State extends Cloneable{ 26 | 27 | public abstract void setX(float x); 28 | 29 | public abstract void setY(float y); 30 | 31 | public abstract void setZ(float z); 32 | 33 | public abstract float getX(); 34 | 35 | public abstract float getY(); 36 | 37 | public abstract float getZ(); 38 | 39 | public abstract boolean equals(State loc); 40 | 41 | public abstract double getDistance(State loc); 42 | 43 | public abstract double getFloorDifference(State loc); 44 | 45 | public abstract String toString(); 46 | 47 | public abstract void print(); 48 | 49 | public abstract State clone(); 50 | 51 | public abstract void setH(float h); 52 | 53 | public abstract float getH(); 54 | 55 | public void setWeight(double weight); 56 | public double getWeight(); 57 | 58 | public void setRssiBias(double rssiBias); 59 | public double getRssiBias(); 60 | 61 | } -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/sensor/PedometerDirect.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.sensor; 24 | 25 | import java.util.List; 26 | 27 | import org.apache.wink.json4j.JSONObject; 28 | 29 | public class PedometerDirect extends PedometerSimple { 30 | 31 | public static final String MOVING = "Moving"; 32 | 33 | @Override 34 | public void settingFromJSON(JSONObject json){ 35 | //Nothing to do. 36 | } 37 | 38 | @Override 39 | public double estimateNSteps(List sensorDataList){ 40 | List accList = SensorData.filter(sensorDataList, MOVING); 41 | int n = accList.size(); 42 | if(n==0){ 43 | System.out.println("Sensor data key [Moving] was not found in sensorDataList. Returned walking=1."); 44 | return 1.0; 45 | }else{ 46 | double[] isWalkings = new double[n]; 47 | for(int i=0; i loader = ServiceLoader.load(ParticlePreprocessorFactory.class); 34 | 35 | public boolean hasFactory(JSONObject json){ 36 | for(ParticlePreprocessorFactory factory: loader){ 37 | if(factory.hasModel(json)){ 38 | return true; 39 | } 40 | } 41 | return false; 42 | } 43 | 44 | public ParticlePreprocessor provide(JSONObject json, ParticleFilter pf) { 45 | ParticlePreprocessor particlePreprocessor = null; 46 | for(ParticlePreprocessorFactory factory: loader){ 47 | particlePreprocessor = factory.create(json, pf); 48 | return particlePreprocessor; 49 | } 50 | 51 | throw new RuntimeException("Implementation was not found."); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/beacon/BeaconFilterFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.beacon; 24 | 25 | import java.util.ServiceLoader; 26 | 27 | import org.apache.wink.json4j.JSONException; 28 | import org.apache.wink.json4j.JSONObject; 29 | 30 | public class BeaconFilterFactory { 31 | private static ServiceLoader loader = ServiceLoader.load(BeaconFilter.class); 32 | 33 | BeaconFilterFactory(){} 34 | 35 | public static BeaconFilter create(JSONObject json){ 36 | BeaconFilter bf = null; 37 | try{ 38 | String name = json.getString("name"); 39 | JSONObject params = json.getJSONObject("parameters"); 40 | for(BeaconFilter bfTemp: loader){ 41 | if(name.equals(bfTemp.getClass().getSimpleName())){ 42 | bf = bfTemp; 43 | bf.settingFromJSON(params); 44 | break; 45 | } 46 | } 47 | if(bf==null){ 48 | System.err.println(name + " is not supported in "+BeaconFilterFactory.class.getSimpleName()+"."); 49 | } 50 | }catch(JSONException e){ 51 | e.printStackTrace(); 52 | } 53 | return bf; 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/kernels/GaussianKernel.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.kernels; 24 | 25 | public class GaussianKernel implements KernelFunction{ 26 | double stdev=1; 27 | double length=1; 28 | 29 | public void setStdev(double stdev){ 30 | this.stdev=stdev; 31 | } 32 | public void setLength(double length){ 33 | this.length=length; 34 | } 35 | 36 | double lengthes[] = null; 37 | public void setLengthes(double lengthes[]){ 38 | this.lengthes=lengthes; 39 | } 40 | 41 | public double computeKernel(double[] x1, double[] x2){ 42 | if(lengthes==null){ 43 | setUpLengthes(x1.length); 44 | } 45 | int nx=x1.length; 46 | assert(nx==x2.length); 47 | double posiInExp=0; 48 | for(int i=0; i 2 | 20 | 21 | 22 | 23 | 24 | Location Service 25 | 36 | 37 | 38 | 39 |
40 |
41 |
Sample
42 |
43 | 46 |
47 | 55 |
2D Fingerprinting Manager
56 |
57 | 62 |
63 | 64 |
65 |
66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /LocationTools/WebContent/user_login.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="org.apache.wink.json4j.JSONObject"%> 2 | 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8"%> 6 | <% 7 | Object profile = userBean.login(request, response); 8 | if (profile == null) { 9 | return; 10 | } 11 | if (profile instanceof JSONObject) { 12 | profile = "OK"; 13 | } 14 | String redirect_url = request.getParameter("redirect_url"); 15 | if (redirect_url == null) { 16 | redirect_url = ""; 17 | } 18 | %> 19 | 20 | 38 | 39 | 40 | 41 | Login 42 | 43 | 44 |
45 | 46 |
47 |

48 |
50 |

51 |

52 |
54 |

55 |

56 | 57 |

58 |

59 | <%=profile%> 60 |

61 |
62 |
63 | 64 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/likelihood/LikelihoodModelFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.likelihood; 24 | 25 | import java.util.ServiceLoader; 26 | 27 | import org.apache.wink.json4j.JSONException; 28 | import org.apache.wink.json4j.JSONObject; 29 | 30 | public class LikelihoodModelFactory { 31 | 32 | private static ServiceLoader loader = ServiceLoader.load(LikelihoodModel.class); 33 | 34 | public static LikelihoodModel create(JSONObject json){ 35 | LikelihoodModel likelihoodModel = null; 36 | try { 37 | if(json==null){ 38 | likelihoodModel = new NormalDist(); 39 | } 40 | else if(json!=null){ 41 | String name = json.getString("name"); 42 | JSONObject paramsJSON = json.getJSONObject("parameters"); 43 | 44 | for(LikelihoodModel lmTemp: loader){ 45 | if(name.equals(lmTemp.getClass().getSimpleName())){ 46 | likelihoodModel = lmTemp; 47 | likelihoodModel.settingFromJSON(paramsJSON); 48 | System.out.println(likelihoodModel.toString() + " was created."); 49 | break; 50 | } 51 | } 52 | if(likelihoodModel==null){ 53 | System.err.println(name+ " is not supported in " + LikelihoodModelFactory.class.getSimpleName() + "."); 54 | } 55 | } 56 | } catch (JSONException e) { 57 | e.printStackTrace(); 58 | } 59 | return likelihoodModel; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/synthe/VirtualRoomMapDataReader.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.synthe; 24 | 25 | import hulo.localization.BLEBeacon; 26 | import hulo.localization.project.MapData; 27 | import hulo.localization.project.MapDataReader; 28 | import hulo.localization.project.MapDataReaderBase; 29 | import hulo.localization.utils.ResourceUtils; 30 | 31 | import java.io.InputStream; 32 | import java.util.List; 33 | 34 | import org.apache.wink.json4j.JSONObject; 35 | 36 | public class VirtualRoomMapDataReader extends MapDataReaderBase implements MapDataReader{ 37 | 38 | static final String READ_MAP_BLEBEACONS = "readMapBLEBeacons"; 39 | 40 | ResourceUtils resReader = ResourceUtils.getInstance(); 41 | 42 | @Override 43 | public boolean hasReadMethod(JSONObject formatJSON) { 44 | String readMethodBeacons = parseReadMethodBeacons(formatJSON); 45 | if(readMethodBeacons.equals(READ_MAP_BLEBEACONS)){ 46 | return true; 47 | }else{ 48 | return false; 49 | } 50 | } 51 | 52 | @Override 53 | public MapData read(String projectPath, JSONObject formatJSON) { 54 | MapData mapData = new MapData(); 55 | String beaconsPath = projectPath+"/map/map.json"; 56 | InputStream is = resReader.getInputStream(beaconsPath); 57 | List bleBeacons = VirtualRoomDataUtils.readMapBLEBeacons(is); 58 | mapData.setBLEBeacons(bleBeacons); 59 | return mapData; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/utils/StatUtils.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.utils; 24 | 25 | 26 | public class StatUtils { 27 | 28 | public static double probaNormal(double x, double mu, double sigma){ 29 | return 1.0/(Math.sqrt(2.0*Math.PI)*sigma)*Math.exp(-Math.pow(x-mu, 2)/(2*sigma*sigma)); 30 | } 31 | 32 | public static double logProbaNormal(double x, double mu, double sigma){ 33 | return -1.0/2.0*Math.log(2*Math.PI) -1.0/2.0*Math.log(sigma*sigma) 34 | -Math.pow(x-mu, 2)/(2.0*sigma*sigma); 35 | } 36 | 37 | public static double probaNormalContami(double x, double mu, double sigma, double coeff, double contamiRate){ 38 | double p1 = probaNormal(x, mu, sigma); 39 | double p2 = probaNormal(x, mu, Math.sqrt(coeff)*sigma); 40 | double p = (1-contamiRate)*p1 + contamiRate*p2; 41 | return p; 42 | } 43 | 44 | public static double logProbaNormalContami(double x, double mu, double sigma, double coeff, double contamiRate){ 45 | double p = probaNormalContami(x, mu, sigma, coeff, contamiRate); 46 | return Math.log(p); 47 | } 48 | 49 | public static double coeffDetermination(double[] y, double[] ypred){ 50 | double ymean = ArrayUtils.mean(y); 51 | double deno = 0; 52 | double nume = 0; 53 | for(int i=0; i stringsList = new ArrayList(); 47 | String line = null; 48 | try { 49 | while( (line=br.readLine()) != null ){ 50 | String[] tokens = line.split(","); 51 | stringsList.add(tokens); 52 | } 53 | } catch (IOException e) { 54 | e.printStackTrace(); 55 | } 56 | String[][] strings = stringsList.toArray(new String[0][]); 57 | return strings; 58 | } 59 | 60 | public static List> readCSVasListMap(InputStream is){ 61 | 62 | String[][] strings = readCSVasStrings(is); 63 | 64 | String[] header = strings[0]; 65 | String[][] data = Arrays.copyOfRange(strings, 1, strings.length); 66 | 67 | List> list = new ArrayList>(); 68 | 69 | for(String[] datum: data){ 70 | Map map = new HashMap(); 71 | for(int i=0; i getResourceNames(String resName){ 69 | return getResourceNames(resName, ""); 70 | } 71 | 72 | public List getResourceNames(String resName, String filteredExt){ 73 | if(resType.equals("file")){ 74 | return FileIOUtils.getResourceNames(resName, filteredExt); 75 | } 76 | return ResourceIOUtils.getResourceNames(resName, filteredExt); 77 | } 78 | 79 | public OutputStream getOutputStream(String resName){ 80 | if(resType.equals("file")){ 81 | return FileIOUtils.newFileOutputStream(resName); 82 | }else{ 83 | return null; 84 | } 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /LocationTools/src/hulo/localization/servlet/JSONBodyHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2023 IBM Corporation, Carnegie Mellon University and others 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.servlet; 24 | 25 | import java.io.BufferedReader; 26 | import java.io.IOException; 27 | import java.io.InputStream; 28 | import java.io.InputStreamReader; 29 | import java.io.OutputStream; 30 | 31 | import javax.servlet.http.HttpServletRequest; 32 | import javax.servlet.http.HttpServletResponse; 33 | 34 | import org.apache.wink.json4j.JSON; 35 | import org.apache.wink.json4j.JSONException; 36 | 37 | public abstract class JSONBodyHandler { 38 | 39 | public abstract Object getResult(Object source) throws JSONException; 40 | 41 | public void exec(HttpServletRequest request, HttpServletResponse response) throws IOException { 42 | InputStream is = null; 43 | OutputStream os = null; 44 | try { 45 | BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream(), "utf-8")); 46 | StringBuffer sb = new StringBuffer(); 47 | String line; 48 | while((line = br.readLine()) != null) { 49 | sb.append(line); 50 | } 51 | 52 | Object result = getResult(JSON.parse(sb.toString())); 53 | if (result == null) { 54 | response.sendError(HttpServletResponse.SC_BAD_REQUEST); 55 | } else { 56 | response.setCharacterEncoding("UTF-8"); 57 | response.setContentType("application/json"); 58 | (os = response.getOutputStream()).write(result.toString().getBytes("UTF-8")); 59 | os.flush(); 60 | } 61 | } catch (JSONException e) { 62 | response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid JSON in body"); 63 | } catch (Exception e) { 64 | e.printStackTrace(); 65 | response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 66 | } finally { 67 | if (is != null) { 68 | is.close(); 69 | } 70 | if (os != null) { 71 | os.close(); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /LocationTools/src/hulo/commons/users/UserDB.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2023 IBM Corporation, Carnegie Mellon University and others 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.commons.users; 24 | 25 | import org.apache.wink.json4j.JSONArray; 26 | import org.apache.wink.json4j.JSONException; 27 | import org.apache.wink.json4j.JSONObject; 28 | 29 | import com.mongodb.BasicDBObject; 30 | import com.mongodb.DBCollection; 31 | import com.mongodb.DBCursor; 32 | import com.mongodb.DBObject; 33 | 34 | import hulo.localization.servlet.MongoService; 35 | 36 | public class UserDB { 37 | private final static String COMMON_DBNAME = "lscommons", USER_COLNAME = "users", INFO_COLNAME = "dbinfo"; 38 | private final MongoService commonDB; 39 | private final DBCollection userCol; 40 | private final DBCollection infoCol; 41 | 42 | public UserDB() { 43 | commonDB = MongoService.makeService(COMMON_DBNAME, true); 44 | userCol = commonDB.getCollection(USER_COLNAME); 45 | infoCol = commonDB.getCollection(INFO_COLNAME); 46 | } 47 | 48 | public JSONArray listUsers() throws JSONException { 49 | JSONArray users = new JSONArray(); 50 | for (DBCursor cursor = userCol.find(); cursor.hasNext();) { 51 | users.add(new JSONObject(cursor.next().toString())); 52 | } 53 | return users; 54 | } 55 | 56 | public JSONObject findUser(String user) throws JSONException { 57 | DBObject obj = userCol.findOne(new BasicDBObject("_id", user)); 58 | return obj != null ? new JSONObject(obj.toString()) : null; 59 | } 60 | 61 | public void updateUser(String json) { 62 | userCol.save((DBObject) com.mongodb.util.JSON.parse(json)); 63 | } 64 | 65 | public void removeUser(String user) { 66 | userCol.remove(new BasicDBObject("_id", user)); 67 | } 68 | 69 | public JSONObject findInfo(String db_name) throws JSONException { 70 | DBObject obj = infoCol.findOne(new BasicDBObject("_id", db_name)); 71 | return obj != null ? new JSONObject(obj.toString()) : null; 72 | } 73 | 74 | public void updateInfo(String json) { 75 | infoCol.save((DBObject) com.mongodb.util.JSON.parse(json)); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /LocationTools/WebContent/index.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="org.apache.wink.json4j.JSONObject"%> 2 | 3 | 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 5 | <% 6 | String db = request.getParameter("db"); 7 | if (!databaseBean.existsDB(db)) { 8 | response.sendError(HttpServletResponse.SC_BAD_REQUEST); 9 | return; 10 | } 11 | String dbname = (db == null) ? "(default)" : "("+db+")"; 12 | 13 | JSONObject profile = (JSONObject)userBean.getProfile(request); 14 | if (profile == null || !userBean.isDbAllowed(request, db)) { 15 | response.sendRedirect("user_login.jsp?logout=true&redirect_url=" + db + "/"); 16 | return; 17 | } 18 | %> 19 | 20 | 38 | 39 | 40 | 41 | 42 | HULOP Tools <%= dbname %> 43 | 58 | 59 | 60 | <%=profile.getString("_id")%> 61 | log out | 62 | change password | 63 | db list 64 |
65 | 66 |
67 |
68 |
HULOP Tools <%= dbname %>
69 |
70 | 76 |
77 | 78 |
79 |
80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/obs/GaussianProcessLDPLMeanModelFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.obs; 24 | 25 | import hulo.localization.BLEBeacon; 26 | import hulo.localization.project.ProjectData; 27 | 28 | import java.util.List; 29 | 30 | import org.apache.wink.json4j.JSONException; 31 | import org.apache.wink.json4j.JSONObject; 32 | 33 | public class GaussianProcessLDPLMeanModelFactory implements 34 | ObservationModelFactory { 35 | 36 | @Override 37 | public boolean hasModel(JSONObject json) { 38 | try { 39 | String name = json.getString("name"); 40 | if(name.equals(GaussianProcessLDPLMeanModel.class.getSimpleName())){ 41 | return true; 42 | }else if(name.equals(GaussianProcessLDPLMeanMultiModel.class.getSimpleName())){ 43 | return true; 44 | } 45 | } catch (JSONException e) { 46 | e.printStackTrace(); 47 | } 48 | return false; 49 | } 50 | 51 | @Override 52 | public ObservationModel create(JSONObject json, ProjectData projData) { 53 | ObservationModel model=null; 54 | 55 | try{ 56 | String name = json.getString("name"); 57 | JSONObject paramsJSON = json.getJSONObject("parameters"); 58 | 59 | GaussianProcessLDPLMeanModel obsModel = null; 60 | if(name.equals(GaussianProcessLDPLMeanModel.class.getSimpleName())){ 61 | obsModel = new GaussianProcessLDPLMeanModel(); 62 | }else if(name.equals(GaussianProcessLDPLMeanMultiModel.class.getSimpleName())){ 63 | obsModel = new GaussianProcessLDPLMeanMultiModel(); 64 | } 65 | obsModel.settingFromJSON(paramsJSON); 66 | List bleBeacons = projData.mapData().getBLEBeacons(); 67 | BLEBeacon.reassignShortestIds(bleBeacons); 68 | obsModel.setBLEBeacons(bleBeacons); 69 | obsModel.train(projData.trainData().getSamples()); 70 | JSONObject trainedJSON = obsModel.toJSON(); 71 | json.put("parameters", trainedJSON); 72 | model = obsModel; 73 | 74 | }catch(JSONException e){ 75 | e.printStackTrace(); 76 | } 77 | 78 | return model; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/obs/ParticleFilterModelFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.obs; 24 | 25 | import hulo.localization.models.ModelBuilderCore; 26 | import hulo.localization.models.sys.SystemModel; 27 | import hulo.localization.project.ProjectData; 28 | 29 | import org.apache.wink.json4j.JSONException; 30 | import org.apache.wink.json4j.JSONObject; 31 | 32 | public class ParticleFilterModelFactory implements ObservationModelFactory { 33 | 34 | @Override 35 | public boolean hasModel(JSONObject json) { 36 | try { 37 | String name = json.getString("name"); 38 | if(name.equals(ParticleFilter.class.getSimpleName())){ 39 | return true; 40 | }else if(name.equals(ParticleFilterWithSensor.class.getSimpleName())){ 41 | return true; 42 | } 43 | } catch (JSONException e) { 44 | e.printStackTrace(); 45 | } 46 | return false; 47 | } 48 | 49 | @Override 50 | public ObservationModel create(JSONObject json, ProjectData projData) { 51 | ObservationModel model=null; 52 | try{ 53 | 54 | String name = json.getString("name"); 55 | JSONObject paramsJSON = json.getJSONObject("parameters"); 56 | 57 | JSONObject sysJSON = paramsJSON.getJSONObject(SystemModel.class.getSimpleName()); 58 | SystemModel sysModel =ModelBuilderCore.buildSystemModel(sysJSON, projData); 59 | 60 | JSONObject obsJSON = paramsJSON.getJSONObject(ObservationModel.class.getSimpleName()); 61 | ObservationModel obsModel = ModelBuilderCore.buildObservationModel(obsJSON, projData); 62 | 63 | ParticleFilter pf = null; 64 | if(name.equals(ParticleFilter.class.getSimpleName())){ 65 | pf = new ParticleFilter(sysModel, obsModel); 66 | }else if(name.equals(ParticleFilterWithSensor.class.getSimpleName())){ 67 | pf = new ParticleFilterWithSensor(sysModel, obsModel); 68 | } 69 | pf.settingFromJSON(paramsJSON); 70 | pf.train(projData.trainData().getSamples()); 71 | model = pf; 72 | 73 | }catch(JSONException e){ 74 | e.printStackTrace(); 75 | } 76 | return model; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /LocationTools/WebContent/user_password.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="org.apache.wink.json4j.JSONObject"%> 2 | 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8"%> 6 | <% 7 | JSONObject profile = (JSONObject)userBean.getProfile(request); 8 | String redirect_url = request.getParameter("redirect_url"); 9 | if (profile == null || redirect_url == null) { 10 | response.sendError(HttpServletResponse.SC_FORBIDDEN); 11 | return; 12 | } 13 | String message = ""; 14 | String user = profile.getString("_id"); 15 | String password = request.getParameter("password"); 16 | String password2 = request.getParameter("password2"); 17 | if (password != null && password.length() > 0) { 18 | if (password.equals(password2)) { 19 | userBean.updateUser(user, password, null, null); 20 | response.sendRedirect(redirect_url); 21 | return; 22 | } else { 23 | message = "Please enter same password"; 24 | } 25 | } 26 | %> 27 | 28 | 46 | 47 | 48 | 50 | 51 | Change password 52 | 53 | 54 |
55 |
56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 72 | 73 | 74 |
password:
confirm password:
69 | 70 | 71 |
75 |

76 | <%=message%> 77 |

78 |
79 |
80 | 81 | -------------------------------------------------------------------------------- /LocationTools/WebContent/js/list.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2023 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | $(document).ready(function() { 24 | var table = window.t = $('#table').DataTable({ 25 | 'stateSave': true, 26 | 'columnDefs' : [ { 27 | 'name' : 'db_name', 28 | 'targets' : 0 29 | }, { 30 | 'name' : 'group_name', 31 | 'targets' : 1 32 | } ] 33 | }); 34 | 35 | $('#adddb').click(function() { 36 | $('#dbname').val() && $.ajax({ 37 | 'url' : 'dbs?name=' + $('#dbname').val() + '&group=' + $('#group_name').val(), 38 | 'method' : 'POST', 39 | 'success' : function(data) { 40 | window.location.reload(); 41 | } 42 | }); 43 | }); 44 | 45 | $('#edit_group').click(function() { 46 | table.cells(null, 'group_name:name').nodes().to$().prop('contenteditable', true); 47 | $('#edit_group').hide(); 48 | $('#cancel_group, #save_group').show(); 49 | }); 50 | 51 | $('#cancel_group').click(function() { 52 | table.cells(null, 'group_name:name').nodes().to$().prop('contenteditable', false); 53 | $('#edit_group').show(); 54 | $('#cancel_group, #save_group').hide(); 55 | table.cells(null, 'group_name:name').every(function() { 56 | this.data(this.data()); 57 | }); 58 | }).hide(); 59 | 60 | $('#save_group').click(function() { 61 | var updates = []; 62 | table.rows().every(function() { 63 | var tr = this.nodes().to$(); 64 | var group_name = tr.find('.group_name').text(); 65 | if (group_name != this.data()[1]) { 66 | updates.push({ 67 | '_id' : tr.find('.db_name').text(), 68 | 'group' : group_name 69 | }); 70 | } 71 | }); 72 | if (updates.length > 0) { 73 | console.log(updates) 74 | $.ajax({ 75 | 'type' : 'POST', 76 | 'url' : location.href, 77 | 'processData' : false, 78 | 'contentType' : 'application/json', 79 | 'data' : JSON.stringify(updates), 80 | 'success' : function(data) { 81 | location.reload(); 82 | }, 83 | 'error' : function(XMLHttpRequest, textStatus, errorThrown) { 84 | console.error(textStatus + ' (' + XMLHttpRequest.status + '): ' + errorThrown); 85 | errorThrown && alert(textStatus + ' (' + XMLHttpRequest.status + '): ' + errorThrown); 86 | } 87 | }); 88 | } 89 | }).hide(); 90 | }); 91 | -------------------------------------------------------------------------------- /location-service-library/src/hulo/localization/models/sys/RandomWalkerOnFloorsFree.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014, 2015 IBM Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | package hulo.localization.models.sys; 24 | 25 | import hulo.localization.State; 26 | 27 | import java.io.InputStream; 28 | 29 | public class RandomWalkerOnFloorsFree extends RandomWalker { 30 | 31 | static double pUp = 0.1; 32 | static double pDown = 0.1; 33 | 34 | public RandomWalkerOnFloorsFree() { 35 | super(); 36 | } 37 | 38 | public RandomWalkerOnFloorsFree(double sigma){ 39 | super(sigma); 40 | } 41 | 42 | public RandomWalkerOnFloorsFree(InputStream is){ 43 | super(is); 44 | } 45 | 46 | @Override 47 | public State predict(State state){ 48 | return predict(state, sigma, isWalking); 49 | } 50 | 51 | 52 | public static State predict(State state, double sigma, boolean isWalking){ 53 | State stateTmp = predict2D(state, sigma); 54 | return predictZ(stateTmp, isWalking); 55 | } 56 | 57 | public static State predict2D(State state, double sigma){ 58 | double x = state.getX(); 59 | double y = state.getY(); 60 | // Assuming 2D random walk 61 | x += sigma*getRandom().nextGaussian(); 62 | y += sigma*getRandom().nextGaussian(); 63 | State stateNew = (State) state.clone(); 64 | stateNew.setX((float) x); 65 | stateNew.setY((float) y); 66 | return stateNew; 67 | } 68 | 69 | public static double predictZ(double z){ 70 | return predictZ(z, pUp, pDown); 71 | } 72 | 73 | protected static double predictZ(double z, double pUp, double pDown){ 74 | double znew = z; 75 | double prob = getRandom().nextDouble(); 76 | if(prob