Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / colonet / server / vision / vision_driver.c @ 1428

History | View | Annotate | Download (766 Bytes)

1
/**
2
 * Driver for testing vision library.
3
 */
4

    
5
#include <vision.h>
6
#include <stdio.h>
7
#include <stdlib.h>
8

    
9
int main(int argc, char** argv) {
10
  if (vision_init() != 0) {
11
    fprintf(stderr, "vision_init failed.\n");
12
    return -1;
13
  } else {
14
    fprintf(stderr, "vision_init succeeded.\n");
15
  }
16
  
17
  while(getchar()!=27)
18
  {
19
    VisionPosition* positions;
20
    int num_positions = vision_get_robot_positions(&positions);
21

    
22
    if (num_positions == -1) {
23
      fprintf(stderr, "vision_get_robot_positions failed.\n");
24
      return 1;
25
    }
26

    
27
    printf("Got %d positions.\n", num_positions);
28

    
29
    int i;
30
    for (i = 0; i < num_positions; i++) {
31
      printf("%d,%d\n", positions[i].x, positions[i].y);
32
    }
33

    
34
    free(positions);
35
  }
36
  
37
  vision_close();
38

    
39
  return 0;
40
}