#include "../h/rccl.h"
#include "../h/rtc.h"

extern int rtime;
extern int completed;
extern struct how how;

pumatask()
{
	TRSF_PTR z, b1, e;
	POS_PTR  p1;
	int q, sensor;

	e = gentr_trsl("E",  0.,  0., 170.);
	z = gentr_trsl("Z",  0.,  0., 864.);
	b1 = gentr_rot("B1", 600. , 300., 500., yunit, 180.);

	b1->fn = hold;
	p1 = makeposition("P1" , z, t6, e, EQ, b1, TL, e);

	movejnts(p1, 400, 2200);
	waitfor(completed);

	sensor = adcopen(7);
	while(how.adcr[sensor] < 10) {
		printf("%f mm\n", b1->p.z);
		b1->p.z -= 3.;
		movejnts(p1, 60, 150);
		waitfor(p1->end);
	}
	printf("The table is at %f mm\n", b1->p.z);
	movejnts(park, 400, 2500);
}
