Exemplo n.º 1
0
// calculate left and right wheel commands
void combine(uint32_t x, uint32_t y)
{
	int32_t xError, yError, axesIn[2], axesOut[2];

	xError = X_CENTER-x;
	yError = Y_TRACK-y;
	
	//cprintf("x: %d y: %d xError: %d yError: %d\n", x, y, xError, yError);

	axesIn[0] = g_transLoop.update(yError);
	axesIn[1] = g_rotLoop.update(xError);

	axisMap(axesIn, axesOut);

	rcs_setPos(LEFT_AXIS, scaleMotor(axesOut[0]));
	rcs_setPos(RIGHT_AXIS, scaleMotor(axesOut[1]));
}	
Exemplo n.º 2
0
void motor(uint32_t x, uint32_t y)
{
	static MotorLoop rloop(1600, 4500);
	static MotorLoop tloop(4000, 4000);

	int32_t xerror, yerror, axesIn[2], axesOut[2];

	xerror = XCENTER-x;
	yerror = YTRACK-y;
	
	axesIn[0] = tloop.update(yerror);
	axesIn[1] = rloop.update(xerror);

	axisMap(axesIn, axesOut);

	rcs_setPos(0, scaleMotor(axesOut[0]));
	rcs_setPos(1, scaleMotor(axesOut[1]));
}