-
Notifications
You must be signed in to change notification settings - Fork 7
/
test.c
47 lines (45 loc) · 1.12 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "ariac.h"
#include <stdio.h>
#include <unistd.h> // for sleep()
int main(int argc, char **argv)
{
aria_init(argc, argv);
while(1)
{
if(!arrobot_connect())
return 1 ;
printf("radius=%.2f, length=%.2fmm, width=%.2fmm\n",
arrobot_radius(),
arrobot_length(),
arrobot_width()
);
arrobot_setvel(200);
arrobot_setrotvel(10);
for(int c = 0; c < 10; ++c)
{
arrobot_connect(); // should skip connection if already connected.
printf("x=%.1f y=%.1f th=%.1f vel=%.1f rotvel=%.1f left=%.1f right=%.1f stall=%d battv=%.1f\n",
arrobot_getx(),
arrobot_gety(),
arrobot_getth(),
arrobot_getvel(),
arrobot_getrotvel(),
arrobot_getleftvel(),
arrobot_getrightvel(),
arrobot_isstalled(),
arrobot_getbatteryvoltage()
);
printf("sonar");
for(int i = 0; i < arrobot_getnumsonar(); ++i)
{
printf(" %d=%f", i, arrobot_getsonarrange(i));
}
puts("");
sleep(1);
}
arrobot_disconnect();
puts("disconnected, reconnecting in 5 sec...");
sleep(5);
}
return 0;
}