14.01.2013 Views

A.R.Drone Developer Guide - Abstract

A.R.Drone Developer Guide - Abstract

A.R.Drone Developer Guide - Abstract

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

26<br />

Listing 5.6: The video pipeline<br />

typedef struct _vp_api_io_stage_<br />

{<br />

//Enum corresponding to the type of stage available, include in file .<br />

//Only used for Debug.<br />

VP_API_IO_TYPE type;<br />

//Specific data to the current stage. Definitions are given in include files <<br />

VP_Stages/*> .<br />

void *cfg;<br />

//Structure {vp_api_stage_funcs} is included in with the<br />

definition of stages.<br />

Stages are included also in the directory Soft/Lib/ardrone_tool/Video.<br />

vp_api_stage_funcs_t funcs;<br />

/ /This structure is included in the file and is shared between<br />

all stages. It contains video<br />

buffers and information on decoding the video.<br />

vp_api_io_data_t data;<br />

} vp_api_io_stage_t;<br />

Definition of the structure of a pipeline:<br />

The structure is included in file :<br />

typedef struct _vp_api_io_pipeline_<br />

{<br />

//Number of stage to added in the pipeline.<br />

uint32_t nb_stages;<br />

//Address to the first stage.<br />

vp_api_io_stage_t *stages;<br />

//Must equal to NULL<br />

vp_api_handle_msg_t handle_msg;<br />

//Must equal to 0.<br />

uint32_t nb_still_running;<br />

//Must equal to NULL.<br />

vp_api_fifo_t fifo;<br />

} vp_api_io_pipeline_t;<br />

5.7 Adding control devices<br />

The AR<strong>Drone</strong>Tool and demonstration programs come with an example of how to use a gamepad<br />

to pilot the drone.<br />

The gamepad.c[pp] files in the example contain the code necessary to detect the presence of a<br />

gamepad, poll its status and send corresponding commands.<br />

To add a control device and make AR<strong>Drone</strong>Tool consider it, you must write :<br />

• an initialization function, that AR<strong>Drone</strong>Tool will call once when initializing the application.<br />

The provided example scans the system and searches a known gamepad by looking<br />

for its USB Vendor ID and Product ID.<br />

• an update function, that AR<strong>Drone</strong>Tool will systatically call every 20ms during the application<br />

lifetime, unless the initialization fails<br />

• a clean up function, that AR<strong>Drone</strong>Tool calls once at the end of the application

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!