0

Soccer Robot C - Basic lessons - Exercises - Approach ball

Part of the strategy to catch a ball in Robocup Junior Soccer.

Task: approach RCJ ball.

Put a RCJ ball at about 1 m in front of the robot and let it catch the ball. Base Your program on previous code:

void RobotSoccer::loop() {
	static int initialDirection;
	if (setup())
		initialDirection = heading();

	int error = heading() - initialDirection;
	go(40, 0, error);
}