Project

General

Profile

Revision 960

Small changes and comments.

View differences:

trunk/code/projects/mapping/matlab/receive.c
9 9
#define WL_COM_PORT "/dev/ttyUSB1" 
10 10
#define WL_CHANNEL 0xE
11 11

  
12
#define MAP_RECEIVE_GROUP 1
13
#define MAP_REQUEST_GROUP 2
12
#define MAP_RECEIVE_GROUP 17
13
#define MAP_REQUEST_GROUP 23
14 14

  
15 15
#define POINT_RAW 1 /* packet type for map data points w/ raw encoder data*/
16 16
#define POINT_ODO 2 /* packet type for map data points w/ odometry data*/
......
92 92
		}
93 93
		else{
94 94
			double** point, **ranges, *theta, *robot;
95
			/*TODO Check for the 'already empty' case.*/
96

  
95
			
97 96
			int num_buffer_elements = tail_index - head_index;
98 97
			if(num_buffer_elements < 0) num_buffer_elements += BUFFER_SIZE;	
99 98

  
......
144 143
	wl_token_ring_register();	
145 144
	
146 145
	/*Continuously iterate over all the robots - buffering data.*/
146
	
147 147
	while(1){
148 148
		
149 149
		wl_token_iterator_begin();
......
160 160
			wl_send_robot_to_robot_global_packet(MAP_REQUEST_GROUP, 
161 161
				POINT_ODO, NULL, 0, robot_num, 0);
162 162
            	
163

  
163
			usleep(10000); /*10ms*/
164 164
		}
165 165
		
166
		/*Wait for all packets to be received before sending more requests.*/
166
		/*Wait for all packets to be received 
167
		 * before sending more requests.
168
		 * FIXME this needs to be WAAAAY more robust
169
		 * to edge cases (robot enters / leaves token
170
		 * ring etc.) For example, if a robot drops
171
		 * a packet (highly likely) it is not dealt with
172
		 * */
167 173
		while(packets_received < num_robots 
168 174
		   && packets_received < wl_token_get_num_robots()){
169 175
			
trunk/code/projects/mapping/matlab/testRobot/test.c
1
/** This test should just have the robot stay in place,
2
 * register the token ring, participate in the token ring,
3
 * and reply to packets when asked by the computer.*/
4

  
1 5
#include <dragonfly_lib.h>
2 6
#include <wireless.h>
3 7
#include <encoders.h>
4 8

  
5
#define MAP_RECEIVE_GROUP 1
6
#define MAP_REQUEST_GROUP 2
9
#define MAP_RECEIVE_GROUP 17
10
#define MAP_REQUEST_GROUP 23
7 11

  
8 12
#define POINT_RAW 1 // packet type for map data points w/ raw encoder data
9 13
#define POINT_ODO 2 // packet type for map data points w/ odometry data
......
36 40
    wl_token_ring_register();
37 41
    wl_token_ring_join();
38 42

  
39
    char *send;   // for transmission
40

  
41 43
    while(1)
42 44
    {
43 45
		wl_do();
......
65 67
		POINT_ODO, &store, 0, source, 0);
66 68
    
67 69
}
70

  
71

  

Also available in: Unified diff