Revision 988
Refactored simulator, set some stuff up to work with multiple robots.
robot_shared.h | ||
---|---|---|
1 |
/* shared structs for simulator */ |
|
1 |
/** |
|
2 |
* @file robot_shared.h |
|
3 |
* @author Colony Project |
|
4 |
* |
|
5 |
* @brief Shared simulator structures. |
|
6 |
* |
|
7 |
* This file is for structures that are used by |
|
8 |
* both the simulator and the simulator library which |
|
9 |
* is linked to by robot programs. |
|
10 |
**/ |
|
2 | 11 |
|
3 | 12 |
#ifndef __ROBOT_SHARED_H |
4 | 13 |
#define __ROBOT_SHARED_H |
5 | 14 |
|
6 |
typedef struct PositionType |
|
7 |
{ |
|
8 |
int x,y; /* position of robot in environment */ |
|
9 |
int theta; /* orientation of robot in environment */ |
|
10 |
} Position; |
|
11 |
|
|
12 |
|
|
13 | 15 |
/* rangefinders are 1-5, so write convert function for this */ |
14 | 16 |
typedef struct RangeFinderType |
15 | 17 |
{ |
16 |
short d[5];
|
|
18 |
short d[5];
|
|
17 | 19 |
} RangeFinder; |
18 | 20 |
|
19 | 21 |
/* this is what is in the robot shared memory */ |
... | ... | |
21 | 23 |
{ |
22 | 24 |
short motor1; /* motor1 value */ |
23 | 25 |
short motor2; /* motor2 value */ |
24 |
RangeFinder ranges; /* rangefinders */
|
|
25 |
/* add other sensors, etc here */
|
|
26 |
RangeFinder ranges; /* rangefinders */
|
|
27 |
/* add other sensors, etc here */
|
|
26 | 28 |
} RobotShared; |
27 | 29 |
|
30 |
#endif |
|
28 | 31 |
|
29 |
typedef struct SimulatorRobotType |
|
30 |
{ |
|
31 |
int robotSharedMemoryID; /* id for shared memory object */ |
|
32 |
RobotShared* robotState;/*Pointer to shared state*/ |
|
33 |
|
|
34 |
Position pos; /* position in environment */ |
|
35 |
short motor1; /* motor1 value */ |
|
36 |
short motor2; /* motor2 value */ |
|
37 |
RangeFinder ranges; /* rangefinders */ |
|
38 |
/* add other sensors, etc here */ |
|
39 |
} SimulatorRobot; |
|
40 |
|
|
41 |
#endif |
Also available in: Unified diff