root / trunk / code / projects / diagnostic_station / station / dump_robot.c @ 1305
History | View | Annotate | Download (1.34 KB)
| 1 |
#include "dump_robot.h" |
|---|---|
| 2 |
|
| 3 |
#include <dragonfly_lib.h> |
| 4 |
|
| 5 |
#include "global.h" |
| 6 |
#include "comm_robot.h" |
| 7 |
|
| 8 |
|
| 9 |
void dump_robot_encoders (void) |
| 10 |
{
|
| 11 |
int16_t left, right; |
| 12 |
char c;
|
| 13 |
|
| 14 |
robot_reset_encoders (); |
| 15 |
|
| 16 |
while (usb_getc_nb (&c)==-1) |
| 17 |
{
|
| 18 |
robot_read_encoders (&left, &right); |
| 19 |
|
| 20 |
usb_puts ("Left: "); usb_puti (left ); usb_puts (NL);
|
| 21 |
usb_puts ("Right: "); usb_puti (right); usb_puts (NL);
|
| 22 |
usb_puts (NL NL); |
| 23 |
|
| 24 |
delay_ms (50);
|
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
void dump_robot_rangefinders (void) |
| 29 |
{
|
| 30 |
uint16_t rf[5];
|
| 31 |
char c;
|
| 32 |
|
| 33 |
while (usb_getc_nb (&c)==-1) |
| 34 |
{
|
| 35 |
// First read all of the values, then print them, because it's much more readable that way.
|
| 36 |
|
| 37 |
for (uint8_t i=0; i<5; ++i) |
| 38 |
{
|
| 39 |
robot_read_rangefinder (i, &rf[i]); |
| 40 |
} |
| 41 |
|
| 42 |
for (uint8_t i=0; i<5; ++i) |
| 43 |
{
|
| 44 |
usb_puti (i); |
| 45 |
usb_puts (": ");
|
| 46 |
usb_puti (rf[i]); |
| 47 |
usb_puts (NL); |
| 48 |
} |
| 49 |
|
| 50 |
usb_puts (NL NL); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
void dump_robot_bom (void) |
| 55 |
{
|
| 56 |
int16_t bom[16];
|
| 57 |
char c;
|
| 58 |
|
| 59 |
while (usb_getc_nb (&c)==-1) |
| 60 |
{
|
| 61 |
// First read all of the values, then print them, because it's much more readable that way.
|
| 62 |
|
| 63 |
//for (uint8_t i=0; i<16; ++i)
|
| 64 |
//robot_read_bom (i, &bom[i]);
|
| 65 |
|
| 66 |
robot_read_bom_all (bom); |
| 67 |
|
| 68 |
for (uint8_t i=0; i<16; ++i) |
| 69 |
{
|
| 70 |
if (i<10) usb_puts (" "); |
| 71 |
usb_puti (i); |
| 72 |
usb_puts (": ");
|
| 73 |
usb_puti (bom[i]); |
| 74 |
usb_puts (NL); |
| 75 |
} |
| 76 |
usb_puts (NL NL); |
| 77 |
} |
| 78 |
} |