root / trunk / code / projects / colonet / server / vision / vision_driver.c @ 1428
History | View | Annotate | Download (766 Bytes)
1 | 431 | emarinel | /**
|
---|---|---|---|
2 | * Driver for testing vision library.
|
||
3 | */
|
||
4 | |||
5 | #include <vision.h> |
||
6 | 432 | emarinel | #include <stdio.h> |
7 | 435 | jknichel | #include <stdlib.h> |
8 | 431 | emarinel | |
9 | int main(int argc, char** argv) { |
||
10 | 936 | rcahoon | if (vision_init() != 0) { |
11 | fprintf(stderr, "vision_init failed.\n");
|
||
12 | 431 | emarinel | return -1; |
13 | 466 | emarinel | } else {
|
14 | fprintf(stderr, "vision_init succeeded.\n");
|
||
15 | 431 | emarinel | } |
16 | 936 | rcahoon | |
17 | while(getchar()!=27) |
||
18 | { |
||
19 | VisionPosition* positions; |
||
20 | int num_positions = vision_get_robot_positions(&positions);
|
||
21 | 431 | emarinel | |
22 | 936 | rcahoon | if (num_positions == -1) { |
23 | fprintf(stderr, "vision_get_robot_positions failed.\n");
|
||
24 | return 1; |
||
25 | } |
||
26 | 431 | emarinel | |
27 | 936 | rcahoon | printf("Got %d positions.\n", num_positions);
|
28 | 627 | emarinel | |
29 | 936 | rcahoon | int i;
|
30 | for (i = 0; i < num_positions; i++) { |
||
31 | printf("%d,%d\n", positions[i].x, positions[i].y);
|
||
32 | } |
||
33 | 466 | emarinel | |
34 | 936 | rcahoon | free(positions); |
35 | 431 | emarinel | } |
36 | 936 | rcahoon | |
37 | vision_close(); |
||
38 | 431 | emarinel | |
39 | return 0; |
||
40 | } |