Commit Graph

212 Commits

Author SHA1 Message Date
Matteo Cypriani 9944fef40d [Positioner] Switch to C++11
This is a very basic switch, we don't use any of the C++11 features yet.
2013-05-16 17:46:44 -04:00
Matteo Cypriani f55672ef01 [Positioner] Add class CSVStringReader
Code separated from CSVFileReader, which now inherits from both
TextFileReader and CSVStringReader.
2013-05-16 16:59:15 -04:00
Matteo Cypriani 0614b52219 [lib] Stop defining owl_bool (use stdbool.h)
We don't define our own boolean type in owlps.h any more: bool (from
stdbool.h) is used instead.
2013-05-15 15:46:13 -04:00
Matteo Cypriani aa2e72f423 [Positioner] positioner.conf: comment lines
Comment unnecessary lines from cfg/owlps-positioner.conf.
2013-05-14 13:37:18 -04:00
Matteo Cypriani 5a7d30ea84 [Positioner] InputUDPSocket: include unistd.h
Fixes compilation on DragonFly.
2013-05-01 13:41:05 -04:00
Matteo Cypriani 64c2ac9a58 Makefiles: move OS detection in common.mk
This fixes compilation on BSD.
2013-04-30 16:50:14 -04:00
Matteo Cypriani 2a23e31a28 Fix compilation warning/errors for OpenWrt
In lib-resultreader and Positioner.
2013-04-24 13:51:58 -04:00
Matteo Cypriani 4aed9c1ef0 Radiotap Antenna Signal field is signed
Using int8_t instead of uint8_t which was erroneously used to code the
Antenna Signal radiotap field.
2013-04-24 10:59:55 -04:00
Matteo Cypriani ae1fa584a7 [Positioner] Measurement: intervals are uints 2012-11-03 16:51:13 +01:00
Matteo Cypriani 8455dd0d74 Add copyright & license information
Add the file COPYRIGHT, the CeCILL license's text, and update the source
files' headers with the copyright and license information.
2012-11-03 14:52:33 +01:00
Matteo Cypriani 69390a3f6b [Positioner] Fix Request::to_csv() (missing ;) 2012-08-30 16:05:23 +02:00
Matteo Cypriani 3808c2ce6f [Positioner] Add Request::to_csv()
Code moved from InputLogCSV.
2012-08-30 10:23:09 +02:00
Matteo Cypriani 8c93cc467e [Positioner] Add option output.2d-error 2012-08-24 16:39:00 +02:00
Matteo Cypriani 5fd5f13b93 [Positioner] Add Point3D::distance_2d() 2012-08-24 16:33:47 +02:00
Matteo Cypriani b11b63c46b [Positioner] cfg: improve comments 2012-08-24 16:33:47 +02:00
Matteo Cypriani 8cf840ba1b [Positioner] Reindent input.cc 2012-08-24 16:28:44 +02:00
Matteo Cypriani 18761a06ce [Positioner] Input: fix calib. request handling
Reorganise the tests in order to really ignore calibration requests if
positioning.accept-new-calibration-requests = false and
positioning.position-calibration-requests = false.

Display a message when a calibration request is ignored.
2012-07-24 16:21:03 +02:00
Matteo Cypriani f6fa26507f [Positioner] EvAAL: do not send \0
The NULL character must not be sent at the end of the result string, or
the Socket Server behaves weirdly.
2012-07-10 16:15:45 +02:00
Matteo Cypriani 307da87760 [Positioner] EvAAL: fix AOI printing
The AOI (Area Of Interest) number must be printed only if greater than
zero.
2012-07-10 16:13:15 +02:00
Matteo Cypriani db63c88a45 [Positioner] EvAAL: handle empty results' lists 2012-07-10 16:11:25 +02:00
Matteo Cypriani 2d2b8551fb [Positioner] Rename cfg/listeners.csv (typo) 2012-06-28 21:44:00 +02:00
Matteo Cypriani 8f3bf50aa5 [Positioner] Fix "interval" similarity algorithm
The "interval" similarity algorithm now handles the case where no packet
is found within the interval.
2012-06-20 18:39:21 +02:00
Matteo Cypriani 1f22ece3d9 [Positioner] PosUtil::is_in_interval(): bound == 0
PosUtil::is_in_interval() now handles a zero interval width. That is
required in case of standard deviation equals to zero.
2012-06-20 18:36:30 +02:00
Matteo Cypriani 6a13e4fc54 [Positioner] Fix Point3D::operator bool() 2012-06-20 17:26:00 +02:00
Matteo Cypriani 91ff55ca0e [Positioner] Measurement: variance in dBm
Along with the variance in mW, compute the variance of the dBm values.
2012-06-19 17:56:10 +02:00
Matteo Cypriani 6d40ecc8c5 [Positioner] Measurement: fix recalculate_average()
Adds the attribute variance_size to handle the number of elements taken
into account in the variance computation, instead of relying on
ss_list.size(), which is a mistake in the case of recalculate_average().
2012-06-19 17:41:10 +02:00
Matteo Cypriani b952dc94ab [Positioner] Measurement: rename variance variables
We compute only the variance for the milliwatt values, so the
variance-related variables are renamed with the _mw suffix.
2012-06-19 17:13:27 +02:00
Matteo Cypriani 812c616841 [Positioner] autocalibration.cc: missing includes 2012-06-14 13:42:05 +02:00
Matteo Cypriani 3640bcf0ba [Positioner] replay option is boolean
Fixes the test of the replay option: it is a boolean, not a
configured/not configured option.
2012-06-08 19:27:49 +02:00
Matteo Cypriani dce842bad3 [Positioner] Add option unique-calibration-requests
The default behaviour is preserved.
2012-06-08 19:27:49 +02:00
Matteo Cypriani 167cc1fcb6 [Positioner] Input: test the request earlier
Return before to update the current time if the request is empty.
2012-06-08 19:27:49 +02:00
Matteo Cypriani 85c955bb03 [Positioner] Clean requests in Input
Delete the old requests in the Input class rather than in Positioning,
so autocalibration does not use old requests.
2012-06-08 18:00:37 +02:00
Matteo Cypriani f3c00334bf [Positioner] cfg: add a few comments 2012-06-08 14:42:12 +02:00
Matteo Cypriani f8f6ca4660 [Positioner] CR timeout depends on replay mode
In Stock::delete_calibration_requests_older_than(), test if we run in
replay mode or not.
2012-06-08 14:41:50 +02:00
Matteo Cypriani 4e3843a502 [Positioner] Verbose Timestamp::update_current_time() 2012-06-08 14:41:50 +02:00
Matteo Cypriani 451e665eda [Positioner] Timestamp::elapsed(): use current time
Timestamp::elapsed() now calls Timestamp::get_current_time() instead of
comparing to now().
2012-06-08 14:41:50 +02:00
Matteo Cypriani 69461e5c94 [Positioner] Input: update current time (replay)
In replay mode, update the current time when getting a new request.
2012-06-08 14:41:50 +02:00
Matteo Cypriani d44680751c [Positioner] Timestamp: *current_time() use "replay"
Timestamp::get_current_time() now returns the current time if the replay
mode is unactivated, or the most recent request's time in replay mode.
2012-06-08 14:41:50 +02:00
Matteo Cypriani 692571e382 [Positioner] UserInterface: add option "replay" 2012-06-08 14:41:37 +02:00
Matteo Cypriani 0d527ec77d [Positioner] Add Timestamp::current_time 2012-06-08 12:29:29 +02:00
Matteo Cypriani ff5bab01cc [Positioner] Timestamp: less/greater -> before/after
Renames less_than() and greater_than(), they become before() and
after().
2012-06-08 12:29:29 +02:00
Matteo Cypriani 57cdeeb360 [Positioner] Generated requests: time received=sent
For generated calibration requests, time_sent is now equals to
time_received.
2012-06-01 19:34:58 +02:00
Matteo Cypriani 7da5196627 [Positioner] CR timeout computed with time_received
In Stock::delete_calibration_requests_older_than(), use
request.time_received instead of request.time_sent to compute the
timeout.
2012-06-01 18:49:39 +02:00
Matteo Cypriani edd0d48faa [Positioner] InputMedium: initialise time_received
When reading a new request, set current_request.time_received.
2012-06-01 17:17:58 +02:00
Matteo Cypriani 7e55f8495c [Positioner] Request: bool op -= time_received
Fixes Request::operator bool(): since time_received is initialised at
the creation, we must not take it into account.
2012-06-01 17:17:57 +02:00
Matteo Cypriani a93653c299 [Positioner] Request: add time_received
Adds an attribute for the date at which Positioner received a request
from Aggregator.
2012-06-01 14:27:20 +02:00
Matteo Cypriani b6f167c549 [Positioner] Rename single-packet option
Option positioning.generate-single-packet-reference-points becomes
positioning.generate-multi-packet-reference-points. The default is still
true, which means the default behaviour changed.
2012-05-31 20:18:49 +02:00
Matteo Cypriani 573cb2f256 [Positioner] InputUDPSocket: s/cout/cerr/ 2012-05-31 19:47:28 +02:00
Matteo Cypriani 569cdefd94 [Positioner] Autocalibration & Stock: assertion 2012-05-31 19:47:02 +02:00
Matteo Cypriani 6e40e14863 [Positioner] Autocalibration: single packet if error
When generating multi-packets RPs, if the RPs associated with the two
APs have no packet in common, we fall back to generating a single-packet
(averaged) RP.
2012-05-31 19:47:02 +02:00
Matteo Cypriani ecae107163 [Positioner] Fix Request(Request)
Copy constructor fixed to copy nb_packets and real_positon.
2012-05-31 19:47:02 +02:00
Matteo Cypriani 14eb08b37e [Positioner] Autocalibration: fix multi-packet loop
Fixes the Autocalibration::compute_multi_packet_ss() loop that searches
for the first good measurement.
2012-05-31 19:47:02 +02:00
Matteo Cypriani d3733c2083 [Positioner] AccessPoint: avoid division by zero 2012-05-31 19:47:02 +02:00
Matteo Cypriani b8722b6a6c [Positioner] ReferencePoint: fix comments
Fixes/adds comments in delete_generated_requests().
2012-05-31 19:47:01 +02:00
Matteo Cypriani f54426c3bb [Positioner] Fix calibration-requests-timeout
Fixes Stock::delete_calibration_requests_older_than(), by calling the
new function ReferencePoint::delete_request().
2012-05-31 19:46:57 +02:00
Matteo Cypriani 038c24da05 [Positioner] PosUtil: macrofy assert_uppercase()
PosUtil::assert_uppercase() becomes a macro, to avoid a warning when
compiling with -D NDEBUG. The new name is assert_uppercase(), still
defined in posutil.hh.
2012-05-26 13:34:19 +02:00
Matteo Cypriani 77b0a13896 [Positioner] Autocalibration: clean lists
Clean ref_aps and sorted_*_angles between two iterations.
2012-05-26 12:52:50 +02:00
Matteo Cypriani 98085172de [Positioner] Cosmetics (InputCSV & Stock) 2012-05-26 12:24:00 +02:00
Matteo Cypriani bc2129a36b [Positioner] Autocalibration: fix segfault 2012-05-26 12:23:09 +02:00
Matteo Cypriani 316db76861 Makefiles: add common-rules.mk, drop openwrt files
This is the sequel of the work on the Makefiles' unification.
2012-05-24 14:19:04 +02:00
Matteo Cypriani 437c5fec8c [Positioner] Makefile: specify astyle indentation
As of Artistic Style 2.02, the default indent size changed, so we force
it to 2 spaces.
2012-05-17 11:47:30 +02:00
Matteo Cypriani 59a0ac12bd [Positioning] Autocalibration: #include <vector> 2012-05-10 11:38:21 +02:00
Matteo Cypriani f0e23521c3 [Positioner] OutputNetworkSocket: include unistd.h 2012-05-09 17:48:06 +02:00
Matteo Cypriani 92485f3f67 Add common.mk
Adapt all the Makefiles to use it.
Rename all the Makefile_atheros_openwrt-10.03 to
Makefile_atheros_openwrt.
2012-05-09 15:55:17 +02:00
Matteo Cypriani 38f34a693a [Positioner] s/level/floor/ 2012-05-02 17:32:01 +02:00
Matteo Cypriani d2f40bb49e [Positioner] Autocalibration: compute origin angle
The angle P-RX-O (formerly named angle_p) was left uninitialised. This
is fixed, and the variable was renamed origin_angle.
2012-05-02 17:32:01 +02:00
Matteo Cypriani efba4fa09b [Positioner] Fix Autocalibration::sort_reference_aps()
Fix the angle calculation in sort_reference_aps() and better comment the
code.
2012-05-02 17:32:00 +02:00
Matteo Cypriani c51d9c1c12 [Positioner] Autocalibration: fix reference angle 2012-05-02 17:32:00 +02:00
Matteo Cypriani 300c338023 [Positioner] Autocalibration: signed angles
This commit changes the way the APs are selected. Until now, the two
most acute angles were selected. Now, the angles are signed, i.e. we
differentiate the APs that are before the point to generate on the
trigonometric circle, and those that are after.

Some more refactoring was achieved, and some bugs fixed.
2012-05-02 17:32:00 +02:00
Matteo Cypriani 291ef457f5 [Positioner] Add Point3D::rotate_2d() 2012-05-02 17:32:00 +02:00
Matteo Cypriani 88a90a7abd [Positioner] Add PosUtil::deg2rad() 2012-05-02 17:32:00 +02:00
Matteo Cypriani 90fc329f82 [Positioner] Autocalibration: refactor generate_ss() 2012-05-02 17:32:00 +02:00
Matteo Cypriani 7a631e3962 [Positioner] Add class Autocalibration
The new class Autocalibration contains the code from the former huge
function Stock::generate_reference_point(). It is refactored a bit, but
still needs work. The function Stock::generate_reference_points() stays
in the Stock class for now.
2012-05-02 17:32:00 +02:00
Matteo Cypriani d479f9d080 [Positioner] posexcept: add autocalibration_error 2012-05-02 17:32:00 +02:00
Matteo Cypriani 579adbee1c [Positioner] Point3D: angle() becomes angle_2d() 2012-05-02 17:32:00 +02:00
Matteo Cypriani 8d4fa6883d [Positioner] Point3D: add square_distance_2d() 2012-05-02 17:32:00 +02:00
Matteo Cypriani 007594683c [Positioner] Point3D: delete unused distance()
Delete unused functions distance(x,y,z) and square_distance(x,y,z).
2012-05-02 17:32:00 +02:00
Matteo Cypriani 987773a4df [Positioner] s/multilateration/trilateration/
This fixes an old, forgotten, vocabulary mistake.
2012-05-02 17:32:00 +02:00
Matteo Cypriani 153d4c0ea6 [Positioner] Add similarity method "interval2" 2012-05-02 17:32:00 +02:00
Matteo Cypriani 54a387190f [Positioner] Add Measurement::nb_in_interval()
Refactor Measurement::similarity() thanks to this new function.
2012-05-02 17:32:00 +02:00
Matteo Cypriani 6a8d8ec3be [Positioner] Add PosUtil::is_in_interval() 2012-05-02 17:32:00 +02:00
Matteo Cypriani 1704ebc6b1 [Positioner] "similarity" instead of "distance"
Standardise the use of the term "similarity" instead of
"(ss_square_)distance" in the functions' and variables' names.
2012-05-02 17:32:00 +02:00
Matteo Cypriani 596c72b7a8 [Positioner] Option ss-similarity
The option positioning.ss-similarity introduced in this commit allows to
chose the desired algorithm to compare two measurements. One can chose
between the historical mean euclidean distance algorithm and the new
algorithm using the number of values within the interval
[mean-std.dev.;mean+std.dev.].
2012-05-02 17:32:00 +02:00
Matteo Cypriani ecedf307ef [Positioner] Request: fix nb_packets's type 2012-05-02 17:32:00 +02:00
Matteo Cypriani 60626196d5 [Positioner] Option generate-single-packet-RPs
The new option positioning.generate-single-packet-reference-points
allows either to generate one single packet in each generated reference
point, or try to match the real requests by generating packets
independently.
2012-05-02 17:32:00 +02:00
Matteo Cypriani 4c5ad300c3 [Positioner] Stock::generate_RP(): fix update mobile
In generate_reference_point(), update the mobile's attributes *before*
to test if the current AP should be skipped.
2012-05-02 17:32:00 +02:00
Matteo Cypriani fb9d2d0cef [Positioner] Stock::generate_RP(): cosmetic changes 2012-05-02 17:32:00 +02:00
Matteo Cypriani 833c647220 [Positioner] Add ReferencePoint::friis_idx(AP, pkt)
This function allows to get the Friis index for a single packet in a
measurement instead of for the whole measurement.
2012-05-02 17:32:00 +02:00
Matteo Cypriani f14c1de473 [Positioner] Add Measurement::get_ss(pkt_id) 2012-05-02 17:32:00 +02:00
Matteo Cypriani 2cc7f373dd [Positioner] Add Measurement::get_std_deviation() 2012-05-02 17:32:00 +02:00
Matteo Cypriani dad6e0aa11 [Positioner] Measurement::variance_square_distance() 2012-05-02 17:32:00 +02:00
Matteo Cypriani dcd902c9f0 [Positioner] Measurement: use floats, not doubles
Use floats variables for the average and variance.
2012-05-02 17:32:00 +02:00
Matteo Cypriani e687aac741 [Positioner] Fix PosUtil::ss_square_distance()
The returned distance is now "averaged" to take into account the number
of measurements in the lists. The former behaviour would lead two
couples of measurement lists with a different number of measurement to
have non-comparable distances.
2012-05-02 17:32:00 +02:00
Matteo Cypriani 7de5499816 [Positioner] Measurement::get_ss_list_size() -> get_nb_ss() 2012-05-02 17:31:59 +02:00
Matteo Cypriani 24622e4c3a [Positioner] Measurement: compute the variance
The variance is now computed along with the average. Measurement has
three new attributes:
  - average_mw (average in mW),
  - variance,
  - variance_m2 (variable used for the variance calculation).
In addition, average_ss has been renamed average_dbm (ditto for its
getter).

The computation method of the average has been changed to allow the
computation of the variance simultaneously.
2012-05-02 17:31:59 +02:00
Matteo Cypriani e98474e678 [Aggregator] Send the capture time to Positioner
The Aggregator now transmits the capture timestamp of each packet to the
positioning server. For now this timestamp is not stored, only displayed
(in verbose mode) when a request is received.
2012-05-02 17:31:49 +02:00
Matteo Cypriani b60d0d380f [Aggregator] Send the mobile's IP to Positioner
For now the positioning server only displays the mobile's IP address (in
verbose mode) and updates it in the stored Mobile.
2012-05-02 17:31:42 +02:00
Matteo Cypriani 94b9cf281f [Positioner] Autocalibration: handle levels
To generate the reference points, use only the APs at the same level as
the virtual mobile. This is very basic for now, please refer to the TODO
update for more details on what should be done.
2012-02-08 10:52:40 +01:00
Matteo Cypriani 055dca7711 [Positioner] Measurement: declare type pkt_id_t
Like ss_t, pkt_id_t is now declared in measurement.hh to help use the
same type everywhere for packet IDs.
2012-02-08 10:52:39 +01:00
Matteo Cypriani a3b8b90760 [Positioner] Add option positioning.smallest-ss
The smallest possible received SS is not hard coded into PosUtil any
more. The default value is now -99 dBm instead of -98.
2012-02-08 10:52:39 +01:00
Matteo Cypriani 427c88fd99 [Positioner] Autocalib.: weight angle/coverage
In Stock::generate_reference_point(), the coverage percentage is now
used along the angle to select the better APs.
2012-02-08 10:52:39 +01:00
Matteo Cypriani 5f26d7a28e [Positioner] AP::received_calibration…(): percents
AccessPoint::received_calibration_from_ap() now returns a percentage of
the received packets (instead of a boolean).
2012-02-08 10:52:39 +01:00
Matteo Cypriani a2629dd5a9 [Positioner] Fix Request::get_measurement(s)(mac)
Request::get_measurements(mac) is renamed Request::get_measurement(mac).
A Request can't store more than one measurement per AP, so it was a
mistake to return a vector. The new function returns a single pointer.
2012-02-08 10:52:39 +01:00
Matteo Cypriani 3cbe9c2df5 [Positioner] Option calibration-requests-timeout
Introduce the option positioning.calibration-requests-timeout, to avoid
keeping the old calibration requests.
2012-02-08 10:52:39 +01:00
Matteo Cypriani 7a6a85ad19 [Positioner] Add Configuration::uint_value() 2012-02-08 10:52:39 +01:00
Matteo Cypriani 35265e75c2 [Positioner] Timestamp: elapsed() & owl_timestamp()
New functions added in Timestamp:
  - elapsed()
  - elapsed(Timestamp)
  - operator owl_imestamp()
2012-02-08 10:52:39 +01:00
Matteo Cypriani 9c1fc429c9 [Positioner] Autocalibration: APs in coverage
In Stock::generate_reference_point(), we now select an AP only if it is
in coverage of the reference AP.
2012-02-08 10:52:39 +01:00
Matteo Cypriani d683c32ce5 [Positioner] Add Request::get_measurements(mac) 2012-02-08 10:52:39 +01:00
Matteo Cypriani 3b1bbb8b5c [Positioner] ReferencePoint::get_requests(mac) public
ReferencePoint::get_requests(mac_transmitter) is now public.
2012-02-08 10:52:39 +01:00
Matteo Cypriani 1533852a1f [Positioner] Handle the packet numbering
In Measurement, the SSs are now stored in a map (instead of a vector),
along with their packet IDs.
2012-02-08 10:52:39 +01:00
Matteo Cypriani ca249457be Makefiles: BSD-specific -I/-L 2012-02-07 17:50:19 +01:00
Matteo Cypriani d5e2c975ae Rename Positioning -> Positioner
To be consistent with the other modules, the positioning server must be
called OwlPS Positioner instead of Positioning, and the executable
owlps-positionerd (even if the daemon mode is not implemented yet).
That's a big commit for a tiny change.
2012-02-06 17:48:43 +01:00