Project

General

Profile

Revision 1318

Martin updated some of the tests
test_motors is working with higher resolution
test_encoders is not working

View differences:

test_encoders.c
39 39
static void test_encoders_direction (uint8_t direction1, uint8_t direction2, uint8_t num_measurements, uint8_t velocity, uint16_t on_delay, uint16_t off_delay)
40 40
{
41 41
	// Allocate space for the data on the stack
42
	int16_t *data_station_l  =malloc (num_measurements*sizeof (uint16_t));
43
	int16_t *data_station_r  =malloc (num_measurements*sizeof (uint16_t));
44
	int16_t *data_robot_l    =malloc (num_measurements*sizeof (uint16_t));
45
	int16_t *data_robot_r    =malloc (num_measurements*sizeof (uint16_t));
46
+	// Seems like we've got a stack overflow...see test_motors.c
42
//	int16_t *data_station_l  =malloc (num_measurements*sizeof (uint16_t));
43
//	int16_t *data_station_r  =malloc (num_measurements*sizeof (uint16_t));
44
//	int16_t *data_robot_l    =malloc (num_measurements*sizeof (uint16_t));
45
//	int16_t *data_robot_r    =malloc (num_measurements*sizeof (uint16_t));
47 46
	usb_puts ("# Resetting encoders" NL);
48 47
	dynamos_reset ();
49 48
	robot_reset_encoders ();
49

  
50
	int16_t station_l=11, station_r=22, robot_l=33, robot_r=44;
50 51
	
51 52
	for (uint8_t m=0; m<num_measurements; ++m)
52 53
	{
......
56 58
		delay_ms (off_delay);
57 59

  
58 60
		// Read the station dynamos
59
		dynamos_read (&(data_station_l[m]), &(data_station_r[m]));
61
		dynamos_read (&station_l, &station_r);
62
//		data_station_l[m]=station_l;
63
//		data_station_r[m]=station_r;
60 64
		
61 65
		// Read the robot encoders
62
		robot_read_encoders (&(data_robot_l[m]), &(data_robot_r[m]));
66
		robot_read_encoders (&robot_l, &robot_r);
67
//		data_robot_l[m]=robot_l;
68
//		data_robot_r[m]=robot_r;
63 69
		
64 70
		//usb_puts ("# I readed teh encoders: ");
65 71
		//usb_puti (data_robot_l[m]);
......
67 73
		//usb_puti (data_robot_r[m]);
68 74
		//usb_puts (NL);
69 75

  
76
	send_encoder_data (0, direction1, &station_l, &robot_l, 1);
77
	send_encoder_data (1, direction2, &station_r, &robot_r, 1);
70 78
	}
71 79

  
72
	send_encoder_data (0, direction1, data_station_l, data_robot_l, num_measurements);
73
	send_encoder_data (1, direction2, data_station_r, data_robot_r, num_measurements);
80
//	send_encoder_data (0, direction1, data_station_l, data_robot_l, num_measurements);
81
//	send_encoder_data (1, direction2, data_station_r, data_robot_r, num_measurements);
74 82
	
75
	free (data_robot_r);
76
	free (data_robot_l);
77
	free (data_station_r);
78
	free (data_station_l);
83
//	free (data_robot_r);
84
//	free (data_robot_l);
85
//	free (data_station_r);
86
//	free (data_station_l);
79 87
}
80 88

  
81 89

  

Also available in: Unified diff