C:/Users/Michael/Desktop/trunk/program/demo/runfollowball.c File Reference

Following balls using the camera. More...

#include <p30f6014a.h>
#include <string.h>
#include "motor_led/e_epuck_ports.h"
#include "motor_led/e_init_port.h"
#include "uart/e_uart_char.h"
#include "motor_led/advance_one_timer/e_agenda.h"
#include "motor_led/advance_one_timer/e_motors.h"
#include "camera/fast_2_timer/e_po3030k.h"
#include "search_ball.h"

Functions

void select_cam_mode (int mode)
 Set the mode of the camera.
void execute (unsigned char *buf_execute, Epuck *epuck)
 Execute all the steps to follow the ball.
void follow_red (unsigned char *buf, int size)
 The filter to follow the red ball.
void follow_green (unsigned char *buf, int size)
 The filter to follow the green ball.
void run_follow_ball (void)
 The "main" function to follow all the balls.
void run_follow_ball_green (void)
 The "main" function to follow the green ball.
void run_follow_ball_red (void)
 The "main" function to follow the red ball.


Detailed Description

Following balls using the camera.

Introduction

This demo show you how you can drive the camera to make vision based algorithmes. This programm uses the camera to follow balls. There are three differents configurations:

How it works

The goal of this programm is to search a ball, when one is found the e-puck has to go in it direction and has to stop at a specified distance. This is done by the following steps:

The graphe of the array when a ball is detected

pic.gif

Playing the follower

When we want to follow all the balls, the camera is used in gray scale mode.
When we want to follow the green ball for exemple, the camera is used in color mode. In color mode, we have three values: 1 for the red, 1 one for the green, 1 for the blue. Then to follow the green ball we only have to take the red constituent, because the value of green in the red constituent is near zero => it makes a pic in the array.
When we want to follow the red ball, it's the same principle: we take the green constituent,...

Playing the demo

The programm works with the contrast of the color between the ball and the environement, so to have the best result you should place the e-puck in an arena which has white wall and good luminosity.
To play the demo select the configuration you want (follow all, green, red balls) and let's go. The e-puck will turn on himself until he finds a ball.

Video of the demo

Author:
Code: Jonathan Besuchet, Alain Balleret
Doc: Jonathan Besuchet

Function Documentation

void execute ( unsigned char *  buf_execute,
Epuck *  epuck 
)

Execute all the steps to follow the ball.

The steps are:

void follow_green ( unsigned char *  buf,
int  size 
)

The filter to follow the green ball.

Parameters:
buf The array containing the image
size The size of the array

void follow_red ( unsigned char *  buf,
int  size 
)

The filter to follow the red ball.

Parameters:
buf The array containing the image
size The size of the array

void select_cam_mode ( int  mode  ) 

Set the mode of the camera.

Parameters:
mode Put RGB_565_MODE or GREY_SCALE_MODE


Generated on Fri Feb 29 14:27:42 2008 for Demo by  doxygen 1.5.4