Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / diagnostic_station / station / test_encoders.c @ 1159

History | View | Annotate | Download (846 Bytes)

1
#include "test_encoders.h"
2
#include "global.h"
3

    
4
#define num_measurements 5
5
#define velocity 200
6
#define delay 500
7

    
8
void test_encoders_direction (uint8_t direction1, uint8_t direction2)
9
{
10
        // reset_encoders ();
11
        for (uint8_t m=0; m<num_measurements; ++m)
12
        {
13
                robot_set_motors (direction1, velocity, direction2, velocity);
14
                delay_ms (delay);
15
                
16
                robot_set_motors (direction1, 0, direction2, 0);
17
                delay_ms (delay);        // FIXME wait for steady state!
18
                
19
        //        send (turn motor on for time)
20
        //        wait (done)
21
        //        wait_stopped
22
        //        send (read encoders)
23
        //        receive (data)
24
        //        read encoders
25
        }
26

    
27
}
28

    
29

    
30
void test_encoders (void)
31
{
32
        usb_puts("Testing encoders" NL);
33

    
34
        test_encoders_direction (FORWARD, BACKWARD);
35
        test_encoders_direction (BACKWARD, FORWARD);
36

    
37
        //send data
38
        
39
        usb_puts("Testing encoders finished" NL);
40
}
41