Revision 53
Added robot packet response.
trunk/code/projects/slam/robot_main.c | ||
---|---|---|
7 | 7 |
#define SLAM_PACKET_GROUP 11 |
8 | 8 |
#define CONTROL_PACKET_TYPE 'C' |
9 | 9 |
#define REQUEST_PACKET_TYPE 'R' |
10 |
#define ROBOT_RESPONSE 'I' |
|
10 | 11 |
|
11 | 12 |
//REQUEST_PACKET_ORGANIZATION |
12 | 13 |
#define REQUEST_PACKET_SIZE 50 |
... | ... | |
84 | 85 |
if(type==REQUEST_PACKET_TYPE){ |
85 | 86 |
char packet[REQUEST_PACKET_SIZE]; |
86 | 87 |
//Send a message back to our computer overlord. |
87 |
make_request_packet(packet); |
|
88 |
int len= make_request_packet(packet);
|
|
88 | 89 |
|
89 |
//TODO Fill in this prototype. |
|
90 |
wl_send_robot_to_robot_packet(char group, char type, char* packet, int len, int source, char frame); |
|
90 |
wl_send_robot_to_robot_packet(SLAM_PACKET_GROUP, ROBOT_RESPONSE, packet, len, source , 0); |
|
91 | 91 |
} |
92 | 92 |
else if(type == CONTROL_PACKET_TYPE){ |
93 | 93 |
for(i=0;i<length;i++){ |
... | ... | |
96 | 96 |
} |
97 | 97 |
} |
98 | 98 |
|
99 |
char* make_request_packet(char* packet){
|
|
99 |
int make_request_packet(char* packet){
|
|
100 | 100 |
int size = wl_token_get_num_robots(); |
101 |
int i; |
|
101 |
int i,j;
|
|
102 | 102 |
for(i=0;i<5;i++){ |
103 | 103 |
packet[i] = IR[i]; |
104 | 104 |
} |
105 |
|
|
106 |
return packet; |
|
105 |
for(i=0;i<size;i++){ |
|
106 |
for(j=0;j<size;j++){ |
|
107 |
// wl_token_get_sensor_reading(int source, int dest); |
|
108 |
|
|
109 |
} |
|
110 |
} |
|
111 |
return size; |
|
107 | 112 |
} |
108 | 113 |
|
Also available in: Unified diff