Commit Graph

301 Commits

Author SHA1 Message Date
Matteo Cypriani 332881b305 [Positioning] Standardise InputCSV & InputUDPSocket 2011-06-16 13:13:13 +02:00
Matteo Cypriani cce949f32a [Positioning] Fix some Doxygen comments 2011-06-14 16:44:17 +02:00
Matteo Cypriani 48fa965c54 [Positioning] UserInterface: reformat strings 2011-06-08 19:05:48 +02:00
Matteo Cypriani 3ac6b440e4 Update TODOs 2011-06-08 10:56:14 +02:00
Matteo Cypriani 507072bd24 [Positioning] Option radar-average-reference-points
For RADAR, the default is now to compare the current positioning request
to each stored CalibrationRequest instead of each ReferencePoint
(averaging the calibration requests associated with the reference
point).

The new option --positioning.radar-average-reference-points allows to
activate the old behaviour (compare to reference points).

Note: the bug fixed in the previous commit caused the creation of
a ReferencePoint for each CalibrationRequest, implying the 'new'
default behaviour (one ReferencePoint was associated to only one
CalibrationRequest, so comparing each ReferencePoint or each
CalibrationRequest was giving the same result). Anyway, there was
(hopefully) no such bug in OwlPS v0.8, so it is actually the old
behaviour :-)
2011-06-08 10:25:38 +02:00
Matteo Cypriani d322221d21 [Positioning] Stock: fix ReferencePoint creation
For each calibration request read, a new ReferencePoint was created in
Stock. This is because of the behaviour of unordered_set: as pertaining
to unordered_set, two elements are not considered equal if the hashes
alone are identical, they must also be actually equal (operator==).

The problem was fixed by using a custom equality check function that
checks the equality only on the coordinates of the ReferencePoint (as if
it was a Point3D).
2011-06-07 18:48:33 +02:00
Matteo Cypriani a39e06cf19 [Positioning] Stock::closest_calibration_request()
Add CalibrationRequest Stock::closest_calibration_request(Request).
2011-05-13 10:51:52 +02:00
Matteo Cypriani 920e4491ef [Positioning] Stock: s/look for/search for/ 2011-05-13 10:51:52 +02:00
Matteo Cypriani 3aae38c409 [Positioning] Add Request::ss_square_distance() 2011-05-13 10:51:52 +02:00
Matteo Cypriani c525372ed3 [Positioning] Some ReferencePoint code -> PosUtil
ReferencePoint::complete_with_dummy_measurements(
  map<string, Measurement>,
  map<string, Measurement>)
becomes PosUtil::complete_with_dummy_measurements(
  unordered_map<string, Measurement>,
  unordered_map<string, Measurement>)

ReferencePoint::compute_ss_square_distance(
  map<string, Measurement>,
  map<string, Measurement>)
becomes PosUtil::ss_square_distance(
  unordered_map<string, Measurement>,
  unordered_map<string, Measurement>)

map<string, Measurement> ReferencePoint::get_all_measurements_sorted()
is now private, returns an unordered_map instead of a map, and is
renamed ReferencePoint::get_all_measurements().

Note that we now use unordered_maps for these functions. The use of
sorted lists (maps) was useless, as stated in the commit message of
e9eab687 (Wed Jun 2 12:37:43 2010 +0200).
2011-05-13 10:51:52 +02:00
Matteo Cypriani d71bbcf2b8 [Positioning] PosUtil: use channels from owlps.h
Use channel frequencies declared in owlps.h.
Handle frequencies in MHz as well as channel numbers and frequencies in
Hz.
2011-05-13 10:51:52 +02:00
Matteo Cypriani d285d2b4b7 [Positioning] UserInterface: catch by reference 2011-05-13 10:51:52 +02:00
Matteo Cypriani fac5af8655 [Positioning] Fix Measurement::operator bool()
Use !ss.list.empty() instead of ss_list.size() > 0.
2011-05-13 10:51:52 +02:00
Matteo Cypriani 799af46e57 [Positioning] Result: fix operator=() & ==() 2011-05-13 10:51:52 +02:00
Matteo Cypriani 506917b5ec [Positioning] Compute the error if Real is used
If the pseudo-algorithm Real is used, the distance error is computed for
the others algorithms.
2011-05-05 13:22:33 +02:00
Matteo Cypriani 0eef6e8577 [Positioning] RealPosition: handle non-calib. requests
RealPosition is now able to return a relevant result when called with
non-calibration requests.
2011-05-05 13:22:33 +02:00
Matteo Cypriani 17e12a9735 [Positioning] Input*: initialise real_position
When provided for non-calibration requests, the real position is
initialised.
2011-05-05 13:22:33 +02:00
Matteo Cypriani 00bbc9c49d [Positioning] Add Request::real_position 2011-05-05 13:22:33 +02:00
Matteo Cypriani 1bb589b460 [Positioning] Add Point3D::operator bool() 2011-05-05 13:22:33 +02:00
Matteo Cypriani 6c3647410d [Positioning] Result: compute error if possible
If the real coordinates are passed to the constructor, the distance
error is computed. One can also use Result::compute_error() on a
constructed object.
2011-05-05 13:22:33 +02:00
Matteo Cypriani 2d2b49947a [Positioning] Add PositioningAlgorithm::get_name() 2011-05-05 13:22:32 +02:00
Matteo Cypriani bd992f28ed [Positioning] "Null" is a false friend 2011-05-05 13:22:32 +02:00
Matteo Cypriani e067efb42a [Positioning] Doxyfile: use $OWLPS_VERSION 2011-05-05 13:22:32 +02:00
Matteo Cypriani b1d706bf9c Update TODOs 2011-05-05 13:22:32 +02:00
Matteo Cypriani eb61dfc0e0 [Positioning] Add minmax-start & minmax-stop opts.
The start and stop coordinates for the MinMax multilateration method
used to be hard-coded. One should now provide the good coordinates using
the new options positioning.minmax-start and positioning.minmax-stop.
2011-04-27 19:01:43 +02:00
Matteo Cypriani ccb57c86ec [Positioning] Add Point3D::Point3D(string) 2011-04-27 18:51:25 +02:00
Matteo Cypriani ceb035ed19 [Positioning] Change default configuration file
UserInterface: default configuration file is now in
/usr/local/etc/owlps instead of ./cfg.
2011-04-27 17:48:33 +02:00
Matteo Cypriani 38c3402a15 [Positioning] Update/clean configuration files 2011-04-27 17:41:01 +02:00
Matteo Cypriani 1cebc82bfd [Positioning] Minor edits
InputDataReader: minor refactoring.
Request: fix a comment.
2011-04-26 17:18:53 +02:00
Matteo Cypriani ea8da6d8ec [Positioning] Fix InputMedium::…_to_calibration_request()
Fix InputMedium::current_request_to_calibration_request(), that was
resulting in a blank request.
2011-04-26 17:18:53 +02:00
Matteo Cypriani c9d26033e9 [Positioning] InputCSV: add debug info 2011-04-26 17:18:53 +02:00
Matteo Cypriani 77c66bf194 [Positioning] CalibrationRequest: default args in .cc
Move default argument declaration from .hh to .cc.
2011-04-26 16:47:02 +02:00
Matteo Cypriani a54b8ab06b [Positioning] Timestamp: update operator bool()
Test tv_sec and tv_usec independently instead of using operator
uint64_t().
2011-04-26 14:14:01 +02:00
Matteo Cypriani 810a29cec3 [Positioning] Translate READMEs 2011-04-26 10:28:51 +02:00
Matteo Cypriani 3196e5a2e0 Makefiles: resolve OWLPS_VERSION earlier 2011-04-26 10:15:04 +02:00
Florian Taillard 08a407e0f3 [Positioning] Fix reading csv calibration file
Add uint16_t into inputcsv to fix read type packet.
The uint8_t is detected as a char.
2011-04-18 16:31:10 +02:00
Florian Taillard 8d2a2b3e5a [Positioning] Fix accesspoint reading frequency
Change long to unsigned long in accesspointsreadercsv.cc.
The frequency value exceed a long lenght in arch 32bits.
2011-04-18 13:52:43 +02:00
Matteo Cypriani 6fa1ae15d0 [Positioning] Print version info with -V 2011-04-13 00:12:30 +02:00
Matteo Cypriani 273c2adfc7 [Positioning] Fix Makefile: remove prepare target 2011-04-12 12:17:31 +02:00
Matteo Cypriani d31ac3864e Position endianess conversion in all modules 2011-04-07 16:15:46 +02:00
Matteo Cypriani e8332fd0f6 Update TODOs 2011-04-07 11:57:14 +02:00
Matteo Cypriani 55886734d5 [Positioning] Makefile: call prepare before *.o
When compiling in parallel (make -j), the directory 'obj' was sometimes
created too late (i.e. after the end of the first compilation, so the .o
could not be written on the disk). This is now fixed.
2011-04-07 09:17:46 +02:00
Matteo Cypriani 43ca7a3426 [Positioning] Makefile: run cppcheck with --quiet 2011-04-07 09:17:46 +02:00
Matteo Cypriani 80c914647f [Positioning] CSVFileReader::print_error_cast() const 2011-04-07 09:17:46 +02:00
Matteo Cypriani 878ee7e495 [Positioning] Fix/add some Doxygen comments 2011-04-07 09:17:46 +02:00
Matteo Cypriani 2467c3261e [Positioning] TextFileReader: '-' for stdin
The user can now use '-' as file name to read inputs from stdin.
2011-04-07 09:17:23 +02:00
Matteo Cypriani d25aa4276b [Positioning] TextFileWriter: '-' for stdout
The user can now use '-' as file name to write results or logs to
stdout.
2011-04-07 09:16:25 +02:00
Matteo Cypriani dc9e5a72f4 [Positioning] UserInterface: fix output.udp-host 2011-04-05 16:00:52 +02:00
Matteo Cypriani 3719f58b65 [Positioning] OutputUDPSocket: finish cleaning
Use libowlps for socket creation.
Use Result::to_csv() and ResultList::to_csv().
2011-04-05 16:00:52 +02:00
Matteo Cypriani 2324c8e5d1 [Positioning] Move OutputCSV::*to_csv()
OutputCSV::result_to_csv() becomes Result::to_csv().
OutputCSV::results_to_csv() becomes ResultList::to_csv().
2011-04-05 15:42:57 +02:00
Matteo Cypriani 40fb159a91 Merge branch 'dev-outputsocket' into dev
Adds OutputUDPSocket.
OutputUDPSocket::write(ResultList) is a mock function, since important
changes have to be done before that.

Conflicts:
	owlps-positioning/src/userinterface.cc
2011-04-05 12:05:46 +02:00
Matteo Cypriani a898af4389 [Positioning] Write all results simultaneously
Write results computed by several algorithms for the same request
simultaneously for a given medium. This allows to have only one CSV line
for a given request.
To achieve that, the class ResultList was created.
2011-04-05 11:52:10 +02:00
Matteo Cypriani 562ea6c28b [Positioning] Add options output.udp-{host,port} 2011-04-05 11:27:44 +02:00
Matteo Cypriani 22cad4c214 [Positioning] OutputSocket -> OutputUDPSocket 2011-04-05 11:27:44 +02:00
Matteo Cypriani a2c0556ee8 [Positioning] OutputSocket: review & clean 2011-04-05 11:27:44 +02:00
Florian Taillard 756b850375 [Positioning] Modified output socket UDP
The ip of destination is now configured in cfg/owlps-positioning.cfg
and activate by argument -O Socket.
Update owlps-positioning.cfg (Add remote-ip).
2011-04-05 11:27:44 +02:00
Matteo Cypriani 4752198ce7 [Positioning] Include algorithm name in results 2011-03-31 19:42:35 +02:00
Matteo Cypriani 670dfdc867 [Positioning] Improve CalibrationRequest::type
Add the request type in CalibrationRequest constructors.
Handle (auto)calibration request type in Input*.
2011-03-31 17:08:24 +02:00
Matteo Cypriani 5972e245cc [Positioning] InputUDPSocket: read calibration data 2011-03-31 16:03:22 +02:00
Matteo Cypriani 5945617994 Update TODOs 2011-03-31 16:03:22 +02:00
Matteo Cypriani df5ed19834 Include headers as needed
Move #includes from .h to .c wherever possible.
2011-03-31 16:03:22 +02:00
Matteo Cypriani d64b4046da [Positioning] Handle signals 2011-03-31 16:03:22 +02:00
Matteo Cypriani 46a67d2843 [Positioning] Add option flush-output-files 2011-03-31 16:03:22 +02:00
Matteo Cypriani 60a10cb112 [Positioning] Configuration: add bool_value() 2011-03-31 16:03:22 +02:00
Matteo Cypriani f388e6c8ec [Positioning] Update owlps-positioning.cfg
The new configuration file is more generic and better shows options.
2011-03-31 16:03:22 +02:00
Matteo Cypriani 70ff9ffb42 [Positioning] Delete old option server.port
This option was replaced by input.udp-port.
2011-03-31 16:03:22 +02:00
Matteo Cypriani 1a5117d46b [Positioning] Minimal handling of request type
Handle the new CSV & UDP formats that include the request type.
2011-03-31 16:03:22 +02:00
Matteo Cypriani 1dad77b26f [Positioning] CSVFileReader: reindent 2011-03-28 17:52:25 +02:00
Matteo Cypriani 75fc40f057 [Positioning] Fix CSV Input
Bug introduced with InputUDPSocket.
2011-03-28 17:51:06 +02:00
Florian Taillard 6fbb0874e7 [Positioning] Add OutputSocket 2011-03-25 12:19:52 +01:00
Matteo Cypriani 4720399513 [lib] mac_bytes_to_string(): do not malloc anymore
owl_mac_bytes_to_string() now uses a static buffer, so the caller do not
need to free the returned buffer manually. Because of this static
buffer, it is not thread-safe anymore, therefore we introduce
owl_mac_bytes_to_string_r() that is a thread-safe version.
2011-03-25 11:48:25 +01:00
Matteo Cypriani 161157dae7 [Positioning] Add InputUDPSocket
The positioning server can now read the requests sent by the aggregator
via UDP. This data exchange does not concern (auto)calibration requests
yet.
2011-03-25 11:48:25 +01:00
Matteo Cypriani c3c319a7f1 [Positioning] Timestamp::Timestamp(owl_timestamp) 2011-03-25 11:48:24 +01:00
Matteo Cypriani 3c29379821 [Positioning] InputCSV: use read_point3d()
Use CSVFileReader::read_point3d() to read the coordinates, instead of
reading 3 floats.
2011-03-18 15:27:24 +01:00
Matteo Cypriani 5669540d8b [Positioning] Warn about the non-maintained tests 2011-03-18 15:24:37 +01:00
Matteo Cypriani 38769efbf0 [Positioning] Read new timestamp format from CSV 2011-03-18 15:24:37 +01:00
Matteo Cypriani cbd2ba3ca1 [Positioning] Timestamp: enable ns precision
Do not round to millisecond precision anymore, we now keep nanosecond
precision.
2011-03-18 15:24:37 +01:00
Matteo Cypriani c4f413b862 [Positioning] Fix compilation (-lstdc++) 2011-03-16 16:45:38 +01:00
Matteo Cypriani 0676462082 Makefiles: use colorgcc (only) if it exists
owlps-positioning/Makefile used to use colorgcc as the default compiler,
without testing its existence. This is fixed.
The makefiles for libowlps and infrastructure-centred modules now use
colorgcc when available.
2011-03-16 16:44:32 +01:00
Matteo Cypriani 3027df22a7 [Positioning] Makefile: add help 2011-03-16 16:44:32 +01:00
Matteo Cypriani 1fb6e39d27 [Positioning] Handle AP reading from a CSV file
Add class AccessPointsReaderCSV and make InputDataReader to use it.

Stock: Add function find_create_ap(const AccessPoint&).
2011-03-16 14:36:24 +01:00
Matteo Cypriani 29ce5a51af [Positioning] Stock: reorganise with Doxygen groups 2011-03-16 14:36:24 +01:00
Matteo Cypriani 6f0c0af5be [Positioning] PosUtil::wifi_channel_to_hz(): throw exception
posexcept: Add exception bad_channel.

PosUtil::wifi_channel_to_hz() now throw bad_channel if the argument is
not a valid channel nor a 802.11 frequency value in Hz.
2011-03-16 14:36:24 +01:00
Matteo Cypriani 338e4f7dcd [Positioning] Code cleaning around CSV data reading
CSVFileReader: Add function read_point3d().

Point3D: Add function set_coordinates(float[3]).

posexcept: Rename malformed_topology -> malformed_input_data.

TopologyReaderCSV:
- Use CSVFileReader::read_point3d() instead of the custom read_point().
- Rename occurrences of malformed_topology.
2011-03-16 14:36:24 +01:00
Matteo Cypriani 2347657d08 [Positioning] Clean config files
Delete access_points.cfg and accesspoints.cfg.
Delete owlps-positioning.conf, add owlps-positioning.cfg.
minips.cfg becomes minipc.csv.
2011-03-16 14:36:24 +01:00
Matteo Cypriani f3f59ff203 [Positioning] TextFileWriter: fix text writing
We wrote a C string instead of a string into the file stream, which
caused valgrind errors.
2011-03-16 14:36:24 +01:00
Matteo Cypriani cf42098cbd [Positioning] Correct some coding style issues
Get rid of some cppcheck warnings.
2011-03-16 14:36:24 +01:00
Matteo Cypriani b21b7bd25f [Positioning] Correct some Doxygen comments
Turn REFERENCES_RELATION to YES in Doxyfile.
2011-03-16 14:36:24 +01:00
Matteo Cypriani 1e605ae16d [Positioning] Stock: add some comments 2011-03-16 14:36:24 +01:00
Matteo Cypriani c731bf578f [Positioning] Add positioning algorithm Basic FRBHM
Add class FRBHMBasic, which derives FBCM and RADAR.

ReferencePoint: Add functions friis_index_for_ap() and
friis_indexes_for_ap() (that takes code away from
Stock::update_all_friis_indexes()).

CartographyAlgorithm and MultilaterationAlgorithm now extend
PositioningAlgorithm with "public virtual" instead of "public".

CartographyAlgorithm: select_point() must now return a ReferencePoint.

MultilaterationMethod: Add pure virtual function multilaterate_2d().

MinMax: Add function multilaterate_2d().

MultilaterationAlgorithm: Add function multilaterate_2d() to map
MultilaterationMethod::multilaterate_2d().

Makefile: Fix some dependencies.
2011-03-16 14:36:24 +01:00
Matteo Cypriani e12db08b0d [Positioning] Add positioning algorithm FBCM
Add class FBCM.

AccessPoint: Add attribute friis_index.

Measurement: Add function get_ss_list_size().

Stock: Add function update_all_friis_indexes().
2011-03-16 14:36:23 +01:00
Matteo Cypriani a05c61a3c1 [Positioning] Define PosUtil::LIGHT_SPEED
This constant will be used instead of a constant value "300000000", with
a more accurate value.
Make MultilaterationAlgorithm use it, and fix the unit test.
2011-03-16 14:36:23 +01:00
Matteo Cypriani 3dcf8bc88a [Positioning] MultilaterationAlgorithm::make_constant_term()
Move the constant term computation from
InterlinkNetworks::estimate_distance() into the new function
MultilaterationAlgorithm::make_constant_term(). This will avoid
duplicate this code into the future FBCM::estimate_distance().
2011-03-16 14:36:23 +01:00
Matteo Cypriani e9eab6876d [Positioning] Add RADAR positioning algorithm
Add classes RADAR and CartographyAlgorithm, which is the super-class of
SS map based algorithms.

Measurement: Add functions:
- add_ss_list(), to add several SS in one operation.
- merge(), to merge a Measurement into another.
- ss_square_distance() (from old commented code), to compute the
  distance to a SS value or another Measurement.

posexcept: Add exception cannot_merge, used by Measurement::merge().

ReferencePoint:
- Add ss_square_distance() and functions used by it:
  complete_with_dummy_measurements(), compute_ss_square_distance() and
  get_all_measurements_sorted(). Use of sorted values (map instead of
  unordered_map) is useless, should be fixed soon.
- Delete old commented code: getPowerForAp(), addMeasurement() and old
  getSsSquareDistance().

Stock: Add function closest_reference_point().
2011-03-16 14:36:23 +01:00
Matteo Cypriani d7973a3ef0 [Positioning] InputCSV: Fix CalibrationRequest handling
We now consider a Request as a CalibrationRequest if the Direction field
is valid. We do not take care of the position fields any more.
2011-03-16 14:36:23 +01:00
Matteo Cypriani 92bb12bfe3 [Positioning] CalibrationRequest & Result: operator==() const
CalibrationRequest::operator==() was not marked as const, which caused
trouble with unordered_set.
This commit corrects also CalibrationRequest::operator!=(),
Result::operator==() and Result::operator!=().
2011-03-16 14:36:23 +01:00
Matteo Cypriani 2c62e30ff9 [Positioning] Define hash_value() for several classes
For object types that we needed to store into an unordered_set, we used
string-based hashes, defined into stock.cc. We now define new hash
functions as friend of target classes, based on boost::hash_combine.

The following classes now have a hash_value() function:
- Request
- CalibrationRequest
- Direction
- Timestamp
- Point3D
- ReferencePoint
2011-03-16 14:36:23 +01:00
Matteo Cypriani aafc277704 [Positioning] Fix ReferencePoint::operator<<()
Fix printing of CalibrationRequest list (pointers were printed instead
of values).
2011-03-16 14:36:23 +01:00
Matteo Cypriani 630df51702 [Positioning] Del MultilaterationAlgorithm::mobile
Makefile: Use colorgcc.
Update TODO.
2011-03-16 14:36:23 +01:00
Matteo Cypriani 428639b814 [Positioning] InputDataReader: read waypoints 2011-03-16 14:36:23 +01:00
Matteo Cypriani f85c7113ab [Positioning] Delete several exception classes
Create exceptions bad_configuration and missing_configuration and delete
all configuration-specific exceptions.
2011-03-16 14:36:23 +01:00
Matteo Cypriani a9ac8616e8 [Positioning] MinMax: Fix start/stop and < vs. <= 2011-03-16 14:36:23 +01:00
Matteo Cypriani 814ff2b651 [Positioning] Positioning & UserInterface: add Interlink 2011-03-16 14:36:23 +01:00
Matteo Cypriani 14902181af [Positioning] TopologyReaderCSV: read waypoints
Stock: add Waypoint list and support functions.

Waypoint:
- Use an unordered_set instead of a vector for the Building list.
- Add functions add_building(), add_buildings() and remove_building().
- Add operator string().

cfg/waypoints.csv: change format (add building name).
2011-03-16 14:36:23 +01:00
Matteo Cypriani 208c989c53 [Positioning] Add InputDataReader & TopologyReaderCSV
InputDataReader handles all data input, i.e. data needed to prepare
computation (topology, calibration measurements, etc.).

TopologyReaderCSV reads topology from a CSV file (just Building and Area
for the moment).

cfg/topo.csv: change format (add building name and reorder coordinates).

UserInterface: add data input options.

posexcept: add data input exceptions.
2011-03-16 14:36:23 +01:00
Matteo Cypriani a30b08ac3c [Positioning] Stock: add Building list & complete tests 2011-03-16 14:36:23 +01:00
Matteo Cypriani f4e8d7a1b7 [Positioning] Building: guarantee unique areas & waypoints
Building:
- Display areas & waypoints statistics in operator<<().
- Use an unordered_map for areas.
- Use an unordered_set for waypoints.
(instead of two vectors)

Area: display building name in operator<<().
2011-03-16 14:36:23 +01:00
Matteo Cypriani 2d4c90e4cd [Positioning] TextFileReader: handle comments
TextFileReader::read_nonblank_line() now skips lines beginning with a #,
or with blank characters and then #.
2011-03-16 14:36:22 +01:00
Matteo Cypriani 675d2d7213 [Positioning] Simplify exceptions in posexcept 2011-03-16 14:36:22 +01:00
Matteo Cypriani 8e6883cfc9 [Positioning] Add class CSVFileReader
CSVFileReader is a specialisation of TextFileReader, that allow reading
a CSV line field by field.

TextFileReader:
- Make private attributes protected to allow derivation.
- Add attribute current_line_nb.
- Add function read_nonblank_line().
- Delete useless accessor get_name().

Update InputCSV to use CSVFileReader.

Adapt unit tests for InputCSV and InputLogCSV: EOF is not reached right
after reading the last line, but after trying (and failing) to read one
more line.
2011-03-16 14:36:22 +01:00
Matteo Cypriani c82b95f8f0 [Positioning] Stock::find_create_{ap,mobile}()
Add function find_create_ap() and find_create_mobile() in Stock.
Use these functions in InputCSV instead of Stock::get_mobile() and try…
catch blocks.
2011-03-16 14:36:22 +01:00
Matteo Cypriani b707dae1f1 [Positioning] Fix dependencies in Makefile 2011-03-16 14:36:22 +01:00
Matteo Cypriani 24a328fc16 [Positioning] Fix Timestamp on 32 bits architectures 2011-03-16 14:36:22 +01:00
Matteo Cypriani 30e4e47ca8 [Positioning] UserInterface: categorise options 2011-03-16 14:36:22 +01:00
Matteo Cypriani 58ed434d6b [Positioning] Add class TextFileReader
TextFileReader read lines from a text file. It is aimed to be used by
all classes that read from a text file, as TextFileWriter is used by
those which write to a text file.

Code of TextFileReader is taken from class InputCSV.

Minor fixes on the TextFileWriter unit test.
2011-03-16 14:36:22 +01:00
Matteo Cypriani 866013248f [Positioning] TextFileWriter throws error_opening_output_file
Fix mistake in TextFileWriter::TextFileWriter(), that thrown
error_opening_input_file instead of error_opening_output_file.
Creation of class error_opening_output_file in posexcept.
2011-03-16 14:36:22 +01:00
Matteo Cypriani 1a51d234c6 [Positioning] Add InterlinkNetworks, MinMax & associates
Add classes:
- MultilaterationMethod
- MinMax (extends MultilaterationMethod)
- MultilaterationAlgorithm (extends PositioningAlgorithm)
- InterlinkNetworks (extends MultilaterationAlgorithm)
2011-03-16 14:36:22 +01:00
Matteo Cypriani 9f907b4db5 [Positioning] AccessPoint: frequency in Hz
The AP frequency was (by mistake) in MHz. It is now in Hz, as
documented.

Function PosUtil::channel_to_frequency() is renamed
wifi_channel_to_hz().
2011-03-16 14:36:22 +01:00
Matteo Cypriani f0831db109 [Positioning] Point3D: set_coordinates(), distance_to_sphere()
- Add function set_coordinates(float, float, float).
- Add function distance_to_sphere().
- Suppress calls by reference for simple types (use const float instead
  of const &float).
2011-03-16 14:36:22 +01:00
Matteo Cypriani 64715f7a79 [Positioning] OutputFileMedium -> TextFileWriter
TextFileWriter:
- OutputFileMedium becomes TextFileWriter.
- Method write_string_to_file() becomes write_text() and is made public.
- Add a unit test.

InputLogCSV and OutputCSV do not extend OutputFileMedium anymore, but
use a TextFileWriter as an attribute.
2011-03-16 14:36:22 +01:00
Matteo Cypriani 56c45b3334 [Positioning] Add class OutputCSV
OutputCSV writes Result to a CSV file. It extends OutputFileMedium.

Update:
- Output.
- UserInterface (add option "output.csv-file").
- posexcept (add class no_output_csv_file).
2011-03-16 14:36:22 +01:00
Matteo Cypriani 84789f2ed2 [Positioning] Add class OutputFileMedium
OutputFileMedium is designed to be a super-class for classes that need
to write to a text file. It could also be a simple writer if the method
write_string_to_file() was public (maybe we should change that and
rename OutputFileMedium to OutputFileWriter or something like that).

InputLogCSV:
- Now extends InputLogMedium *and* OutputFileMedium.
- Make log_request() inline.
2011-03-16 14:36:22 +01:00
Matteo Cypriani 5f0bb90d45 [Positioning] TestUtil: clean set_up(), add Result list
TestUtil:
- Split set_up() into several functions.
- Add a list of Result, which will be useful very soon.
2011-03-16 14:36:22 +01:00
Matteo Cypriani 3a9498a0b5 [Positioning] Result: read accessors const 2011-03-16 14:36:22 +01:00
Matteo Cypriani 7bd6f8b261 [Positioning] owlps-positioning is almost usable
Add Positioning creation in owlps-positioning, so the program is usable,
configuration is checked in Positioning, Input and Output, and objects
are created and run normally.

UserInterface: Minor modification, config_file_name is not initialised
in constructor anymore, it is now a default value of the configuration
entry "config-file".
2011-03-16 14:36:21 +01:00
Matteo Cypriani 454579d9b7 [Positioning] InputCSV: fix null direction 2011-03-16 14:36:21 +01:00
Matteo Cypriani 8bb0036512 [Positioning] Request: timestamp -> time_sent 2011-03-16 14:36:21 +01:00
Matteo Cypriani ee0499afad [Positioning] Code and comments clean-up
- Where possible, use initialisation lists in class definition instead
  of explicit variable initialisations in source file.
- Rename some variables (use of "source" in copy constructors and
  operators…).
- Suppress useless Doxygen comments, allow non-documented members in
  Doxyfile.
2011-03-16 14:36:21 +01:00
Matteo Cypriani be8f0cf728 [Positioning] Add class posexcept
posexcept derivates from std::exception.
Exception classes defined in posexcept.hh are now derivated from
posexcept instead of std::exception.
2011-03-16 14:36:21 +01:00
Matteo Cypriani 175719db6d [Positioning] PosUtil: channel defs -> posutil.cc
Move channels defines into posutil.cc.
Remove some useless includes in PosUtil and InputCSV.
2011-03-16 14:36:21 +01:00
Matteo Cypriani 80fe1c505d [Positioning] ASSERT(a != b) instead of ASSERT_DIFFERS(a, b)
In cxxtest, TS_ASSERT_DIFFERS(a, b) tests !(a == b) and not (a != b).
Therefore, to test a::operator!=(b), we must avoid TS_ASSERT_DIFFERS()
(that will test !a::operator==(b)) and write instead TS_ASSERT(a != b).
2011-03-16 14:36:21 +01:00
Matteo Cypriani 92e58686f8 [Positioning] Add class Positioning
The new class Positioning is the interface between Input and Output,
using positioning algorithms to compute results from requests.
Update UserInterface to add option "positioning.algorithm"; update posexcept.
2011-03-16 14:36:21 +01:00
Matteo Cypriani 9ed1000bb3 [Positioning] Add class Output
Add class Output to handle outputs.
Update UserInterface to add option "output.medium"; update posexcept.
2011-03-16 14:36:21 +01:00
Matteo Cypriani 7088e524d4 [Positioning] Add OutputMedium & OutputTerminal
OutputMedium is the super-class of all output media.
OutputTerminal prints a Result on the terminal (or on any stream).
2011-03-16 14:36:21 +01:00
Matteo Cypriani 7c8038edc2 [Positioning] Result::operator<< and minor fixes
Result: add operator<<().

Input: delete log media in destructor.

Request: typo, suppress some useless Doxygen comments.
2011-03-16 14:36:21 +01:00
Matteo Cypriani 9a334ad028 [Positioning] Add PositioningAlgorithm & RealPosition
PositioningAlgorithm is the super-class of all positioning algorithms.
RealPosition is the first "positioning algorithm" (it actually computes
nothing, but returns the position declared in a CalibrationRequest).
2011-03-16 14:36:21 +01:00
Matteo Cypriani 96808115bd [Positioning] Add class Result 2011-03-16 14:36:21 +01:00
Matteo Cypriani 0430b1a5da [Positioning] Redesign Timestamp
Use almost only operators for the public interface.
2011-03-16 14:36:21 +01:00
Matteo Cypriani c559b827ee [Positioning] Directory reorganization
Move "new" source files in src/.
Update Doxyfile and Makefile.

Delete old useless files:
- libowlps-positioning.*
- positioning.*
- server.*
- treatment.*
2011-03-16 14:36:21 +01:00
Matteo Cypriani 7264080536 [Positioning] Check code with cppcheck
- Replace occurences of `container.size() == 0` with
  `container.empty()`.
- Fix an allocation in posexcept.cc (false positive?).
- UserInterface: in constructor, handle bad_alloc exception possibly
  thrown by `new`.
2011-03-16 14:36:20 +01:00
Matteo Cypriani bc46fc1af2 [Positioning] Direction: Remove operator<< 2011-03-16 14:36:20 +01:00
Matteo Cypriani 49ba6ab320 [Positioning] InputLogCSV: Handle calib. requests
InputLogCSV now handles calibration requests.

TestUtil:
- Request list become a Request pointer list (to handle polymorphism).
- Add a ReferencePoint list.
- Reorganise create_test_csv_file().
2011-03-16 14:36:20 +01:00
Matteo Cypriani e70a255083 [Positioning] InputCSV: handle calib. requests (end)
InputCSV now handles CalibrationRequest, adding position and direction
information.

Input:
- Add add_request_to_stock().

Stock:
- Add list of ReferencePoint.
- Add list of CalibrationRequest.
2011-03-16 14:36:20 +01:00
Matteo Cypriani 9dd30a50c9 [Positioning] Add CalibrationRequest::direction
CalibrationRequest:
- Add Direction attribute.
- Add reference_point_backward_link().
2011-03-16 14:36:20 +01:00
Matteo Cypriani cf7e41358b [Positioning] Makefile: fix test dependencies 2011-03-16 14:36:20 +01:00
Matteo Cypriani 516a1d9196 [Positioning] Update TODO 2011-03-16 14:36:20 +01:00
Matteo Cypriani abb5536fdc [Positioning] Add class Direction
The new class Direction will be used to represent the direction of a
calibration request.

Update posexcept.hh to add new exception bad_direction, used in class
Direction.
2011-03-16 14:36:20 +01:00
Matteo Cypriani 6ad31f9af4 [Positioning] InputCSV: prepare handling CalibrationRequest
InputMedium:
- Split into two files (inputmedium.{hh,cc}).
- Add polymorphic handling of CalibrationRequest.
- Write unit tests.

InputCSV:
- Use new code of InputMedium to handle calibration requests.
- We detect if the read request is a calibration request, but
  specific attributes are not initialised.
2011-03-16 14:36:20 +01:00
Matteo Cypriani 1ceab071a2 [Positioning] InputMedium: current_request now pointer
To handle calibration requests, we will need to make current_request be
either a Request or a CalibrationRequest, so we must dynamically
allocate it.
2011-03-16 14:36:20 +01:00
Matteo Cypriani 0b461bf4d0 [Positioning] InputCSV: read direction as int
Prepare handling of calibration requests.
2011-03-16 14:36:20 +01:00