Commit Graph

351 Commits

Author SHA1 Message Date
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
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 dbd58f8178 [Positioning] TestUtil: Add create_test_csv_file() 2011-03-16 14:36:19 +01:00
Matteo Cypriani b6ab3c841d [Positioning] Use new exceptions in posexcept
Replace use of standard exceptions (std::out_of_range,
std::runtime_error) by new exceptions in posexcept.
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 12d14b805f [Positioning] Measurement: test avg. computation
This commit pass finally all unit tests without any warning!

Measurement:
- Finish unit test (test the average SS).
- Fix update_average_ss() and add_ss().
- average_ss is now double.
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