Commit Graph

66 Commits

Author SHA1 Message Date
Matteo Cypriani 3196e5a2e0 Makefiles: resolve OWLPS_VERSION earlier 2011-04-26 10:15:04 +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 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 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 22cad4c214 [Positioning] OutputSocket -> OutputUDPSocket 2011-04-05 11:27:44 +02:00
Florian Taillard 6fbb0874e7 [Positioning] Add OutputSocket 2011-03-25 12:19:52 +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 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 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 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 630df51702 [Positioning] Del MultilaterationAlgorithm::mobile
Makefile: Use colorgcc.
Update TODO.
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 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 b707dae1f1 [Positioning] Fix dependencies in Makefile 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 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 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 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 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 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 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 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 cf7e41358b [Positioning] Makefile: fix test dependencies 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 ce92f0979e [Positioning] +CalibrationRequest, -CalibrationMeasurement
Delete class CalibrationMeasurement and add class CalibrationRequest:
the ReferencePoint must be linked by the Request, not by each
Measurement of the Request.

Adapt ReferencePoint to link a CalibrationRequest instead of a
CalibrationMeasurement.

Request:
- Destructor is now virtual to allow polymorphism.
- Reactivate tests on get_measurements() and set_measurements().
2011-03-16 14:36:20 +01:00
Matteo Cypriani a5aa1af433 [Positioning] Add logging support
Add interface InputLogMedium and class InputLogCSV.

Input: Add logging support.

UserInterface: Add logging options.

Configuration:
- Rename functions (suppress "get_").
- Add functions to allow multiple values in one option (needed by
  logging options):
  - value_exists_in_string_vector()
  - string_vector_value()

InputCSV: Add a destructor.

posexcept.hh: Add no_log_csv_file exception.

TestUtil:
- Improve set_up().
- Add functions used in InputLogCSV_test:
  - functions to compare Request & Co,
  - functions to compare the sizes of two files.
2011-03-16 14:36:19 +01:00
Matteo Cypriani 8257e9e67d [Positioning] Tests: add global set up & tear down
Work on unit tests:
- TestUtil:
  - Add set_up(), that sets up lists of Request, Mobile and AccessPoint,
    primarily to be used with create_test_csv_file().
  - Add public attributes for these lists.
  - Update create_test_csv_file() to use these lists.
- Update InputCSV_test to use new TestUtil.
- Add class TestSetUp, a global fixture class. Before all tests off all
  test suites, it calls TestUtil::set_up().
- Update and clean Makefile.
2011-03-16 14:36:19 +01:00
Matteo Cypriani fc1ceb25c7 [Positioning] Add Input & posexcept.{hh,cc}
- Add files posexcept.{hh,cc} that contains exception classes.
- Add class Input, that handles InputMedium (and InputLogMedium, in the
  future). Note that for the moment, the unit test is *very* minimal.
- UserInterface: Add options for the input medium and the CSV file.
2011-03-16 14:36:19 +01:00
Matteo Cypriani 0ddef4c747 [Positioning] Add TestUtil, utilitary test class
Add the class TestUtil, that provides functions used in several unit
tests. For the moment, it contains two function:
- fill_file(), that creates and fills a test file.
- remove_file(), that deletes a test file.
2011-03-16 14:36:19 +01:00
Matteo Cypriani c341f852b7 [Positioning] Clean Makefile 2011-03-16 14:36:19 +01:00
Matteo Cypriani 9cf4daca3b [Positioning] Add Configuration and UserInterface
- Add class Configuration, a stock for the configuration structure.
- Add class UserInterface, that handles the configuration input.
- Update owlps-positioning.cc (delete old stuff like configuration) and
  delete owlps-positioning.hh: we now have a compilable executable.
2011-03-16 14:36:19 +01:00
Matteo Cypriani a9a2331cfa [Positioning] Finish unit tests for Area & Point3D
Area:
- Unit test: test inversion of points.
- Add reorder_coordinates().
- Remove all set_{x,y,z}_{min,max}() accessors.
- Remove set_p_min() and set_p_max().
- Add set_coordinates().
- The constructor now takes 2 Point3D instead of 6 float coordinates.

Point3D:
- Unit test: finish to test distances, test new cast operator.
- Add a cast to string operator.

Unit tests:
- Add valuetraits.hh with class to display correctly a Point3D in a
  wrong assertion.
2011-03-16 14:36:19 +01:00
Matteo Cypriani b921263795 [Positioning] Add class Timestamp
Add a class Timestamp that boxes the structure timespec from <ctime>.
timespec manipulation functions are removed from PosUtil.
2011-03-16 14:36:19 +01:00
Matteo Cypriani bd28a26fa3 [Positioning] Add unit tests
Add tests for all (rewriten) classes, except for InputCSV.
2011-03-16 14:36:19 +01:00
Matteo Cypriani efac35a515 [Positioning] Get rid of STLport, complete Request
- Now use Boost.TR1 instead of STLport, for unordered_map.
- Add operator=(), operator==(), operator!=() and a copy constructor to
  Request.
2011-03-16 14:36:10 +01:00
Matteo Cypriani f4c825c2d9 [Positioning] const_cast & other minor enhancements
- In all classes where we used a C-style cast to suppress const, we now
  use a const_cast.
- Area: Add operator=().
- InputCSV:
	- Document get_next_request().
	- Handle exception when using Stock::get_{ap,mobile}().
	- In constructor, throw an exception in case of error when opening the
	  input file.
- CalibrationMeasurement: Remove operator<<() which is useless (it is a
  simple call to Measurement operator<<()).
- Makefile: Add target 'check'.
2011-03-16 14:36:10 +01:00