Wiselib
|
Module implementing euclidean distance estimation. More...
#include <localization_euclidean_module.h>
Inherits wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.
Public Types | |
enum | EuclideanCollinearCheckStd { eu_cc_std_lax, eu_cc_std_strict, eu_cc_std_none } |
enum | EuclideanCollinearCheckNV { eu_cc_nv_lax, eu_cc_nv_strict, eu_cc_nv_none } |
enum | EuclideanCollinearCheckCN { eu_cc_cn_lax, eu_cc_cn_strict, eu_cc_cn_none } |
enum | EuclideanAlgo { eu_algo_normal, eu_algo_opt } |
enum | EuclideanVote { eu_vote_nv, eu_vote_cn, eu_vote_nvcn, eu_vote_cnnv } |
typedef OsModel_P | OsModel |
typedef Radio_P | Radio |
typedef Clock_P | Clock |
typedef Distance_P | Distance |
typedef Debug_P | Debug |
typedef SharedData_P | SharedData |
typedef DistancePair_P | DistancePair |
typedef LocalizationSumDistModule < OsModel, Radio, Clock, Distance, Debug, SharedData > | self_type |
typedef LocalizationModule < OsModel, Radio, SharedData > | base_type |
typedef Radio::size_t | size_t |
typedef Radio::node_id_t | node_id_t |
typedef Radio::block_data_t | block_data_t |
typedef Clock_P::time_t | time_t |
typedef SharedData::DistanceMap | DistanceMap |
typedef SharedData::NodeList | NodeList |
typedef NodeList::iterator | NodeListIterator |
typedef LocalizationEuclideanInitMessage < OsModel, Radio > | EuclideanInitMessage |
typedef LocalizationEuclideanAnchorMessage < OsModel, Radio > | EuclideanAnchorMessage |
typedef LocalizationEuclideanNeighborMessage < OsModel, Radio, DistanceMap > | EuclideanNeighborMessage |
typedef LocalizationStatistic < OsModel > | Statistics |
typedef SharedData::Neighborhood::NeighborhoodIterator | NeighborhoodIterator |
typedef SharedData::Neighborhood | Neighborhood |
typedef SharedData::LocalCoordinateSystem | LocalCoordinateSystem |
Public Member Functions | |
void | rollback (void) |
void | init (Radio &radio, Clock &clock, Debug &debug, SharedData &shared_data, Distance &distance) |
construction / destruction | |
LocalizationEuclideanModule () | |
~LocalizationEuclideanModule () | |
standard methods startup/simulation steps | |
void | receive (node_id_t from, size_t len, block_data_t *data) |
Handling of Euclidean-Messages. | |
void | work (void) |
Check, whether state can be set to finished or not. | |
module status info | |
bool | finished (void) |
basic access to owner, observer, neighborhood and local coordinate system | |
void | set_shared_data (SharedData &shared_data) |
This method sets the shared data object, which can be accessed by all available modules. | |
SharedData & | shared_data (void) |
Neighborhood & | neighborhood (void) |
LocalCoordinateSystem & | local_coord_sys (void) |
Protected Member Functions | |
processing euclidean messages | |
bool | process_euclidean_init_message (node_id_t from, size_t len, block_data_t *data) |
This method processes initial messages. | |
void | broadcast_neighborhood (void) |
This method broadcasts the neighborhood generated by the initial messages. | |
bool | process_euclidean_neighbor_message (node_id_t from, size_t len, block_data_t *data) |
This method processes neighborhood messages. | |
bool | process_euclidean_anchor_message (node_id_t from, size_t len, block_data_t *data) |
This method processes anchor messages. | |
void | execute_euclidean (node_id_t anchor) |
This method tries to estimate/compute a new anchor distance. | |
work on neighborhood | |
double | find_anchor_distance (node_id_t anchor) |
This method searches for two valid neighbors, that know their distance to given anchor and each other. | |
double | find_anchor_distance_opt (node_id_t anchor) |
This method searches for two valid neighbors, that know their distance to given anchor and each other. | |
NodeList | find_unique_neighbor_neighbors (node_id_t anchor, node_id_t n1, node_id_t n2) |
There are an anchor and two neighbors given. | |
NodeList | find_common_neighbor_neighbors (node_id_t anchor, node_id_t n1, node_id_t n2) |
There are an anchor and two neighbors given. | |
NodeList | find_common_neighbor_neighbors_opt (node_id_t, node_id_t, node_id_t, double &) |
There are an anchor and two neighbors given. | |
double | neighbor_vote (node_id_t, node_id_t, node_id_t, DistancePair &, NodeList &) |
This method decides, which of given feasible solutions is the right one. | |
double | common_neighbor (node_id_t, node_id_t, node_id_t, DistancePair &, NodeList &) |
This method decides, which of given feasible solutions is the right one. | |
parametrization | |
void | set_collinear_check_std (EuclideanCollinearCheckStd check) |
Read the given parameters, which have been set via simulator commands or configuration file. | |
void | set_collinear_check_nv (EuclideanCollinearCheckNV check) |
void | set_collinear_check_cn (EuclideanCollinearCheckCN check) |
void | set_euclidean_algo (EuclideanAlgo algo) |
void | set_euclidean_algo (EuclideanVote vote) |
Module implementing euclidean distance estimation.
This module implements euclidean distance estimation. Idea is to compute the real distances to anchors.
If unknown receives a message from two neighbors that know their distance to an anchor and each other, unknown is able to get two possible distances to the anchor via trilateration. One of these distances is right, the other is wrong. To decide, which of these distances is right, there are two different methods, named 'neighbor vote' and 'common neighbor'.
The first, 'neighbor vote', needs at least one more neighbor, that has a distance to the anchor and one of the first mentioned neighbors. Now the trilateration is done a second time, resulting again in two distances. Then you take the distances of first and second pair, which are nearest to each other.
Second method, 'common neighbor', needs one more neighbor that has a distance to the anchor and both of first mentioned neighbors. Basic geometric reasoning leads to the right solution.
typedef LocalizationModule<OsModel, Radio, SharedData> wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::base_type |
typedef Radio::block_data_t wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::block_data_t |
Reimplemented from wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.
typedef Clock_P wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::Clock |
typedef Debug_P wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::Debug |
typedef Distance_P wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::Distance |
typedef SharedData::DistanceMap wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::DistanceMap |
typedef DistancePair_P wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::DistancePair |
typedef LocalizationEuclideanAnchorMessage<OsModel, Radio> wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::EuclideanAnchorMessage |
typedef LocalizationEuclideanInitMessage<OsModel, Radio> wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::EuclideanInitMessage |
typedef LocalizationEuclideanNeighborMessage<OsModel, Radio, DistanceMap> wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::EuclideanNeighborMessage |
typedef SharedData::LocalCoordinateSystem wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::LocalCoordinateSystem [inherited] |
typedef SharedData::Neighborhood wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::Neighborhood [inherited] |
Reimplemented in wiselib::LocalizationLaterationModule< OsModel_P, Radio_P, Debug_P, SharedData_P, Arithmatic_P >, wiselib::LocalizationMinMaxModule< OsModel_P, Radio_P, Debug_P, SharedData_P, Arithmatic_P >, and wiselib::LocalizationIterLaterationModule< OsModel_P, Radio_P, Distance_P, Debug_P, SharedData_P >.
typedef SharedData::Neighborhood::NeighborhoodIterator wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::NeighborhoodIterator |
typedef Radio::node_id_t wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::node_id_t |
Reimplemented from wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.
typedef SharedData::NodeList wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::NodeList |
typedef NodeList::iterator wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::NodeListIterator |
typedef OsModel_P wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::OsModel |
Reimplemented from wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.
typedef Radio_P wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::Radio |
Reimplemented from wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.
typedef LocalizationSumDistModule<OsModel, Radio, Clock, Distance, Debug, SharedData> wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::self_type |
Reimplemented from wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.
typedef SharedData_P wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::SharedData |
Reimplemented from wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.
typedef Radio::size_t wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::size_t |
Reimplemented from wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.
typedef LocalizationStatistic<OsModel> wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::Statistics |
typedef Clock_P::time_t wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::time_t |
enum wiselib::LocalizationEuclideanModule::EuclideanAlgo |
enum wiselib::LocalizationEuclideanModule::EuclideanCollinearCheckCN |
enum wiselib::LocalizationEuclideanModule::EuclideanCollinearCheckNV |
enum wiselib::LocalizationEuclideanModule::EuclideanCollinearCheckStd |
enum wiselib::LocalizationEuclideanModule::EuclideanVote |
wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::LocalizationEuclideanModule | ( | ) |
wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::~LocalizationEuclideanModule | ( | ) |
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::broadcast_neighborhood | ( | void | ) | [protected] |
This method broadcasts the neighborhood generated by the initial messages.
double wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::common_neighbor | ( | node_id_t | anchor, |
node_id_t | n1, | ||
node_id_t | n2, | ||
DistancePair & | dp, | ||
NodeList & | nl | ||
) | [protected] |
This method decides, which of given feasible solutions is the right one.
The solutions are a result of trilateration with distances between self, two neighbors and an anchor.
A third neighbor is taken, that has distance to both mentioned neighbors, self and anchor. Basic geometric reasoning leads to the right solution.
Node | given anchor |
Node | first neighbor |
Node | second neighbor |
localization::DistancePair | two feasible solutions |
localization::NodeList | list of third neighbors |
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::execute_euclidean | ( | node_id_t | anchor | ) | [protected] |
This method tries to estimate/compute a new anchor distance.
Node | given anchor |
double wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::find_anchor_distance | ( | node_id_t | anchor | ) | [protected] |
This method searches for two valid neighbors, that know their distance to given anchor and each other.
If found, it tries to apply as well mentioned 'neighbor vote' as 'common neighbor'.
Per parameters you can tell, if just one or both methods are used.
If wanted solution is reached, the search ends.
Node | given anchor |
double wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::find_anchor_distance_opt | ( | node_id_t | anchor | ) | [protected] |
This method searches for two valid neighbors, that know their distance to given anchor and each other.
If found, it tries to apply as well mentioned 'neighbor vote' as 'common neighbor'.
Unlike find_anchor_distance(), it just searches a 'common neighbor' for both vote methods. Because of some problems with collinear nodes it takes the 'fewest collinear' solution.
Node | given anchor |
LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::NodeList wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::find_common_neighbor_neighbors | ( | node_id_t | anchor, |
node_id_t | n1, | ||
node_id_t | n2 | ||
) | [protected] |
There are an anchor and two neighbors given.
This method searches for all neighbors, that are neighbors of first and second, and have a link to self and anchor.
Node | given anchor |
Node | first neighbor |
Node | second neighbor |
LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::NodeList wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::find_common_neighbor_neighbors_opt | ( | node_id_t | anchor, |
node_id_t | n1, | ||
node_id_t | n2, | ||
double & | col_measure | ||
) | [protected] |
There are an anchor and two neighbors given.
This method searches for all neighbors, that are neighbors of first and second, and have a link to self and anchor.
Because of conflicts with collinear neighbors, the result is the 'fewest collinear' neighbor pair.
Node | given anchor |
Node | first neighbor |
Node | second neighbor |
LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::NodeList wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::find_unique_neighbor_neighbors | ( | node_id_t | anchor, |
node_id_t | n1, | ||
node_id_t | n2 | ||
) | [protected] |
There are an anchor and two neighbors given.
This method searches for all neighbors, that either are neighbors of first or second, and have a link to self and anchor.
Node | given anchor |
Node | first neighbor |
Node | second neighbor |
bool wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::finished | ( | void | ) |
true
, if module is finished. false
otherwise void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::init | ( | Radio & | radio, |
Clock & | clock, | ||
Debug & | debug, | ||
SharedData & | shared_data, | ||
Distance & | distance | ||
) | [inline] |
LocalCoordinateSystem& wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::local_coord_sys | ( | void | ) | [inline, inherited] |
double wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::neighbor_vote | ( | node_id_t | anchor, |
node_id_t | n1, | ||
node_id_t | n2, | ||
DistancePair & | dp1, | ||
NodeList & | nl | ||
) | [protected] |
This method decides, which of given feasible solutions is the right one.
The solutions are a result of trilateration with distances between self, two neighbors and an anchor.
The neighbor vote applies the same procedure with given third neighbors and each of both first mentioned neighbors. This results in at least two different localization::DistancePairs. Now the results are split into two parts. One with the distances, which are nearest to each other, and one with the others.
The mean of first mentioned part should be the right solution.
Moreover, there are two checks to decide, whether the solution is valid or not. At first, if the nodes are collinear, it is hard to select the right alternative, because the difference in distances in both parts is very low. These cases are filtered out by the requirement, that the standard deviation in one part must be at most 1/3rd of the standard deviation of the other part.
Second, if there is one neighbor with incorrect information, this could result in two wrong votes. This case is filtered out by the requirement, that the standard deviation of selected part is at most 5% of mean.
Node | given anchor |
Node | first neighbor |
Node | second neighbor |
localization::DistancePair | two feasible solutions |
localization::NodeList | list of third neighbors |
Neighborhood& wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::neighborhood | ( | void | ) | [inline, inherited] |
bool wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::process_euclidean_anchor_message | ( | node_id_t | from, |
size_t | len, | ||
block_data_t * | data | ||
) | [protected] |
This method processes anchor messages.
The message tells, that a neighbor got a distance to some anchor. New information is added to neighborhood and the module tries to estimate/compute distance to mentioned anchor.
bool wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::process_euclidean_init_message | ( | node_id_t | from, |
size_t | len, | ||
block_data_t * | data | ||
) | [protected] |
This method processes initial messages.
Source of message is added to neighborhood.
bool wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::process_euclidean_neighbor_message | ( | node_id_t | from, |
size_t | len, | ||
block_data_t * | data | ||
) | [protected] |
This method processes neighborhood messages.
The neighbors of message source are added to neighborhood.
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::receive | ( | node_id_t | from, |
size_t | len, | ||
block_data_t * | data | ||
) |
Handling of Euclidean-Messages.
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::rollback | ( | void | ) |
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::set_collinear_check_cn | ( | EuclideanCollinearCheckCN | check | ) | [inline, protected] |
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::set_collinear_check_nv | ( | EuclideanCollinearCheckNV | check | ) | [inline, protected] |
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::set_collinear_check_std | ( | EuclideanCollinearCheckStd | check | ) | [inline, protected] |
Read the given parameters, which have been set via simulator commands or configuration file.
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::set_euclidean_algo | ( | EuclideanAlgo | algo | ) | [inline, protected] |
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::set_euclidean_algo | ( | EuclideanVote | vote | ) | [inline, protected] |
void wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::set_shared_data | ( | SharedData & | shared_data | ) | [inline, inherited] |
This method sets the shared data object, which can be accessed by all available modules.
LocalizationSharedData | Shared data between all modules. |
SharedData& wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::shared_data | ( | void | ) | [inline, inherited] |
void wiselib::LocalizationEuclideanModule< OsModel_P, Radio_P, Clock_P, Distance_P, Debug_P, SharedData_P, DistancePair_P >::work | ( | void | ) |
Check, whether state can be set to finished or not.
Moreover, send initial messages.