예제 #1
0
void confused(struct RoboAI *ai, struct blob *blobs, void *state)
{
	int dx, dy;
	if (0 == blobs) {
	  pivot_left_speed(25);
	  return;
	}

	dx = blobs->cx[0] * 100 / (blobs->cx[0] + blobs->cy[0]);
	dy = blobs->cy[0] * 100 / (blobs->cx[0] + blobs->cy[0]);
	if (dx - dy > -10 && dx - dy < 10)
		turn_left_speed(dx - dy);
	else
		pivot_left_speed(dx - dy);
}
예제 #2
0
//functions for turning left
int pivot_left(){
	return pivot_left_speed(DEFAULT_SPEED);
}
예제 #3
0
파일: roboAI.c 프로젝트: geoffkflee/C85
/**
 * [pivotRobot - helper function for toggling between rotations]
 * @param turnSpeed [input motor speed]
 */
void pivotRobot(int turnSpeed){
  if (toggleTurn)
    pivot_left_speed(turnSpeed);
  else
    pivot_right_speed(turnSpeed);
}