Wiselib
Classes | Public Types | Public Member Functions | Public Attributes
wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P > Class Template Reference

triangulation algorithm implementation More...

#include <triangulation.h>

List of all members.

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_

Detailed Description

template<typename OsModel_P, typename Radio_P, typename Distance_P, typename Debug_P = typename OsModel_P::Debug>
class wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >

triangulation algorithm implementation


Member Typedef Documentation

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Radio::block_data_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::block_data_t
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Debug_P wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Debug
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Distance_P wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Distance
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef int_map_t::iterator wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::int_map_iterator_t
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef StaticArrayRoutingTable<OsModel, Radio, 15, int> wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::int_map_t
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef delegate1<void, int> wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::localization_delegate_t
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef TriangulationMessage<OsModel, Radio> wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Message
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Radio::message_id_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::message_id_t
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Timer::millis_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::millis_t
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Radio::node_id_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::node_id_t
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef OsModel_P wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::OsModel
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Radio_P wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Radio
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Triangulation<OsModel, Radio, Distance, Debug> wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::self_type
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef Radio::size_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::size_t
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
typedef OsModel::Timer wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Timer

Member Enumeration Documentation

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
enum wiselib::Triangulation::ErrorCodes
Enumerator:
SUCCESS 
ERR_UNSPEC 
ERR_NOTIMPL 

Constructor & Destructor Documentation

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::Triangulation ( )
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::~Triangulation ( )

Member Function Documentation

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

Parameters:
nodeIDNode ID that a circle is searched for
Returns:
Index of the found circle.
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::coordinates_timer_elapsed ( void *  userdata)

Timer that starts the determination of coordinates.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::destruct ( void  ) [inline]
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::disable ( void  )
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::enable ( void  )
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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().

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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!

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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!

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::fourth_timer_elapsed ( void *  userdata)

Timer that prints out some results.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::getIndex ( node_id_t  nodeID)

Returns the internal index of a node ID.

Parameters:
IDnode ID the index is requested for
Returns:
Corresponding index
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

Parameters:
indexInternal index that identifies the corresponding node ID
Returns:
Corresponding node ID
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::init ( void  ) [inline]
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::init ( Radio radio,
Timer timer,
Debug debug 
) [inline]
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

Parameters:
firstRatingFirst rating value
secondRatingSecond rating value
Returns:
Trust value
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::max ( int  a,
int  b 
)

Returns the maximum of two integer values.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
int wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::min ( int  a,
int  b 
)

Returns the minimum of two integer values.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
bool wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::nodeInTriangles ( )

Checks whether the node is part of at least one triangle.

Returns:
Boolean value that represents the result
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::notify_receivers ( int  value) [inline]
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::receive ( node_id_t  from,
size_t  len,
block_data_t data 
)
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
template<class T , void(T::*)(int) TMethod>
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::reg_changed_callback ( T *  obj_pnt) [inline]
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::send ( )
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::send_timer_elapsed ( void *  userdata)

Timer that calls the send function.

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

Parameters:
senderIDID of the sender
thirdIDID of the third node being part of the triangle
ratingRating the sender transmitted
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

Parameters:
ownIDThe ID of the node itself
firstIDFirst ID of found circle
secondIDSecond ID of found circle
trustTrust value of the triangle

wichtig: a = eigene ID, b = foundCircles.idFirst, c = foundCircles.idSecond

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
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.

Parameters:
firstIDID of the first node
secondIDID of the second node
Returns:
Integer value that represents the result.
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P >
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::triangles_changed ( int  ID)
template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
void wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::unreg_changed_callback ( void  ) [inline]

Member Data Documentation

template<typename OsModel_P , typename Radio_P , typename Distance_P , typename Debug_P = typename OsModel_P::Debug>
localization_delegate_t wiselib::Triangulation< OsModel_P, Radio_P, Distance_P, Debug_P >::callback_

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines