![]() |
ronelib
Operating System for the r-one robot
|
Operations on lists of neighbors. More...
Go to the source code of this file.
Functions | |
| void | nbrListCreate (NbrList *nbrListPtr) |
| Fills the provided nbrList with the current set of neighbors. More... | |
| void | nbrListClear (NbrList *nbrListPtr) |
| Sets the size of nbrList to 0. More... | |
| void | nbrListPrintDebug (NbrList *nbrListPtr, char *name) |
| Prints the IDs and update times for all robots in the neighbor list. More... | |
| void | nbrListAddNbr (NbrList *nbrListPtr, Nbr *nbrPtr) |
| Adds a neighbor to a neighbor's linked list of neighbors if there is room. More... | |
| void | nbrListRemoveNbr (NbrList *nbrListPtr, Nbr *nbrPtr) |
| Removes nbrPtr from list (if it exists). More... | |
| void | nbrListCopy (NbrList *nbrListDstPtr, NbrList *nbrListSrcPtr) |
| Copies the neighbor list from SRC to DST. More... | |
| int16 | nbrListAverageBearing (NbrList *nbrListPtr) |
| Determines average bearing of all neighbors using sum of vectors method (optimized). More... | |
| Nbr * | nbrListGetFirst (NbrList *nbrListPtr) |
| Returns a pointer to the neighbor at the head of the list, or NULL. More... | |
| Nbr * | nbrListGetSecond (NbrList *nbrListPtr) |
| Returns a pointer to the neighbor second in the list, or NULL. More... | |
| Nbr * | nbrListGetNbrWithID (NbrList *nbrListPtr, uint8 ID) |
| Returns a pointer to the neighbor with ID, or NULL. More... | |
| Nbr * | nbrListGetSmallestAngleDeviation2 (NbrList *nbrListPtr, Nbr *nbrPtr) |
| returns the neighbor whose bearing is closest to nbrPtr's bearing, NULL if list is empty. More... | |
| Nbr * | nbrListGetClosestNbrToBearing (NbrList *nbrListPtr, int16 bearing) |
| returns the neighbor whose bearing is closest to bearing, NULL if list is empty. More... | |
| NbrList * | nbrListUnion (NbrList *nbrListOutPtr, NbrList *nbrList1Ptr, NbrList *nbrList2Ptr) |
| Computes the union of the two input neighbor lists. More... | |
| NbrList * | nbrListFindNbrsWithDataEqual (NbrList *nbrListOutPtr, NbrList *nbrListInPtr, NbrData *nbrDataPtr, uint8 val) |
| returns a pointer to the list of neighbors with the same data value More... | |
| NbrList * | nbrListFindNbrsWithDataEqual2 (NbrList *nbrListOutPtr, NbrList *nbrListInPtr, NbrData *nbrDataPtr, uint8 val1, uint8 val2) |
| returns a pointer to the list of neighbors with the same data values More... | |
| Nbr * | nbrListGetNbrMinBearing (NbrList *nbrListInPtr) |
| Finds the neighbor with the minimum bearing in a list of neighbors. More... | |
| NbrList * | nbrListSortByBearing (NbrList *nbrListOutPtr, NbrList *nbrListInPtr) |
| Sorts the nbr List in counter clockwise order by bearing. More... | |
| NbrList * | nbrListIncludeSectorInclusive (NbrList *nbrListOutPtr, NbrList *nbrListInPtr, int16 angleStart, int16 angleEnd) |
| Creates a list of neighbors that lie within the specified sector between angleStart and angleEnd. More... | |
| NbrList * | nbrListIncludeSectorExclusive (NbrList *nbrListOutPtr, NbrList *nbrListInPtr, int16 angleStart, int16 angleEnd) |
| Creates a list of neighbors that lie outside of the specified sector between angleStart and angleEnd. More... | |
| NbrList * | nbrListGetRobots (NbrList *nbrListOutPtr, NbrList *nbrListInPtr) |
| Finds neighbors that are robots. More... | |
Operations on lists of neighbors.
This includes adding/removing neighbors, searching for neighbors, and looking for robots with certain bearings.
| void nbrListAddNbr | ( | NbrList * | nbrListPtr, |
| Nbr * | nbrPtr | ||
| ) |
Adds a neighbor to a neighbor's linked list of neighbors if there is room.
| nbrListPtr | the neighbor's linked list |
| nbrPtr | a new neighbor |
| int16 nbrListAverageBearing | ( | NbrList * | nbrListPtr) |
Determines average bearing of all neighbors using sum of vectors method (optimized).
| nbrListPtr | list of neighbors |
| void nbrListClear | ( | NbrList * | nbrListPtr) |
Sets the size of nbrList to 0.
| nbrListPtr | pointer for the list of neighbors to be altered |
| void nbrListCopy | ( | NbrList * | nbrListDstPtr, |
| NbrList * | nbrListSrcPtr | ||
| ) |
Copies the neighbor list from SRC to DST.
| nbrListSrcPtr | (unchanged) |
| nbrListDstPtr | becomes a copy of nbrListSrcPtr |
| void nbrListCreate | ( | NbrList * | nbrListPtr) |
Fills the provided nbrList with the current set of neighbors.
| nbrListPtr | for the list of neighbors |
| NbrList* nbrListFindNbrsWithDataEqual | ( | NbrList * | nbrListOutPtr, |
| NbrList * | nbrListInPtr, | ||
| NbrData * | nbrDataPtr, | ||
| uint8 | val | ||
| ) |
returns a pointer to the list of neighbors with the same data value
| nbrListOutPtr | pointer to output list of neighbors |
| nbrListInPtr | pointer to input list of neighbors |
| nbrDataPtr | list of data on messages |
| val | value of data to match |
| NbrList* nbrListFindNbrsWithDataEqual2 | ( | NbrList * | nbrListOutPtr, |
| NbrList * | nbrListInPtr, | ||
| NbrData * | nbrDataPtr, | ||
| uint8 | val1, | ||
| uint8 | val2 | ||
| ) |
returns a pointer to the list of neighbors with the same data values
| nbrListOutPtr | pointer to output list of neighbors |
| nbrListInPtr | pointer to input list of neighbors |
| nbrDataPtr | list of data on messages |
| val1 | first value of data to match |
| val2 | second value of data to match |
| Nbr* nbrListGetClosestNbrToBearing | ( | NbrList * | nbrListPtr, |
| int16 | bearing | ||
| ) |
returns the neighbor whose bearing is closest to bearing, NULL if list is empty.
| nbrListPtr | list of neighbors |
| bearing | a reference bearing |
| Nbr* nbrListGetFirst | ( | NbrList * | nbrListPtr) |
Returns a pointer to the neighbor at the head of the list, or NULL.
| nbrListPtr | pointer for the list of neighbors |
| Nbr* nbrListGetNbrMinBearing | ( | NbrList * | nbrListInPtr) |
Finds the neighbor with the minimum bearing in a list of neighbors.
| nbrListInPtr | pointer to the neighbor list to search |
| Nbr* nbrListGetNbrWithID | ( | NbrList * | nbrListPtr, |
| uint8 | ID | ||
| ) |
Returns a pointer to the neighbor with ID, or NULL.
| nbrListPtr | pointer for the list of neighbors |
| ID | the unique number of the robot being searched for |
| NbrList* nbrListGetRobots | ( | NbrList * | nbrListOutPtr, |
| NbrList * | nbrListInPtr | ||
| ) |
Finds neighbors that are robots.
| nbrListOutPtr | pointer to the neighbor list updated by this function |
| nbrListInPtr | pointer to the neighbor list to search for robots |
| Nbr* nbrListGetSecond | ( | NbrList * | nbrListPtr) |
Returns a pointer to the neighbor second in the list, or NULL.
| nbrListPtr | pointer for the list of neighbors |
| Nbr* nbrListGetSmallestAngleDeviation2 | ( | NbrList * | nbrListPtr, |
| Nbr * | nbrPtr | ||
| ) |
returns the neighbor whose bearing is closest to nbrPtr's bearing, NULL if list is empty.
| nbrListPtr | list of neighbors |
| nbrPtr | a neighbor used as a reference |
| NbrList* nbrListIncludeSectorExclusive | ( | NbrList * | nbrListOutPtr, |
| NbrList * | nbrListInPtr, | ||
| int16 | angleStart, | ||
| int16 | angleEnd | ||
| ) |
Creates a list of neighbors that lie outside of the specified sector between angleStart and angleEnd.
| nbrListOutPtr | pointer to the memory location where the generated list should be stored |
| nbrListInPtr | pointer to the list of neighbors to check |
| angleStart | starting bearing of the sector |
| angleEnd | ending bearing of the sector |
| NbrList* nbrListIncludeSectorInclusive | ( | NbrList * | nbrListOutPtr, |
| NbrList * | nbrListInPtr, | ||
| int16 | angleStart, | ||
| int16 | angleEnd | ||
| ) |
Creates a list of neighbors that lie within the specified sector between angleStart and angleEnd.
| nbrListOutPtr | pointer to the memory location where the generated list should be stored |
| nbrListInPtr | pointer to the list of neighbors to check |
| angleStart | starting bearing of the sector |
| angleEnd | ending bearing of the sector |
| void nbrListPrintDebug | ( | NbrList * | nbrListPtr, |
| char * | name | ||
| ) |
Prints the IDs and update times for all robots in the neighbor list.
Formated as follows: {name, ID updateTime, ID updateTime, ...}
| nbrListPtr | pointer for the neighborlist |
| name | for the list name |
| void nbrListRemoveNbr | ( | NbrList * | nbrListPtr, |
| Nbr * | nbrPtr | ||
| ) |
Removes nbrPtr from list (if it exists).
| nbrListPtr | list of neighbors |
| nbrPtr | a neighbor to be removed |
| NbrList* nbrListSortByBearing | ( | NbrList * | nbrListOutPtr, |
| NbrList * | nbrListInPtr | ||
| ) |
Sorts the nbr List in counter clockwise order by bearing.
| nbrListOutPtr | pointer to output list of neighbors |
| nbrListInPtr | pointer to input list of neighbors |
| NbrList* nbrListUnion | ( | NbrList * | nbrListOutPtr, |
| NbrList * | nbrList1Ptr, | ||
| NbrList * | nbrList2Ptr | ||
| ) |
Computes the union of the two input neighbor lists.
| nbrListOutPtr | pointer to the list created from the union |
| nbrList1Ptr | first neighbor list |
| nbrList2Ptr | second neighbor list |