root / branches / charging_station / code / projects / recharging / charging_station / sensor_matrix.h @ 85
History | View | Annotate | Download (1.94 KB)
1 | 85 | bcoltin | /**
|
---|---|---|---|
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 | /**
|
||
11 | * @defgroup sensormatrix Sensor Matrix
|
||
12 | * @brief the robot sensor matrix
|
||
13 | *
|
||
14 | * These functions and structures are used for localization
|
||
15 | * to determine the relative directions of robots.
|
||
16 | *
|
||
17 | * @{
|
||
18 | **/
|
||
19 | |||
20 | /**
|
||
21 | * @struct SensorMatrix
|
||
22 | *
|
||
23 | * A sensor matrix.
|
||
24 | **/
|
||
25 | typedef struct |
||
26 | { |
||
27 | /**
|
||
28 | * The size of the sensor matrix.
|
||
29 | **/
|
||
30 | unsigned int size; |
||
31 | /**
|
||
32 | * The matrix. Each row represents the readings of one
|
||
33 | * robot.
|
||
34 | **/
|
||
35 | int** matrix;
|
||
36 | /**
|
||
37 | * The element representing a robot is true if that robot
|
||
38 | * is in the token ring and false otherwise.
|
||
39 | **/
|
||
40 | int* joined;
|
||
41 | /**
|
||
42 | * The number of robots in the token ring.
|
||
43 | **/
|
||
44 | int numJoined;
|
||
45 | } SensorMatrix; |
||
46 | |||
47 | /**@brief Create a sensor matrix **/
|
||
48 | SensorMatrix* sensor_matrix_create(void);
|
||
49 | /**@brief Destroy a sensor matrix **/
|
||
50 | void sensor_matrix_destroy(SensorMatrix* m);
|
||
51 | /**@brief Add a robot to a sensor matrix **/
|
||
52 | void sensor_matrix_add_robot(SensorMatrix* m, unsigned int id); |
||
53 | /**@brief Remove a robot from a sensor matrix **/
|
||
54 | void sensor_matrix_remove_robot(SensorMatrix* m, unsigned int id); |
||
55 | /**@brief Set a reading in a sensor matrix **/
|
||
56 | void sensor_matrix_set_reading(SensorMatrix* m, int observer, int robot, int reading); |
||
57 | /**@brief Get a reading in a sensor matrix **/
|
||
58 | int sensor_matrix_get_reading(SensorMatrix* m, int observer, int robot); |
||
59 | /**@brief Set whether the robot is in the token ring **/
|
||
60 | void sensor_matrix_set_in_ring(SensorMatrix* m, int robot, int in); |
||
61 | /**@brief Get whether the robot is in the sensor ring **/
|
||
62 | int sensor_matrix_get_in_ring(SensorMatrix* m, int robot); |
||
63 | /**@brief Get the size of the sensor matrix **/
|
||
64 | int sensor_matrix_get_size(SensorMatrix* m);
|
||
65 | /**@brief Get the number of robots which have joined the token ring **/
|
||
66 | int sensor_matrix_get_joined(SensorMatrix* m);
|
||
67 | |||
68 | /** @} **/ //end defgroup |