Revision 1205
Implemented single encoder testing
Cleaned up motor direction/wall direction naming
comm_robot.c | ||
---|---|---|
8 | 8 |
char finished = 0; |
9 | 9 |
char data_received[10]; |
10 | 10 |
|
11 |
char *motor_direction_string (uint8_t direction) |
|
12 |
{ |
|
13 |
if (direction==motor_direction_forward) |
|
14 |
return "forward"; |
|
15 |
else if (direction==motor_direction_backward) |
|
16 |
return "backward"; |
|
17 |
else if (direction==motor_direction_off) |
|
18 |
return "off"; |
|
19 |
else |
|
20 |
return "?"; |
|
21 |
} |
|
22 |
|
|
23 |
|
|
11 | 24 |
static uint8_t motor_direction (uint8_t direction) |
12 | 25 |
{ |
13 |
if (direction==direction_backward) |
|
26 |
if (direction==motor_direction_backward)
|
|
14 | 27 |
return BACKWARD; |
15 | 28 |
else |
16 | 29 |
return FORWARD; |
... | ... | |
18 | 31 |
|
19 | 32 |
static uint8_t motor_velocity (uint8_t direction, uint8_t velocity) |
20 | 33 |
{ |
21 |
if (direction==direction_off) |
|
34 |
if (direction==motor_direction_off)
|
|
22 | 35 |
return 0; |
23 | 36 |
else |
24 | 37 |
return velocity; |
... | ... | |
65 | 78 |
send_command_packet (station_robot_set_orbs, data, 6); |
66 | 79 |
} |
67 | 80 |
|
68 |
/** Direction is direction_off/direction_forward/direction_backward, not FORWARD/BACKWARD */
|
|
81 |
/** Direction is motor_direction_off/forward/backward, not FORWARD/BACKWARD */
|
|
69 | 82 |
void robot_set_motors (uint8_t direction1, uint8_t speed1, uint8_t direction2, uint8_t speed2) |
70 | 83 |
{ |
71 | 84 |
char data[4]; |
... | ... | |
78 | 91 |
send_command_packet (station_robot_set_motors, data, 4); |
79 | 92 |
} |
80 | 93 |
|
81 |
/** Direction is direction_off/direction_forward/direction_backward, not FORWARD/BACKWARD */
|
|
94 |
/** Direction is direction_off/forward/backward, not FORWARD/BACKWARD */
|
|
82 | 95 |
void robot_set_motors_time (uint8_t direction1, uint8_t speed1, uint8_t direction2, uint8_t speed2, uint16_t time_ms) |
83 | 96 |
{ |
84 | 97 |
char data[6]; |
Also available in: Unified diff