home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Between Heaven & Hell 2
/
BetweenHeavenHell.cdr
/
500
/
470
/
rccl091
< prev
next >
Wrap
Text File
|
1987-03-02
|
2KB
|
36 lines
#define RD 57.29577951308232100
main()
{
int i[6];
short e[6];
double a[6], r[6];
for (; ; ) {
printf("give 6 encoder values : ");
if (scanf("%d%d%d%d%d%d",i , i+1, i+2, i+3, i+4, i+5) != 6)
exit(0);
e[0] = i[0]; e[1] = i[1]; e[2] = i[2]; e[3] = i[3]; e[4] = i[4]; e[5] = i[5];
enctorng(r, e);
printf("enc > rng %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f\n",
r[0] * RD, r[1] * RD, r[2] * RD, r[3] * RD, r[4] * RD, r[5] * RD);
rngtoenc(e, r);
printf("rng > enc %-6d %-6d %-6d %-6d %-6d %-6d\n",
e[0] & 0xffff, e[1] & 0xffff, e[2] & 0xffff, e[3] & 0xffff, e[4] & 0xffff, e[5]
enctorng(r, e);
printf("enc > rng %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f\n",
r[0] * RD, r[1] * RD, r[2] * RD, r[3] * RD, r[4] * RD, r[5] * RD);
enctoang(a, e);
printf("enc > ang %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f\n",
a[0] * RD, a[1] * RD, a[2] * RD, a[3] * RD, a[4] * RD, a[5] * RD);
angtoenc(e, a);
printf("ang > enc %-6d %-6d %-6d %-6d %-6d %-6d\n",
e[0] & 0xffff, e[1] & 0xffff, e[2] & 0xffff, e[3] & 0xffff, e[4] & 0xffff, e[5]
enctoang(a, e);
printf("enc > ang %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f\n",
a[0] * RD, a[1] * RD, a[2] * RD, a[3] * RD, a[4] * RD, a[5] * RD);
printf("off %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f %-4.1f\n",
(r[0] - a[0]) * RD, (r[1] - a[1]) * RD, (r[2] - a[2]) * RD,
(r[3] - a[3]) * RD, (r[4] - a[4]) * RD, (r[5] - a[5]) * RD);
}
}