root / trunk / code / projects / libwireless / lib / sensor_matrix.h @ 159
History | View | Annotate | Download (2 KB)
1 |
/**
|
---|---|
2 |
* @file sensor_matrix.h
|
3 |
* @brief Definitions for sensor matrices
|
4 |
*
|
5 |
* Contains functions and declarations for using sensor matrices.
|
6 |
*
|
7 |
* @author Brian Coltin, Colony Project, CMU Robotics Club
|
8 |
**/
|
9 |
|
10 |
#ifndef SENSOR_MATRIX_H
|
11 |
#define SENSOR_MATRIX_H
|
12 |
|
13 |
|
14 |
/**
|
15 |
* @defgroup sensormatrix Sensor Matrix
|
16 |
* @brief the robot sensor matrix
|
17 |
*
|
18 |
* These functions and structures are used for localization
|
19 |
* to determine the relative directions of robots.
|
20 |
*
|
21 |
* @{
|
22 |
**/
|
23 |
|
24 |
/**
|
25 |
* @struct SensorMatrix
|
26 |
*
|
27 |
* A sensor matrix.
|
28 |
**/
|
29 |
typedef struct |
30 |
{ |
31 |
/**
|
32 |
* The size of the sensor matrix.
|
33 |
**/
|
34 |
unsigned int size; |
35 |
/**
|
36 |
* The matrix. Each row represents the readings of one
|
37 |
* robot.
|
38 |
**/
|
39 |
int** matrix;
|
40 |
/**
|
41 |
* The element representing a robot is true if that robot
|
42 |
* is in the token ring and false otherwise.
|
43 |
**/
|
44 |
int* joined;
|
45 |
/**
|
46 |
* The number of robots in the token ring.
|
47 |
**/
|
48 |
int numJoined;
|
49 |
} SensorMatrix; |
50 |
|
51 |
/**@brief Create a sensor matrix **/
|
52 |
SensorMatrix* sensor_matrix_create(void);
|
53 |
/**@brief Destroy a sensor matrix **/
|
54 |
void sensor_matrix_destroy(SensorMatrix* m);
|
55 |
/**@brief Add a robot to a sensor matrix **/
|
56 |
void sensor_matrix_add_robot(SensorMatrix* m, unsigned int id); |
57 |
/**@brief Remove a robot from a sensor matrix **/
|
58 |
void sensor_matrix_remove_robot(SensorMatrix* m, unsigned int id); |
59 |
/**@brief Set a reading in a sensor matrix **/
|
60 |
void sensor_matrix_set_reading(SensorMatrix* m, int observer, int robot, int reading); |
61 |
/**@brief Get a reading in a sensor matrix **/
|
62 |
int sensor_matrix_get_reading(SensorMatrix* m, int observer, int robot); |
63 |
/**@brief Set whether the robot is in the token ring **/
|
64 |
void sensor_matrix_set_in_ring(SensorMatrix* m, int robot, int in); |
65 |
/**@brief Get whether the robot is in the sensor ring **/
|
66 |
int sensor_matrix_get_in_ring(SensorMatrix* m, int robot); |
67 |
/**@brief Get the size of the sensor matrix **/
|
68 |
int sensor_matrix_get_size(SensorMatrix* m);
|
69 |
/**@brief Get the number of robots which have joined the token ring **/
|
70 |
int sensor_matrix_get_joined(SensorMatrix* m);
|
71 |
|
72 |
/** @} **/ //end defgroup |
73 |
|
74 |
|
75 |
#endif
|