Wiselib
|
triangulation algorithm implementation More...
#include <triangulation.h>
Classes | |
struct | circle |
struct | triangle |
Public Types | |
enum | ErrorCodes { SUCCESS = OsModel::SUCCESS, ERR_UNSPEC = OsModel::ERR_UNSPEC, ERR_NOTIMPL = OsModel::ERR_NOTIMPL } |
typedef OsModel_P | OsModel |
typedef Radio_P | Radio |
typedef Debug_P | Debug |
typedef Distance_P | Distance |
typedef StaticArrayRoutingTable < OsModel, Radio, 15, int > | int_map_t |
typedef int_map_t::iterator | int_map_iterator_t |
typedef Triangulation< OsModel, Radio, Distance, Debug > | self_type |
typedef OsModel::Timer | Timer |
typedef Timer::millis_t | millis_t |
typedef Radio::node_id_t | node_id_t |
typedef Radio::size_t | size_t |
typedef Radio::block_data_t | block_data_t |
typedef Radio::message_id_t | message_id_t |
typedef TriangulationMessage < OsModel, Radio > | Message |
typedef delegate1< void, int > | localization_delegate_t |
Public Member Functions | |
int | getIndex (node_id_t) |
Returns the internal index of a node ID. | |
int | getNode (int) |
Returns the node ID that is mapped to a internal index. | |
void | findP () |
Identifies two nodes p and q that help finding coordinates of other nodes. | |
void | findCoordinatesP () |
Uses the identified nodes p and q to find coordinates of other nodes. | |
void | findPQ () |
Identifies two nodes p and q that help finding coordinates of other nodes. | |
void | findCoordinatesPQ () |
Uses two nodes p and q to find coordinates of other nodes. | |
void | findCircle () |
Iterates over all found coordinates and tries to find potential triangles. | |
int | testCircle (int, int) |
Determines whether a circle of three nodes contains a node inside. | |
void | setRating (node_id_t, node_id_t, int) |
Function that assigns other nodes ratings to found circles. | |
void | setTriangleGlobal (node_id_t, node_id_t, node_id_t, int) |
Converts a found circle and therefore potential triangle to a mandatory global triangle. | |
bool | nodeInTriangles () |
Checks whether the node is part of at least one triangle. | |
int | lookUpTrust (int, int) |
Returns the trust value corresponding to two ratings from two nodes. | |
int | bestCircleIndex (node_id_t) |
Iterates over all known circles and returns the one with the highest rating that incorporates a specific node ID. | |
int | max (int, int) |
Returns the maximum of two integer values. | |
int | min (int, int) |
Returns the minimum of two integer values. | |
void | coordinates_timer_elapsed (void *userdata) |
Timer that starts the determination of coordinates. | |
void | complete_triangulation_timer_elapsed (void *userdata) |
Timer that checks whether the node is part of a triangle and then tries to link the node. | |
void | select_best_circle_timer_elapsed (void *userdata) |
Timer that selects the best triangle proposal on expiration. | |
void | fourth_timer_elapsed (void *userdata) |
Timer that prints out some results. | |
void | send_timer_elapsed (void *userdata) |
Timer that calls the send function. | |
void | message_timer_elapsed (void *userdata) |
Timer that will send out the next message from the message vector. | |
void | triangles_changed (int) |
template<class T , void(T::*)(int) TMethod> | |
void | reg_changed_callback (T *obj_pnt) |
void | unreg_changed_callback (void) |
void | notify_receivers (int value) |
int | init (Radio &radio, Timer &timer, Debug &debug) |
int | init () |
int | destruct () |
Construction / Destruction | |
Triangulation () | |
~Triangulation () | |
Enable / Disable | |
void | enable (void) |
void | disable (void) |
Algorithm Initialization | |
void | send () |
Methods called by RadioModel | |
void | receive (node_id_t from, size_t len, block_data_t *data) |
Public Attributes | |
localization_delegate_t | callback_ |
triangulation algorithm implementation
typedef Radio::block_data_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::block_data_t |
typedef Debug_P wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Debug |
typedef Distance_P wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Distance |
typedef int_map_t::iterator wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::int_map_iterator_t |
typedef StaticArrayRoutingTable<OsModel, Radio, 15, int> wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::int_map_t |
typedef delegate1<void, int> wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::localization_delegate_t |
typedef TriangulationMessage<OsModel, Radio> wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Message |
typedef Radio::message_id_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::message_id_t |
typedef Timer::millis_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::millis_t |
typedef Radio::node_id_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::node_id_t |
typedef OsModel_P wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::OsModel |
typedef Radio_P wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Radio |
typedef Triangulation<OsModel, Radio, Distance, Debug> wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::self_type |
typedef Radio::size_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::size_t |
typedef OsModel::Timer wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Timer |
enum wiselib::Triangulation::ErrorCodes |
wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Triangulation | ( | ) |
wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::~Triangulation | ( | ) |
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::bestCircleIndex | ( | node_id_t | demandedID | ) |
Iterates over all known circles and returns the one with the highest rating that incorporates a specific node ID.
nodeID | Node ID that a circle is searched for |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::complete_triangulation_timer_elapsed | ( | void * | userdata | ) |
Timer that checks whether the node is part of a triangle and then tries to link the node.
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::coordinates_timer_elapsed | ( | void * | userdata | ) |
Timer that starts the determination of coordinates.
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::destruct | ( | void | ) | [inline] |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::disable | ( | void | ) |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::enable | ( | void | ) |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::findCircle | ( | ) |
Iterates over all found coordinates and tries to find potential triangles.
Iteriert über alle vorhandenen Knotenkoordinaten und versucht, kollisionsfreie Kreise zu finden Zur Bewertung der Kreise wird testCircle() aufgerufen.
Ein koillisionsfreier Kreis wird in den Vektor foundCircles eingefügt. Anschließend wird eine Nachricht an die beiden beteiligten Knoten versandt, die den Kreis ebenfalls testen werden.
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::findCoordinatesP | ( | ) |
Uses the identified nodes p and q to find coordinates of other nodes.
The function is called by findP().
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::findCoordinatesPQ | ( | ) |
Uses two nodes p and q to find coordinates of other nodes.
The function is called by findPQ(). The function has not been tested on actual nodes!
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::findP | ( | ) |
Identifies two nodes p and q that help finding coordinates of other nodes.
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::findPQ | ( | ) |
Identifies two nodes p and q that help finding coordinates of other nodes.
Requires to adjust a tolerance parameter that is located inside the method. The function has not been tested on actual nodes!
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::fourth_timer_elapsed | ( | void * | userdata | ) |
Timer that prints out some results.
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::getIndex | ( | node_id_t | nodeID | ) |
Returns the internal index of a node ID.
ID | node ID the index is requested for |
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::getNode | ( | int | abc | ) |
Returns the node ID that is mapped to a internal index.
index | Internal index that identifies the corresponding node ID |
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::init | ( | void | ) | [inline] |
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::init | ( | Radio & | radio, |
Timer & | timer, | ||
Debug & | debug | ||
) | [inline] |
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::lookUpTrust | ( | int | ratingFirst, |
int | ratingSecond | ||
) |
Returns the trust value corresponding to two ratings from two nodes.
firstRating | First rating value |
secondRating | Second rating value |
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::max | ( | int | a, |
int | b | ||
) |
Returns the maximum of two integer values.
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::message_timer_elapsed | ( | void * | userdata | ) |
Timer that will send out the next message from the message vector.
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::min | ( | int | a, |
int | b | ||
) |
Returns the minimum of two integer values.
bool wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::nodeInTriangles | ( | ) |
Checks whether the node is part of at least one triangle.
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::notify_receivers | ( | int | value | ) | [inline] |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::receive | ( | node_id_t | from, |
size_t | len, | ||
block_data_t * | data | ||
) |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::reg_changed_callback | ( | T * | obj_pnt | ) | [inline] |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::select_best_circle_timer_elapsed | ( | void * | userdata | ) |
Timer that selects the best triangle proposal on expiration.
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::send | ( | ) |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::send_timer_elapsed | ( | void * | userdata | ) |
Timer that calls the send function.
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::setRating | ( | node_id_t | fromID, |
node_id_t | thirdID, | ||
int | rating | ||
) |
Function that assigns other nodes ratings to found circles.
senderID | ID of the sender |
thirdID | ID of the third node being part of the triangle |
rating | Rating the sender transmitted |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::setTriangleGlobal | ( | node_id_t | a, |
node_id_t | b, | ||
node_id_t | c, | ||
int | trust | ||
) |
Converts a found circle and therefore potential triangle to a mandatory global triangle.
ownID | The ID of the node itself |
firstID | First ID of found circle |
secondID | Second ID of found circle |
trust | Trust value of the triangle |
wichtig: a = eigene ID, b = foundCircles.idFirst, c = foundCircles.idSecond
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::testCircle | ( | int | B, |
int | C | ||
) |
Determines whether a circle of three nodes contains a node inside.
Prüft, ob ein Dreieck ein Delaunay-Dreieck ist 0, wenn Koordinaten nicht ausreichen 1, wenn kein anderer Knoten innerhalb des Kreises 2, wenn ein Knoten innerhalb ist.
firstID | ID of the first node |
secondID | ID of the second node |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::triangles_changed | ( | int | ID | ) |
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::unreg_changed_callback | ( | void | ) | [inline] |
localization_delegate_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::callback_ |