-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
72 lines (50 loc) · 1.83 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
#include "functions.h"
int i=0;
int main(int argc, char *argv[])
{
if ( argc != 2 ) /* argc should be 2 for correct execution */
{
checkpoints[0]= argv[1];
checkpoints[1]= argv[2];
checkpoints[2]= argv[3];
}
else{
printf("error");
}
int start;
curr_position[0] = 1;
curr_position[1] = 0;
//scanf("%d %d %d",&checkpoints[0],&checkpoints[1],&checkpoints[2]);
//scanf("%d %d",&start,&checkpoints[0]);
//curr_position[0] = uitgangen[start-1][0];
//curr_position[1] = uitgangen[start-1][1];
printf("First checkpoint:%d @(%d,%d)\n",checkpoints[0],uitgangen[checkpoints[0]-1][0],uitgangen[checkpoints[0]-1][1]);
printf("Second checkpoint:%d @(%d,%d)\n",checkpoints[1],uitgangen[checkpoints[1]-1][0],uitgangen[checkpoints[1]-1][1]);
printf("Third checkpoint:%d @(%d,%d)\n\n",checkpoints[2],uitgangen[checkpoints[2]-1][0],uitgangen[checkpoints[2]-1][1]);
// printf("drive(12)\n");
//drive_exit(0);//Drive from start point to (1,0)
print_data();
printf("Start opdracht!----------------------------------------------------\n\n\n");
//drive_exit(curr_direction);
drive_to_intersection(checkpoints[i]-1);
drive_exit(direction_exit[checkpoints[i]-1]);
printf("Checkpoint %d reached!!<<<<<<<<<<<<<<<<<<<<<<\n\n\n",i+1);
i++;
drive_exit((curr_direction+2 )%4);
drive_to_intersection(checkpoints[i]-1);
drive_exit(direction_exit[checkpoints[i]-1]);
printf("Checkpoint %d reached!!<<<<<<<<<<<<<<<<<<<<<<\n\n\n",i+1);
i++;
drive_exit((curr_direction+2 )%4);
drive_to_intersection(checkpoints[i]-1);
drive_exit(direction_exit[checkpoints[i]-1]);
printf("Checkpoint %d reached!!<<<<<<<<<<<<<<<<<<<<<<\n",i+1);
print_data();
print_commands();
send_commands();
printf("END!");
return 1;
}