Merge branch dev (v1.1.5) into dev-drone
Read the error from the positioning server.
This commit is contained in:
commit
2bbe114c4b
5
TODO
5
TODO
|
@ -1,6 +1,9 @@
|
|||
* Global
|
||||
|
||||
- Use -D DEBUG in makefiles instead of #defines.
|
||||
- Makefiles:
|
||||
° Use -D DEBUG instead of #defines.
|
||||
° Use echo instead of echo -e.
|
||||
° Translate comments & help.
|
||||
- Use string for network exchanges?
|
||||
- Mark arguments as const in function headers if needed
|
||||
That is done in the owlps-positioning C++ code, but not constantly
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Source version
|
||||
ifndef OWLPS_VERSION
|
||||
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
|
||||
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||
endif
|
||||
|
||||
# Répertoire d'installation
|
||||
|
|
|
@ -711,7 +711,7 @@ void string2data(char* string_data)
|
|||
int count_algo= 0 ;
|
||||
int count_print = 0 ;
|
||||
int onetime = 0 ;
|
||||
|
||||
int error = 0 ;
|
||||
|
||||
while(onetime<1)
|
||||
{
|
||||
|
@ -761,6 +761,8 @@ void string2data(char* string_data)
|
|||
ptr = strtok(NULL, delims) ;
|
||||
if(ptr==NULL) break ;
|
||||
sscanf(ptr, "%s", results[count_algo].algo) ;
|
||||
if(!strcmp(results[count_algo].algo,"Real"))
|
||||
error=1;
|
||||
|
||||
//Lecture du point X
|
||||
ptr = strtok(NULL, delims) ;
|
||||
|
@ -815,10 +817,50 @@ void string2data(char* string_data)
|
|||
}
|
||||
}
|
||||
results[count_algo].z = atof(ptr) ;
|
||||
if(error==1)
|
||||
{
|
||||
//Lecture du message Error
|
||||
ptr = strtok(NULL, delims) ;
|
||||
if(ptr==NULL)
|
||||
{
|
||||
if(count_algo==0)
|
||||
{
|
||||
print_error ("trame");
|
||||
break ;
|
||||
}
|
||||
else
|
||||
{
|
||||
print_error ("algo");
|
||||
count_algo--;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
results[count_algo].check = ptr ;
|
||||
|
||||
//Lecture valeur Error
|
||||
ptr = strtok(NULL, delims) ;
|
||||
if(ptr==NULL)
|
||||
{
|
||||
if(count_algo==0)
|
||||
{
|
||||
print_error ("trame");
|
||||
break ;
|
||||
}
|
||||
else
|
||||
{
|
||||
perror ("algo");
|
||||
count_algo--;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
results[count_algo].err = atof(ptr) ;
|
||||
|
||||
|
||||
count_algo++;
|
||||
}
|
||||
|
||||
else
|
||||
count_algo++;
|
||||
}
|
||||
|
||||
for(count_print=0;count_print<count_algo;count_print++)
|
||||
|
|
|
@ -70,6 +70,7 @@ struct result
|
|||
float x;
|
||||
float y;
|
||||
float z;
|
||||
char *check;
|
||||
float err;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Source version
|
||||
ifndef OWLPS_VERSION
|
||||
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
|
||||
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||
endif
|
||||
|
||||
# Répertoire d'installation
|
||||
|
@ -45,17 +45,17 @@ dynamic : $(TARGET)
|
|||
static : $(TARGET).static
|
||||
all : dynamic static
|
||||
|
||||
% : %.o
|
||||
# Cancel implicit make rule
|
||||
%: %.c
|
||||
|
||||
%: %.o
|
||||
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
||||
%.o : %.c $(HEADER)
|
||||
%.static: %.o
|
||||
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ \
|
||||
$(LDFLAGS) $(LIBS) $(STATIC_LIBS) -static
|
||||
%.o: %.c $(HEADER)
|
||||
$(CC) $(XCFLAGS) $(OWLPSFLAGS) -c $<
|
||||
|
||||
# Compilation du programme
|
||||
$(TARGET) : $(TARGET).o $(HEADER)
|
||||
|
||||
$(TARGET).static : $(TARGET).c $(HEADER)
|
||||
$(CC) $(LDFLAGS) -static $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
|
||||
|
||||
|
||||
## Installation / désinstallation ##
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Source version
|
||||
ifndef OWLPS_VERSION
|
||||
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
|
||||
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||
endif
|
||||
|
||||
# Emplacement de la suite de cross-compilation
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Source version
|
||||
ifndef OWLPS_VERSION
|
||||
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
|
||||
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||
endif
|
||||
|
||||
# Emplacement de la suite de cross-compilation
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Source version
|
||||
ifndef OWLPS_VERSION
|
||||
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
|
||||
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||
endif
|
||||
|
||||
# Répertoire d'installation
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Source version
|
||||
ifndef OWLPS_VERSION
|
||||
OWLPS_VERSION = $$(git describe)
|
||||
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||
endif
|
||||
|
||||
# Emplacement de la suite de cross-compilation
|
||||
|
|
|
@ -741,7 +741,8 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
|
|||
owl_bool uses_autocalibration_request_port = FALSE ;
|
||||
int i ; // Iterator
|
||||
|
||||
memset(request.mobile_ip_addr_bytes, 0, 4) ; // Blank the IP
|
||||
// Blank the request:
|
||||
memset(&request, 0, sizeof(request)) ;
|
||||
|
||||
/* Common treatements */
|
||||
|
||||
|
@ -837,14 +838,6 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
|
|||
memcpy(request.ap_mac_addr_bytes, my_mac_bytes, ETHER_ADDR_LEN) ;
|
||||
// Capture time is in the pcap header (net-endian):
|
||||
request.start_time = owl_timeval_to_timestamp(header->ts) ;
|
||||
// Transmission time on the mobile is unknown (unless the packet is
|
||||
// an explicit request):
|
||||
memset(&request.request_time, 0, sizeof(owl_timestamp)) ;
|
||||
// Blank position data:
|
||||
request.direction = 0 ;
|
||||
request.x_position = 0 ;
|
||||
request.y_position = 0 ;
|
||||
request.z_position = 0 ;
|
||||
|
||||
/* Active mode */
|
||||
if (is_explicit_packet
|
||||
|
@ -1065,7 +1058,8 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
|
|||
owl_mac_bytes_to_string(request.mobile_mac_addr_bytes),
|
||||
request_time_str,
|
||||
start_time_str,
|
||||
request.antenna_signal_dbm - 0x100,
|
||||
check[RTAP_ANTENNASIGNALDBM] ?
|
||||
request.antenna_signal_dbm - 0x100 : 0,
|
||||
owl_ntohf(request.x_position),
|
||||
owl_ntohf(request.y_position),
|
||||
owl_ntohf(request.z_position),
|
||||
|
|
|
@ -31,7 +31,7 @@ PROJECT_NAME = "OWLPS Positioning"
|
|||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.9.1
|
||||
PROJECT_NUMBER = $(OWLPS_VERSION)
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Source version
|
||||
ifndef OWLPS_VERSION
|
||||
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
|
||||
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||
endif
|
||||
|
||||
# Directories & files
|
||||
|
@ -24,7 +24,7 @@ MKDIR = mkdir -pv
|
|||
# Other tools
|
||||
STYLE = astyle --style=gnu --formatted
|
||||
CPPCHECK = cppcheck --quiet --enable=all
|
||||
DOXYGEN = doxygen >/dev/null
|
||||
DOXYGEN = OWLPS_VERSION=$(OWLPS_VERSION) doxygen >/dev/null
|
||||
|
||||
# Compilation tools
|
||||
COLORGCC := $(shell which colorgcc >/dev/null 2>&1 ; echo $$?)
|
||||
|
@ -133,6 +133,8 @@ $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cc $(SRC_DIR)/%.hh
|
|||
$(LD) $(LDFLAGS) -o $@ $^
|
||||
|
||||
# Dependencies
|
||||
$(OBJ_DIR)/point3d.o: \
|
||||
$(OBJ_DIR)/posexcept.o
|
||||
$(OBJ_DIR)/posutil.o: \
|
||||
$(OBJ_DIR)/posexcept.o
|
||||
$(OBJ_DIR)/owlps-positioning.o: \
|
||||
|
@ -243,7 +245,9 @@ $(OBJ_DIR)/output.o: \
|
|||
$(OBJ_DIR)/multilaterationalgorithm.o: \
|
||||
$(SRC_DIR)/positioningalgorithm.hh \
|
||||
$(OBJ_DIR)/minmax.o \
|
||||
$(OBJ_DIR)/mobile.o
|
||||
$(OBJ_DIR)/mobile.o \
|
||||
$(OBJ_DIR)/configuration.o \
|
||||
$(OBJ_DIR)/posexcept.o
|
||||
$(OBJ_DIR)/cartographyalgorithm.o: \
|
||||
$(SRC_DIR)/positioningalgorithm.hh \
|
||||
$(OBJ_DIR)/referencepoint.o
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
|
||||
- Multithread algorithm calls.
|
||||
|
||||
- Write a class for Request::type?
|
||||
CalibrationRequest::direction uses a dedicated class Direction, why
|
||||
not Request::type? That would simplify writing of the type to
|
||||
streams (no need to cast each time anymore).
|
||||
|
||||
- Interface utilisateur
|
||||
° Pour plus de souplesse, comparer les chaînes sans tenir compte de
|
||||
la casse.
|
||||
- User interface
|
||||
° Case-insensitive string comparison (for algorithm names, etc.).
|
||||
° Use a prefix for configuration files (search for config files set
|
||||
with relative path in owlps-positioning.cfg in the same directory).
|
||||
|
||||
- Tests unitaires
|
||||
- Unit tests
|
||||
° Update tests (currently unmaintained).
|
||||
° Finir le test de InputDataReader.
|
||||
° Finir le test de Input.
|
||||
° Finir le test de Output.
|
||||
° Finir le test de Positioning.
|
||||
° Tester InterlinkNetworks::compute() ?
|
||||
° Unfinished tests:
|
||||
. InputDataReader
|
||||
. Input
|
||||
. Output
|
||||
. Positioning
|
||||
° Test InterlinkNetworks::compute() ?
|
||||
|
||||
- Revoir le diagramme UML
|
||||
° Associations : devraient êtres représentées par des attributs
|
||||
|
@ -33,7 +37,6 @@
|
|||
|
||||
- MinMax
|
||||
° Différencier le pas pour X, Y et Z ?
|
||||
° Régler le start & stop dans MultilaterationAlgorithm.
|
||||
|
||||
- Renommages de membres
|
||||
° InputMedium :
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# Listeners' physical description file.
|
||||
#
|
||||
# Each line follows this format:
|
||||
# MAC address;X;Y;Z;Channel (Hz);Antenna gain (dBi);Trx power (dBm)
|
||||
#
|
||||
# Blank lines are ignored. Commented lines must have a sharp (#) as
|
||||
# their FIRST character.
|
||||
|
||||
# Example listener:
|
||||
#00:11:22:33:44:55;4;0.5;7.95;2417000000;5.0;20.0
|
|
|
@ -1,20 +0,0 @@
|
|||
# Fichier de configuration pour les AP.
|
||||
# Chaque ligne est de la forme :
|
||||
# MAC;X;Y;Z;Fréquence d'émission (Hz);Gain d'antenne (dBi);Puissance d'émission (dBm)
|
||||
# Les lignes vides ou commençant par un # sont ignorées. Les
|
||||
# commentaires doivent obligatoirement être en début de ligne.
|
||||
|
||||
# mini5 (Laseldi)
|
||||
00:13:CE:95:E1:6F;4.93;25.81;3.55;2417000000;5.0;20.0
|
||||
|
||||
# mini6 (Laurent / Wassim)
|
||||
00:13:CE:95:DE:7E;4.83;10.88;3.78;2417000000;5.0;20.0
|
||||
|
||||
# mini4 (Incubateur)
|
||||
00:13:CE:97:78:79;20.05;28.31;3.74;2417000000;5.0;20.0
|
||||
|
||||
# mini3 (Dominique)
|
||||
00:13:CE:8F:77:43;4.13;7.085;0.80;2417000000;5.0;20.0
|
||||
|
||||
# mini1 (Adrien)
|
||||
00:13:CE:8F:78:D9;5.74;30.35;2.04;2417000000;5.0;20.0
|
|
|
@ -1,15 +1,21 @@
|
|||
# Sample configuration file for OWLPS Positioning
|
||||
|
||||
# Miscellaneous options
|
||||
# [Miscellaneous options]
|
||||
|
||||
#flush-output-files = true
|
||||
|
||||
[data-input]
|
||||
|
||||
#ap-medium = CSV
|
||||
ap-csv-file = cfg/access_points.csv
|
||||
# Description of the machines running the listeners.
|
||||
ap-medium = CSV
|
||||
ap-csv-file = cfg/listeners.csv
|
||||
|
||||
topology-medium = CSV
|
||||
areas-csv-file = cfg/topo.csv
|
||||
# Description of deployment area topology.
|
||||
# You probably don't need a full description of the topology, see the
|
||||
# topology example file for details.
|
||||
# Uncomment the following line to activate the topology reading.
|
||||
#topology-medium = CSV
|
||||
areas-csv-file = cfg/topology.csv
|
||||
waypoints-csv-file = cfg/waypoints.csv
|
||||
|
||||
#reference-points-medium = CSV
|
||||
|
@ -32,10 +38,24 @@ csv-file = /tmp/owlps-positioning.log
|
|||
|
||||
[positioning]
|
||||
|
||||
# Uncomment lines to activate one or more algorithm.
|
||||
#algorithm = Real
|
||||
#algorithm = InterlinkNetworks
|
||||
#algorithm = FBCM
|
||||
#algorithm = RADAR
|
||||
#algorithm = FRBHMBasic
|
||||
|
||||
# Start and stop coordinates for the MinMax multilateration method.
|
||||
# Since MinMax is currently the only multilateration method implemented
|
||||
# in OwlPS, you should define these parameters if you use any of the
|
||||
# multilateration-based algorithms (InterlinkNetworks, FBCM, FRBHM).
|
||||
# They are declared as strings (X;Y;Z). Do not quote!
|
||||
#minmax-start = -2;-2;0
|
||||
#minmax-stop = 20;30;6
|
||||
|
||||
[output]
|
||||
|
||||
# This is the default output if none is specified.
|
||||
#medium = Terminal
|
||||
|
||||
#medium = CSV
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
# Liste des bâtiments et de leurs zones homogènes (pièces).
|
||||
# Chaque ligne définit une zone, de la forme :
|
||||
# Nom du bâtiment;Nom de la pièce;X1;Y1;X2;Y2;Z1;Z2
|
||||
|
||||
|
||||
### Rez-de-chaussée ###
|
||||
#
|
||||
Numerica;0140;1.00;7.28;6.05;3.70;0.00;2.99
|
||||
Numerica;0130;1.00;10.88;6.05;7.28;0.00;2.99
|
||||
Numerica;0120;1.00;14.48;6.05;10.88;0.00;2.99
|
||||
Numerica;0110;1.00;18.12;6.05;14.48;0.00;2.99
|
||||
Numerica;0100;1.00;21.66;6.05;18.12;0.00;2.99
|
||||
Numerica;0090;1.00;25.32;6.05;21.66;0.00;2.99
|
||||
Numerica;0080;1.00;29.00;6.05;25.32;0.00;2.99
|
||||
Numerica;0070;1.00;32.00;6.05;29.00;0.00;2.99
|
||||
Numerica;WC N0;8.20;5.30;10.00;0.50;0.00;2.99
|
||||
Numerica;0085;8.20;9.00;10.00;5.30;0.00;2.99
|
||||
Numerica;0075;8.20;10.88;10.00;9.00;0.00;2.99
|
||||
Numerica;Palier N0;5.00;3.70;8.20;0.50;0.00;2.99
|
||||
Numerica;Couloir N0 A;6.05;30.00;8.20;3.70;0.00;2.99
|
||||
Numerica;Couloir N0 B;8.20;16.50;10.00;10.88;0.00;2.99
|
||||
Numerica;Couloir N0 C;8.20;24.80;10.00;22.60;0.00;2.99
|
||||
|
||||
|
||||
### Escaliers N0 / N1 ###
|
||||
#
|
||||
# TODO : affiner la hauteur, etc.
|
||||
Numerica;Escalier N0-N1 A;8.20;22.60;10.00;16.50;0.00;6.00
|
||||
Numerica;Escalier N0-N1 B1;2.50;2.00;5.00;0.50;0.00;6.00
|
||||
Numerica;Escalier N0-N1 B palier;1.00;3.70;2.50;0.50;1.50;6.00
|
||||
Numerica;Escalier N0-N1 B2;2.50;3.70;5.00;2.00;1.50;6.00
|
||||
|
||||
|
||||
### Premier étage ###
|
||||
#
|
||||
Numerica;1100;1.00;7.28;6.05;3.70;3.00;6.00
|
||||
Numerica;0190;1.00;10.88;6.05;7.28;3.00;6.00
|
||||
Numerica;0180;1.00;14.48;6.05;10.88;3.00;6.00
|
||||
Numerica;1070;1.00;18.12;6.05;14.48;3.00;6.00
|
||||
Numerica;1060;1.00;25.32;6.05;18.12;3.00;6.00
|
||||
Numerica;1050;1.00;31.40;6.05;25.32;3.00;6.00
|
||||
Numerica;WC N1;8.20;9.00;10.00;0.50;3.00;6.00
|
||||
Numerica;1105;8.20;10.88;10.00;9.00;3.00;6.00
|
||||
Numerica;1095;8.20;29.30;10.00;24.80;3.00;6.00
|
||||
Numerica;Palier N1;5.00;3.70;8.20;0.50;3.00;6.00
|
||||
Numerica;Couloir N1 A;6.05;29.50;8.20;3.70;3.00;6.00
|
||||
Numerica;Couloir N1 B;8.20;16.50;10.00;10.88;3.00;6.00
|
||||
Numerica;Couloir N1 C;8.20;24.80;10.00;22.60;3.00;6.00
|
|
|
@ -0,0 +1,36 @@
|
|||
# Description of deployment area topology (rooms).
|
||||
#
|
||||
# IMPORTANT:
|
||||
# You need a precise topology description if you use algorithms that
|
||||
# handle it. Since none of them are currently implemented, you
|
||||
# probably can save a lot of time by skipping the topology (and
|
||||
# waypoints) description.
|
||||
#
|
||||
# ALSO IMPORTANT (EVEN IF YOU DON'T DESCRIBE THE TOPOLOGY):
|
||||
# If you use the MinMax multilateration method, you should provide
|
||||
# minmax-start and minmax-stop parameters that match the deployment
|
||||
# area. That is, the cuboid formed by these two points should include
|
||||
# the whole deployment area.
|
||||
#
|
||||
# This file lists the buildings and their "homogeneous areas" (rooms).
|
||||
#
|
||||
# Each line defines an area, using the following format:
|
||||
# Building name;Room name;X1;Y1;Z1;X2;Y2;Z2
|
||||
|
||||
|
||||
### First floor ###
|
||||
#
|
||||
#My Building;Entrance;1.00;7.28;6.05;3.70;0.00;2.99
|
||||
#My Building;Corridor A;6.05;30.00;8.20;3.70;0.00;2.99
|
||||
|
||||
|
||||
### 1st/2nd floor staircase ###
|
||||
#
|
||||
#My Building;Staircase;2.50;2.00;0.00;5.00;0.50;6.00
|
||||
#My Building;Staircase landing;1.00;3.70;1.50;2.50;0.50;6.00
|
||||
#My Building;Staircase;2.50;3.70;1.50;5.00;2.00;6.00
|
||||
|
||||
|
||||
### Second floor ###
|
||||
#
|
||||
#My Building;My desk;1.00;7.28;6.05;3.70;3.00;6.00
|
Can't render this file because it contains an unexpected character in line 15 and column 43.
|
|
@ -1,124 +1,19 @@
|
|||
# Liste des points de passage.
|
||||
# Chaque ligne définit les trois coordonnées d'un point, de la forme :
|
||||
# X;Y;Z;Nom du bâtiment 1;…;Nom du bâtiment n
|
||||
# Chaque point doit appartenir au moins à un bâtiment.
|
||||
# Description of deployment area topology (waypoints).
|
||||
#
|
||||
# IMPORTANT:
|
||||
# Maybe you don't want to define any waypoint. Please read the
|
||||
# topology example file before losing time.
|
||||
#
|
||||
# This file lists the waypoints linking the areas defined in the
|
||||
# topology file (doors, etc.).
|
||||
#
|
||||
# Each line defines a waypoint, using the following format:
|
||||
# X;Y;Z;Building1 name;…;BuildingN name
|
||||
# Each point must belong to at least one building.
|
||||
#
|
||||
# Note: for the non-convex rooms (which are defined by several areas in
|
||||
# the topology file), and for wide gates, you should define one waypoint
|
||||
# each 1m or 1.5m.
|
||||
|
||||
# Note : pour les zones appartenant à la même pièce non-convexe (ex :
|
||||
# Couloir N0 A et Couloir N0 B), on définit un point tous les 1,50 m.
|
||||
# Idem pour les portes très larges.
|
||||
|
||||
### Rez-de-chaussée ###
|
||||
|
||||
# 0140
|
||||
6.05;6.50;0.00;Numerica
|
||||
|
||||
# 0130
|
||||
6.05;7.50;0.00;Numerica
|
||||
|
||||
# 0120
|
||||
6.05;13.50;0.00;Numerica
|
||||
|
||||
# 0130 / 0120
|
||||
3.00;10.88;0.00;Numerica
|
||||
|
||||
# 0110
|
||||
6.05;14.50;0.00;Numerica
|
||||
|
||||
# 0100
|
||||
6.05;21.00;0.00;Numerica
|
||||
|
||||
# 0090
|
||||
6.05;22.25;0.00;Numerica
|
||||
|
||||
# 0080
|
||||
6.05;28.50;0.00;Numerica
|
||||
|
||||
# 0070
|
||||
6.05;29.50;0.00;Numerica
|
||||
|
||||
# WC N0
|
||||
8.20;5.00;0.00;Numerica
|
||||
|
||||
# 0085
|
||||
8.20;8.50;0.00;Numerica
|
||||
|
||||
# 0075
|
||||
8.20;9.50;0.00;Numerica
|
||||
|
||||
# Couloir N0 A / B
|
||||
8.20;11.50;0.00;Numerica
|
||||
8.20;13.00;0.00;Numerica
|
||||
8.20;14.50;0.00;Numerica
|
||||
8.20;16.00;0.00;Numerica
|
||||
|
||||
# Couloir N0 A / C
|
||||
8.20;23.70;0.00;Numerica
|
||||
|
||||
# Palier N0
|
||||
7.50;3.70;0.00;Numerica
|
||||
|
||||
|
||||
### Escaliers N0 / N1 ###
|
||||
|
||||
# Couloir N0 C / Escalier NO-N1 A
|
||||
8.95;22.60;0.00;Numerica
|
||||
|
||||
# Escalier NO-N1 A / Couloir N1 B
|
||||
8.95;16.50;3.00;Numerica
|
||||
|
||||
# Palier NO / Escalier N0-N1 B1
|
||||
5.00;1.25;0.00;Numerica
|
||||
|
||||
# Escalier N0-N1 B1 / Escalier N0-N1 B palier
|
||||
2.50;1.25;1.50;Numerica
|
||||
|
||||
# Escalier N0-N1 B palier / Escalier N0-N1 B2
|
||||
2.50;2.75;1.50;Numerica
|
||||
|
||||
# Escalier N0-N1 B2 / Palier N1
|
||||
5.00;2.75;3.00;Numerica
|
||||
|
||||
|
||||
### Premier étage ###
|
||||
|
||||
# 1100
|
||||
6.05;6.50;3.00;Numerica
|
||||
|
||||
# 0190
|
||||
6.05;7.50;3.00;Numerica
|
||||
|
||||
# 0180
|
||||
6.05;13.50;3.00;Numerica
|
||||
|
||||
# 0190 / 0180
|
||||
3.00;10.88;3.00;Numerica
|
||||
|
||||
# 1070
|
||||
6.05;14.50;3.00;Numerica
|
||||
|
||||
# 1060
|
||||
6.05;21.00;3.00;Numerica
|
||||
|
||||
# 1050
|
||||
6.05;27.75;3.00;Numerica
|
||||
|
||||
# WC N1
|
||||
8.20;5.00;3.00;Numerica
|
||||
|
||||
# 1105
|
||||
8.20;9.50;3.00;Numerica
|
||||
|
||||
# 1095
|
||||
8.20;26.00;3.00;Numerica
|
||||
|
||||
# Couloir N1 A / B
|
||||
8.20;11.50;3.00;Numerica
|
||||
8.20;13.00;3.00;Numerica
|
||||
8.20;14.50;3.00;Numerica
|
||||
8.20;16.00;3.00;Numerica
|
||||
|
||||
# Couloir N1 A / C
|
||||
8.20;23.70;3.00;Numerica
|
||||
|
||||
# Palier N1
|
||||
7.50;3.70;3.00;Numerica
|
||||
# Example waypoint:
|
||||
#1.5;4;0;My Building
|
||||
|
|
|
|
@ -1,5 +1,5 @@
|
|||
Ce répertoire sert à stocker les fichiers d'entrée de GuiNuMo-server.
|
||||
Vous pouvez trouver des fichiers d'exemple sur :
|
||||
This directory is for storing the owlps-positioning input files.
|
||||
You can find example data files at:
|
||||
http://pif.pu-pm.univ-fcomte.fr/~mcyprian/mesures/
|
||||
|
||||
-- Vous pouvez supprimer ce fichier sans danger. --
|
||||
-- You can safely delete this file. --
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Ce répertoire sert à stocker les fichiers de destination de GuiNuMo-server.
|
||||
This directory is for storing the owlps-positioning output files.
|
||||
|
||||
-- Vous pouvez supprimer ce fichier sans danger. --
|
||||
-- You can safely delete this file. --
|
||||
|
|
|
@ -127,7 +127,7 @@ inline void AccessPoint::set_channel(const unsigned int channel)
|
|||
* control is done, so you should pass a correct value.
|
||||
*
|
||||
* Note that set_channel() is more secure because a wrong channel
|
||||
* number will cause #frequency to be nullified.
|
||||
* number will cause #frequency to be set to zero.
|
||||
*/
|
||||
inline void AccessPoint::set_frequency(const unsigned long _frequency)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ void AccessPointsReaderCSV::process_access_point_line()
|
|||
if (! file.read_point3d(coord))
|
||||
throw malformed_input_data("Cannot read access point coordinates!") ;
|
||||
|
||||
long frequency ;
|
||||
unsigned long frequency ;
|
||||
if (! file.read_field(frequency))
|
||||
throw malformed_input_data("Cannot read access point frequency!") ;
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ void Area::reorder_coordinates()
|
|||
}
|
||||
|
||||
// First point is South-West
|
||||
// (or other cases such as null coordinates)
|
||||
// (or other cases such as coordinates equal to zero)
|
||||
else
|
||||
{
|
||||
// We swap nothing
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
/* *** Constructors *** */
|
||||
|
||||
|
||||
CalibrationRequest::CalibrationRequest(uint_fast8_t _type):
|
||||
CalibrationRequest::
|
||||
CalibrationRequest(uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION):
|
||||
reference_point(NULL), direction(Direction())
|
||||
{
|
||||
type = _type ;
|
||||
|
@ -16,8 +17,8 @@ CalibrationRequest::CalibrationRequest(uint_fast8_t _type):
|
|||
CalibrationRequest::
|
||||
CalibrationRequest(const Request &source,
|
||||
ReferencePoint *_reference_point = NULL,
|
||||
const Direction &_direction,
|
||||
uint_fast8_t _type):
|
||||
const Direction &_direction = Direction(),
|
||||
uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION):
|
||||
Request(source), reference_point(_reference_point),
|
||||
direction(_direction)
|
||||
{
|
||||
|
|
|
@ -16,14 +16,16 @@ protected:
|
|||
Direction direction ;
|
||||
|
||||
public:
|
||||
CalibrationRequest(uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION) ;
|
||||
CalibrationRequest(uint_fast8_t _type) ;
|
||||
|
||||
CalibrationRequest(const CalibrationRequest &source):
|
||||
Request(source), reference_point(source.reference_point),
|
||||
direction(source.direction) {}
|
||||
|
||||
CalibrationRequest(const Request &source,
|
||||
ReferencePoint *_reference_point,
|
||||
const Direction &_direction = Direction(),
|
||||
uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION) ;
|
||||
const Direction &_direction,
|
||||
uint_fast8_t _type) ;
|
||||
|
||||
~CalibrationRequest(void) {}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
using namespace std ;
|
||||
using std::tr1::unordered_map ;
|
||||
|
||||
#define DEBUG
|
||||
|
||||
|
||||
|
||||
/* *** Operations *** */
|
||||
|
@ -39,18 +41,28 @@ const Request& InputCSV::get_next_request()
|
|||
// Read Mobile MAC field
|
||||
string mac_mobile ;
|
||||
if (! file.read_field(mac_mobile)) // Wrong number of fields
|
||||
{
|
||||
#ifdef DEBUG
|
||||
cerr << "InputCSV: cannot read mac_mobile.\n" ;
|
||||
#endif // DEBUG
|
||||
return *current_request ;
|
||||
}
|
||||
const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ;
|
||||
current_request->set_mobile(&mobile) ;
|
||||
|
||||
// Read request type
|
||||
uint8_t type ;
|
||||
if (! file.read_field(type))
|
||||
uint16_t type_r ;
|
||||
if (! file.read_field(type_r))
|
||||
{
|
||||
// Wrong number of fields: blank current request
|
||||
current_request->clear() ;
|
||||
#ifdef DEBUG
|
||||
cerr << "InputCSV: cannot read type.\n" ;
|
||||
#endif // DEBUG
|
||||
return *current_request ;
|
||||
}
|
||||
type = type_r ;
|
||||
current_request->set_type(type) ;
|
||||
|
||||
// Read Timestamp field
|
||||
|
@ -59,6 +71,9 @@ const Request& InputCSV::get_next_request()
|
|||
{
|
||||
// Wrong number of fields: blank current request
|
||||
current_request->clear() ;
|
||||
#ifdef DEBUG
|
||||
cerr << "InputCSV: cannot read timestamp.\n" ;
|
||||
#endif // DEBUG
|
||||
return *current_request ;
|
||||
}
|
||||
current_request->set_time_sent(timestamp) ;
|
||||
|
@ -69,6 +84,9 @@ const Request& InputCSV::get_next_request()
|
|||
{
|
||||
// Wrong number of fields: blank current request
|
||||
current_request->clear() ;
|
||||
#ifdef DEBUG
|
||||
cerr << "InputCSV: cannot read coordinates.\n" ;
|
||||
#endif // DEBUG
|
||||
return *current_request ;
|
||||
}
|
||||
|
||||
|
@ -79,6 +97,9 @@ const Request& InputCSV::get_next_request()
|
|||
{
|
||||
// Wrong number of fields: blank current request
|
||||
current_request->clear() ;
|
||||
#ifdef DEBUG
|
||||
cerr << "InputCSV: cannot read direction.\n" ;
|
||||
#endif // DEBUG
|
||||
return *current_request ;
|
||||
}
|
||||
if (direction_int != 0)
|
||||
|
@ -95,6 +116,9 @@ const Request& InputCSV::get_next_request()
|
|||
{
|
||||
// Wrong number of fields: blank current request
|
||||
current_request->clear() ;
|
||||
#ifdef DEBUG
|
||||
cerr << "InputCSV: cannot read mac_ap.\n" ;
|
||||
#endif // DEBUG
|
||||
return *current_request ;
|
||||
}
|
||||
const AccessPoint &ap = Stock::find_create_ap(mac_ap) ;
|
||||
|
@ -108,15 +132,17 @@ const Request& InputCSV::get_next_request()
|
|||
if (type == OWL_REQUEST_CALIBRATION ||
|
||||
type == OWL_REQUEST_AUTOCALIBRATION)
|
||||
{
|
||||
current_request_to_calibration_request(type) ;
|
||||
CalibrationRequest *request =
|
||||
static_cast<CalibrationRequest*>(current_request) ;
|
||||
request->set_direction(direction) ;
|
||||
ReferencePoint position(pos) ;
|
||||
const ReferencePoint &reference_point =
|
||||
Stock::find_create_reference_point(position) ;
|
||||
request->set_reference_point(&reference_point) ;
|
||||
current_request_to_calibration_request(&reference_point,
|
||||
direction, type) ;
|
||||
}
|
||||
|
||||
// We set the real coordinates (if found) only for non-calibration
|
||||
// requests
|
||||
else if (pos)
|
||||
current_request->set_real_position(pos) ;
|
||||
|
||||
return *current_request ;
|
||||
}
|
||||
|
|
|
@ -175,12 +175,12 @@ void InputDataReader::read_from_reference_points_media()
|
|||
{
|
||||
while (! (*i)->eof())
|
||||
{
|
||||
Request &request =
|
||||
const_cast<Request&>((*i)->get_next_request()) ;
|
||||
const Request &request = (*i)->get_next_request() ;
|
||||
if (! request)
|
||||
continue ;
|
||||
CalibrationRequest *calibration_request =
|
||||
dynamic_cast<CalibrationRequest*>(&request) ;
|
||||
dynamic_cast<CalibrationRequest*>(
|
||||
const_cast<Request*>(&request)) ;
|
||||
|
||||
if (calibration_request == NULL)
|
||||
cerr << "Warning! Invalid calibration request at line "
|
||||
|
|
|
@ -24,18 +24,27 @@ InputMedium::~InputMedium()
|
|||
|
||||
|
||||
void InputMedium::
|
||||
current_request_to_calibration_request(uint_fast8_t request_type)
|
||||
current_request_to_calibration_request(
|
||||
const ReferencePoint *const reference_point,
|
||||
const Direction &direction,
|
||||
const uint_fast8_t request_type)
|
||||
{
|
||||
if (dynamic_cast<CalibrationRequest*>(current_request) != NULL)
|
||||
CalibrationRequest *calibration_request =
|
||||
dynamic_cast<CalibrationRequest*>(current_request) ;
|
||||
if (calibration_request != NULL)
|
||||
{
|
||||
current_request->set_type(request_type) ;
|
||||
calibration_request->set_reference_point(reference_point) ;
|
||||
calibration_request->set_direction(direction) ;
|
||||
calibration_request->set_type(request_type) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
Request *tmp = current_request ;
|
||||
current_request = NULL ;
|
||||
current_request = new CalibrationRequest(*tmp) ;
|
||||
current_request->set_type(request_type) ;
|
||||
current_request =
|
||||
new CalibrationRequest(*tmp,
|
||||
const_cast<ReferencePoint*>(reference_point),
|
||||
direction, request_type) ;
|
||||
delete tmp ;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef _OWLPS_POSITIONING_INPUTMEDIUM_HH_
|
||||
#define _OWLPS_POSITIONING_INPUTMEDIUM_HH_
|
||||
|
||||
class ReferencePoint ;
|
||||
class Direction ;
|
||||
|
||||
#include "request.hh"
|
||||
|
||||
/// Super class of all input media
|
||||
|
@ -51,7 +54,9 @@ public:
|
|||
|
||||
/// Converts #current_request into a CalibrationRequest
|
||||
void current_request_to_calibration_request(
|
||||
uint_fast8_t request_type = OWL_REQUEST_CALIBRATION) ;
|
||||
const ReferencePoint *const reference_point,
|
||||
const Direction &direction,
|
||||
uint_fast8_t request_type) ;
|
||||
/// Clears (reallocates to Request if needed) #current_request
|
||||
void clear_current_request(void) ;
|
||||
|
||||
|
|
|
@ -144,18 +144,25 @@ const Request& InputUDPSocket::get_next_request()
|
|||
if (request.type == OWL_REQUEST_CALIBRATION ||
|
||||
request.type == OWL_REQUEST_AUTOCALIBRATION)
|
||||
{
|
||||
current_request_to_calibration_request(request.type) ;
|
||||
CalibrationRequest *calib_request =
|
||||
static_cast<CalibrationRequest*>(current_request) ;
|
||||
|
||||
calib_request->set_direction(Direction(request.direction)) ;
|
||||
|
||||
ReferencePoint position(owl_ntohf(request.x_position),
|
||||
owl_ntohf(request.y_position),
|
||||
owl_ntohf(request.z_position)) ;
|
||||
const ReferencePoint &reference_point =
|
||||
Stock::find_create_reference_point(position) ;
|
||||
calib_request->set_reference_point(&reference_point) ;
|
||||
current_request_to_calibration_request(&reference_point,
|
||||
Direction(request.direction),
|
||||
request.type) ;
|
||||
}
|
||||
|
||||
// We set the real coordinates (if found) only for non-calibration
|
||||
// requests
|
||||
else
|
||||
{
|
||||
Point3D pos(owl_ntohf(request.x_position),
|
||||
owl_ntohf(request.y_position),
|
||||
owl_ntohf(request.z_position)) ;
|
||||
if (pos)
|
||||
current_request->set_real_position(pos) ;
|
||||
}
|
||||
|
||||
return *current_request ;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "multilaterationalgorithm.hh"
|
||||
#include "minmax.hh"
|
||||
#include "mobile.hh"
|
||||
#include "configuration.hh"
|
||||
#include "posexcept.hh"
|
||||
|
||||
using namespace std ;
|
||||
using std::tr1::unordered_map ;
|
||||
|
@ -14,10 +16,20 @@ MultilaterationAlgorithm::MultilaterationAlgorithm():
|
|||
request(NULL)
|
||||
{
|
||||
// Will be changed when other multilateration methods will be
|
||||
// implemented
|
||||
multilateration_method = new MinMax(Point3D(-0.5, -0.5, 0),
|
||||
Point3D(10, 31.5, 6)) ;
|
||||
// FIXME: minmax start and stop
|
||||
// implemented.
|
||||
|
||||
if (! Configuration::is_configured("positioning.minmax-start") ||
|
||||
! Configuration::is_configured("positioning.minmax-stop"))
|
||||
throw missing_configuration(
|
||||
"You want to use MinMax, but either positioning.minmax-start or"
|
||||
" positioning.minmax-stop is not defined!") ;
|
||||
|
||||
Point3D minmax_start(
|
||||
Configuration::string_value("positioning.minmax-start")) ;
|
||||
Point3D minmax_stop(
|
||||
Configuration::string_value("positioning.minmax-stop")) ;
|
||||
|
||||
multilateration_method = new MinMax(minmax_start, minmax_stop) ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,33 @@
|
|||
#include "point3d.hh"
|
||||
#include "posexcept.hh"
|
||||
|
||||
#include <sstream>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
|
||||
/* *** Constructors *** */
|
||||
|
||||
|
||||
Point3D::Point3D(const string &source)
|
||||
{
|
||||
float pos[3] ;
|
||||
istringstream iss(source) ;
|
||||
|
||||
for (int i = 0 ; i < 2 ; ++i)
|
||||
{
|
||||
iss >> pos[i] ;
|
||||
if (iss.get() != ';')
|
||||
throw malformed_input_data(
|
||||
"Point3D(string): cannot extract coordinates!") ;
|
||||
}
|
||||
iss >> pos[2] ;
|
||||
|
||||
set_coordinates(pos) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* *** Distance operations *** */
|
||||
|
@ -84,16 +109,29 @@ bool Point3D::operator<(const Point3D &source) const
|
|||
}
|
||||
|
||||
|
||||
Point3D::operator std::string(void) const
|
||||
Point3D::operator string(void) const
|
||||
{
|
||||
std::ostringstream oss ;
|
||||
ostringstream oss ;
|
||||
oss << *this ;
|
||||
return oss.str() ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \em true if either #x, #y or #z is non-zero.
|
||||
* @return \em false if #x, #y and #z are defined to 0.
|
||||
*/
|
||||
Point3D::operator bool(void) const
|
||||
{
|
||||
return
|
||||
x != 0 &&
|
||||
y != 0 &&
|
||||
z != 0 ;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream &os, const Point3D &p)
|
||||
|
||||
|
||||
ostream& operator<<(ostream &os, const Point3D &p)
|
||||
{
|
||||
os << "(" << p.x << ";" << p.y << ";" << p.z << ")" ;
|
||||
return os ;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef _OWLPS_POSITIONING_POINT3D_HH_
|
||||
#define _OWLPS_POSITIONING_POINT3D_HH_
|
||||
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <cmath>
|
||||
|
||||
|
@ -22,6 +23,8 @@ public:
|
|||
Point3D(const float source[3]):
|
||||
x(source[0]), y(source[1]), z(source[2]) {}
|
||||
|
||||
Point3D(const std::string &source) ;
|
||||
|
||||
virtual ~Point3D(void) {}
|
||||
|
||||
/** @name Read accessors */
|
||||
|
@ -69,6 +72,7 @@ public:
|
|||
bool operator>(const Point3D &source) const ;
|
||||
bool operator<=(const Point3D &source) const ;
|
||||
bool operator>=(const Point3D &source) const ;
|
||||
operator bool(void) const ;
|
||||
operator std::string(void) const ;
|
||||
//@}
|
||||
|
||||
|
|
|
@ -51,7 +51,11 @@ void Positioning::initialise_algorithms()
|
|||
i != algo_names.end() ; ++i)
|
||||
{
|
||||
if (*i == "Real")
|
||||
algorithms.push_back(new RealPosition) ;
|
||||
/* In order to compute the errors of the other algorithms,
|
||||
* Real must be the first for each request, so we add it at
|
||||
* the begining.
|
||||
*/
|
||||
algorithms.insert(algorithms.begin(), new RealPosition) ;
|
||||
|
||||
else if (*i == "FBCM")
|
||||
{
|
||||
|
@ -87,10 +91,23 @@ void Positioning::loop()
|
|||
if (! request)
|
||||
continue ;
|
||||
|
||||
Point3D real_position ;
|
||||
bool compute_error = false ;
|
||||
ResultList results(&request) ;
|
||||
for (algo = algorithms.begin() ; algo != algorithms.end() ;
|
||||
++algo)
|
||||
results.add((*algo)->compute(request)) ;
|
||||
{
|
||||
Result res((*algo)->compute(request)) ;
|
||||
if (compute_error)
|
||||
res.compute_error(real_position) ;
|
||||
else if ((*algo)->get_name() == "Real")
|
||||
{
|
||||
compute_error = true ;
|
||||
real_position = res.get_position() ;
|
||||
}
|
||||
results.add(res) ;
|
||||
}
|
||||
|
||||
output.write(results) ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,18 @@ public:
|
|||
name(_name) {}
|
||||
virtual ~PositioningAlgorithm(void) {}
|
||||
|
||||
const std::string& get_name(void) const ;
|
||||
|
||||
virtual Result compute(const Request &request) = 0 ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
inline const std::string& PositioningAlgorithm::get_name() const
|
||||
{
|
||||
return name ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // _OWLPS_POSITIONING_POSITIONINGALGORITHM_HH_
|
||||
|
|
|
@ -6,16 +6,18 @@
|
|||
|
||||
Result RealPosition::compute(const Request &request)
|
||||
{
|
||||
const Point3D *coordinates = NULL ;
|
||||
|
||||
const CalibrationRequest *calibration_request =
|
||||
dynamic_cast<const CalibrationRequest*>(&request) ;
|
||||
|
||||
if (calibration_request != NULL)
|
||||
{
|
||||
Point3D *coordinates =
|
||||
static_cast<Point3D*>(
|
||||
coordinates = static_cast<Point3D*>(
|
||||
calibration_request->get_reference_point()) ;
|
||||
|
||||
coordinates = request.get_real_position() ;
|
||||
if (coordinates)
|
||||
return Result(*coordinates, name) ;
|
||||
}
|
||||
|
||||
return Result(name) ;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
class RealPosition: public PositioningAlgorithm
|
||||
{
|
||||
public:
|
||||
RealPosition(void): PositioningAlgorithm("RealPosition") {}
|
||||
RealPosition(void): PositioningAlgorithm("Real") {}
|
||||
|
||||
Result compute(const Request &request) ;
|
||||
} ;
|
||||
|
|
|
@ -22,6 +22,25 @@ Request::~Request()
|
|||
/* *** Write accessors *** */
|
||||
|
||||
|
||||
inline void Request::clear_real_position()
|
||||
{
|
||||
if (real_position)
|
||||
{
|
||||
delete real_position ;
|
||||
real_position = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Request::set_real_position(const Point3D &_real_position)
|
||||
{
|
||||
if (real_position)
|
||||
*real_position = _real_position ;
|
||||
else
|
||||
real_position = new Point3D(_real_position) ;
|
||||
}
|
||||
|
||||
|
||||
/// Reinitialises all attributes
|
||||
/**
|
||||
* - #mobile is NULLified, but the value it pointed to is not deleted.
|
||||
|
@ -34,6 +53,7 @@ void Request::clear()
|
|||
mobile = NULL ;
|
||||
time_sent.clear() ;
|
||||
measurements.clear() ;
|
||||
clear_real_position() ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,6 +71,10 @@ const Request& Request::operator=(const Request &source)
|
|||
time_sent = source.time_sent ;
|
||||
measurements = source.measurements ;
|
||||
|
||||
clear_real_position() ;
|
||||
if (source.real_position)
|
||||
real_position = new Point3D(*source.real_position) ;
|
||||
|
||||
return *this ;
|
||||
}
|
||||
|
||||
|
@ -60,7 +84,13 @@ bool Request::operator==(const Request &source) const
|
|||
if (this == &source)
|
||||
return true ;
|
||||
|
||||
bool real_position_equal =
|
||||
real_position &&
|
||||
source.real_position &&
|
||||
*real_position == *source.real_position ;
|
||||
|
||||
return
|
||||
real_position_equal &&
|
||||
type == source.type &&
|
||||
mobile == source.mobile &&
|
||||
time_sent == source.time_sent &&
|
||||
|
@ -72,8 +102,10 @@ bool Request::operator==(const Request &source) const
|
|||
ostream& operator<<(ostream &os, const Request &r)
|
||||
{
|
||||
// Timestamp
|
||||
os
|
||||
<< "At " << r.time_sent << "; " ;
|
||||
os << "At " << r.time_sent << "; " ;
|
||||
|
||||
if (r.real_position)
|
||||
os << " Real coordinates : " << *r.real_position << "; " ;
|
||||
|
||||
// MAC address
|
||||
os
|
||||
|
@ -88,9 +120,7 @@ ostream& operator<<(ostream &os, const Request &r)
|
|||
else
|
||||
for (unordered_map<string, Measurement>::const_iterator i
|
||||
= r.measurements.begin() ; i != r.measurements.end() ; ++i)
|
||||
{
|
||||
os << '\n' << i->first << ": " << i->second ;
|
||||
}
|
||||
|
||||
return os ;
|
||||
}
|
||||
|
@ -107,8 +137,10 @@ size_t hash_value(const Request &source)
|
|||
|
||||
boost::hash_combine(seed, source.type) ;
|
||||
boost::hash_combine(seed, source.time_sent) ;
|
||||
if (source.mobile != NULL)
|
||||
if (source.mobile)
|
||||
boost::hash_combine(seed, source.mobile->get_mac_addr()) ;
|
||||
if (source.real_position)
|
||||
boost::hash_combine(seed, source.real_position) ;
|
||||
|
||||
return seed ;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,11 @@ protected:
|
|||
/** Note that this is not a pointer list, values are actually stored.
|
||||
The \em string parameter is the MAC address of the AP. */
|
||||
std::tr1::unordered_map<std::string, Measurement> measurements ;
|
||||
/// \brief Real coordinates of the request (normally unavailable for a
|
||||
/// standard positioning request)
|
||||
Point3D *real_position ;
|
||||
|
||||
void clear_real_position(void) ;
|
||||
|
||||
public:
|
||||
Request(const Mobile *_mobile = NULL,
|
||||
|
@ -35,12 +40,12 @@ public:
|
|||
std::tr1::unordered_map<std::string, Measurement>()):
|
||||
type(OWL_REQUEST_UNDEFINED),
|
||||
mobile(const_cast<Mobile*>(_mobile)), time_sent(_time_sent),
|
||||
measurements(_measurements) {}
|
||||
measurements(_measurements), real_position(NULL) {}
|
||||
|
||||
Request(const std::tr1::unordered_map<std::string, Measurement>
|
||||
&_measurements):
|
||||
type(OWL_REQUEST_UNDEFINED),
|
||||
mobile(NULL), measurements(_measurements) {}
|
||||
mobile(NULL), measurements(_measurements), real_position(NULL) {}
|
||||
|
||||
Request(const Timestamp &_time_sent,
|
||||
const std::tr1::unordered_map<std::string, Measurement>
|
||||
|
@ -48,12 +53,12 @@ public:
|
|||
std::tr1::unordered_map<std::string, Measurement>()):
|
||||
type(OWL_REQUEST_UNDEFINED),
|
||||
mobile(NULL), time_sent(_time_sent),
|
||||
measurements(_measurements) {}
|
||||
measurements(_measurements), real_position(NULL) {}
|
||||
|
||||
Request(const Request &source):
|
||||
type(source.type),
|
||||
mobile(source.mobile), time_sent(source.time_sent),
|
||||
measurements(source.measurements) {}
|
||||
measurements(source.measurements), real_position(NULL) {}
|
||||
|
||||
virtual ~Request(void) ;
|
||||
|
||||
|
@ -64,6 +69,7 @@ public:
|
|||
const Timestamp& get_time_sent(void) const ;
|
||||
const std::tr1::unordered_map<std::string, Measurement>&
|
||||
get_measurements(void) const ;
|
||||
const Point3D* get_real_position(void) const ;
|
||||
//@}
|
||||
|
||||
/** @name Write accessors */
|
||||
|
@ -73,6 +79,7 @@ public:
|
|||
void set_time_sent(const Timestamp &_time_sent) ;
|
||||
void set_measurements(const std::tr1::unordered_map
|
||||
<std::string, Measurement> &_measurements) ;
|
||||
void set_real_position(const Point3D &_real_position) ;
|
||||
void clear(void) ;
|
||||
//@}
|
||||
|
||||
|
@ -122,6 +129,12 @@ Request::get_measurements(void) const
|
|||
}
|
||||
|
||||
|
||||
inline const Point3D* Request::get_real_position(void) const
|
||||
{
|
||||
return real_position ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* *** Write accessors *** */
|
||||
|
||||
|
@ -164,7 +177,8 @@ inline bool Request::operator!=(const Request &comp) const
|
|||
|
||||
/**
|
||||
* @return \em false if the Request is empty.
|
||||
* @return \em true if at least one attribute is initialised.
|
||||
* @return \em true if at least one attribute (other than #type) is
|
||||
* initialised.
|
||||
*/
|
||||
inline Request::operator bool() const
|
||||
{
|
||||
|
|
|
@ -7,6 +7,28 @@ using namespace std ;
|
|||
|
||||
|
||||
|
||||
/* *** Constructors *** */
|
||||
|
||||
|
||||
Result::Result(const Point3D &_position, const std::string &_algorithm,
|
||||
const Point3D &real_position):
|
||||
position(_position), algorithm(_algorithm)
|
||||
{
|
||||
compute_error(real_position) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* *** Write accessors *** */
|
||||
|
||||
|
||||
void Result::compute_error(const Point3D &real_position)
|
||||
{
|
||||
error = position.distance(real_position) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* *** Operators *** */
|
||||
|
||||
|
||||
|
@ -42,7 +64,9 @@ const string Result::to_csv() const
|
|||
<< algorithm
|
||||
<< ';' << position.get_x()
|
||||
<< ';' << position.get_y()
|
||||
<< ';' << position.get_z() ;
|
||||
<< ';' << position.get_z()
|
||||
<< ';' << "Error"
|
||||
<< ';' << error ;
|
||||
|
||||
return csv_line.str() ;
|
||||
}
|
||||
|
@ -54,5 +78,7 @@ std::ostream& operator<<(ostream &os, const Result &r)
|
|||
os
|
||||
<< "The result of the algorithm " << r.algorithm
|
||||
<< " is: " << r.position ;
|
||||
if (r.error >= 0)
|
||||
os << ", error = " << r.error << " m" ;
|
||||
return os ;
|
||||
}
|
||||
|
|
|
@ -9,20 +9,33 @@
|
|||
class Result
|
||||
{
|
||||
protected:
|
||||
/// Computed coordinates of the mobile
|
||||
Point3D position ;
|
||||
/// Algorithm used to compute the position
|
||||
std::string algorithm ;
|
||||
/// Distance error between the real coordinates and the computed point
|
||||
/** The error is set to -1 if the real coordinates are unknown. */
|
||||
float error ;
|
||||
|
||||
public:
|
||||
Result(const std::string &_algorithm = "UnknownAlgorithm"):
|
||||
algorithm(_algorithm) {}
|
||||
algorithm(_algorithm), error(-1) {}
|
||||
Result(const Point3D &_position, const std::string &_algorithm):
|
||||
position(_position), algorithm(_algorithm) {}
|
||||
position(_position), algorithm(_algorithm), error(-1) {}
|
||||
Result(const Point3D &_position, const std::string &_algorithm,
|
||||
const Point3D &real_position) ;
|
||||
~Result(void) {}
|
||||
|
||||
/** @name Read accessors */
|
||||
//@{
|
||||
const std::string& get_algorithm(void) const ;
|
||||
const Point3D& get_position(void) const ;
|
||||
float get_error(void) const ;
|
||||
//@}
|
||||
|
||||
/** @name Write accessors */
|
||||
//@{
|
||||
void compute_error(const Point3D &real_position) ;
|
||||
//@}
|
||||
|
||||
/** @name Operators */
|
||||
|
@ -59,6 +72,12 @@ inline const Point3D& Result::get_position() const
|
|||
}
|
||||
|
||||
|
||||
inline float Result::get_error() const
|
||||
{
|
||||
return error ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* *** Operators *** */
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ inline bool Timestamp::operator>=(const uint64_t source) const
|
|||
|
||||
inline Timestamp::operator bool() const
|
||||
{
|
||||
return static_cast<uint64_t>(*this) > 0 ;
|
||||
return timestamp.tv_sec > 0 || timestamp.tv_nsec > 0 ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ namespace po = boost::program_options ;
|
|||
|
||||
/* *** Default value definitions *** */
|
||||
|
||||
#define DEFAULT_CONFIG_FILE_NAME "cfg/owlps-positioning.cfg"
|
||||
#define DEFAULT_CONFIG_FILE_NAME \
|
||||
"/usr/local/etc/owlps/owlps-positioning.cfg"
|
||||
|
||||
|
||||
|
||||
|
@ -171,6 +172,12 @@ void UserInterface::fill_positioning_options()
|
|||
"Algorithms used to compute positions. You can specify \
|
||||
this option more than once (but at least once). Allowed: Real, FBCM, \
|
||||
FRBHMBasic, InterlinkNetworks, RADAR.")
|
||||
("positioning.minmax-start", po::value<string>(),
|
||||
"Coordinates of the start point of the MinMax multilateration \
|
||||
method (string format: \"X;Y;Z\").")
|
||||
("positioning.minmax-stop", po::value<string>(),
|
||||
"Coordinates of the stop point of the MinMax multilateration \
|
||||
method (string format: \"X;Y;Z\").")
|
||||
;
|
||||
|
||||
file_options->add(options) ;
|
||||
|
|
Loading…
Reference in New Issue