The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

  UAV::Pilot::Control::ARDrone

SYNOPSIS

    my $sender = UAV::Pilot::Driver::ARDrone->new( ... );
    $sender->connect;
    my $dev = UAV::Pilot::Control::ARDrone->new({
        sender => $sender,
    });
    
    $dev->takeoff;
    $dev->pitch( 0.5 );
    $dev->wave;
    $dev->flip_left;
    $dev->land;

DESCRIPTION

UAV::Pilot::Control implementation for the Parrot AR.Drone.

METHODS

new

    new({
        driver => $driver,
        video  => $video_driver,
    });

Constructor. As with UAV::Pilot::Control, the driver option is a mandatory parameter with the value being a UAV::Pilot::Driver::ARDrone object.

The optional video parameter is a UAV::Pilot::Driver::ARDrone::Video object. When the emergency mode is toggled on the ARDrone, the video stream needs to be restarted. Placing the object here will call emergency_restart() on the video object for you.

takeoff

Takeoff.

land

Land.

pitch

    pitch( 0.5 )

Pitch (front-to-back movement). Takes a floating point number between -1.0 and 1.0. On the AR.Drone, negative numbers pitch the nose down and fly forward.

roll

    roll( -1.0 )

Roll (left-to-right movement). Takes a floating point number between -1.0 and 1.0. On the AR.Drone, negative numbers go left.

yaw

    yaw( -0.25 )

Yaw (spin). Takes a floating point number between -1.0 and 1.0. On the AR.Drone, negative numbers spin left.

vert_speed

    vert_speed( 0.7 )

Change the vertical speed. Takes a floating point number between -1.0 and 1.0. On the AR.Drone, negative numbers make it go down.

calibrate

Calibrates the magnetometer. This must be done while in flight. The drone will spin around (yaw movement) while it does this.

emergency

Toggles the emergency state. If your UAV goes out of control, call this to immediately shut it off. When in the emergency state, it will not be responsive to further commands. Call this again to bring it out of this state.

reset_watchdog

Sends a command to reset the watchdog process. You need to send some command at least every 2 seconds, or else the AR.Drone thinks the connection was lost. If you don't have anything else to send, send this one.

If you run start_event_loop(), the reset will happen for you.

hover

Stops the UAV and hovers in place.

start_userbox_nav_data

Starts saving navigation data on the UAV itself. The file will be in the directory:

    /boxes/flight_YYYYMMDD_hhmmss

You can FTP into the AR.Drone to retrieve this.

stop_userbox_nav_data

Stops logging navigation data on the UAV.

cancel_userbox_nav_data

Stops logging navigation data on the UAV AND deletes the log directory.

take_picture

    take_picture( $delay, $num_pics )

Saves a picture in JPG format to:

    /boxes/flight_YYYYMMDD_hhmmss/picture_YYYYMMDD_hhmmss.jpg

You can FTP into the AR.Drone to retrieve this.

FLIGHT ANIMATION METHODS

The Parrot AR.Drone comes preprogrammed with a bunch of "flight animations" (complicated achrebatic manuevers). You can call the methods below to run them. Note that some of these need a generous amount of horizontal and vertical space, so be sure to be in a wide open area for testing.

I find "wave" and "flip_behind" are particularly good ways to impress house guests :)

    phi_m30_deg
    phi_30_deg
    theta_m30_deg
    theta_30_deg
    theta_20deg_yaw_200deg
    theta_20deg_yaw_m200deg
    turnaround
    turnaround_godown
    yaw_shake
    yaw_dance
    phi_dance
    theta_dance
    vz_dance
    wave
    phi_theta_mixed
    double_phi_theta_mixed
    flip_ahead
    flip_behind
    flip_left
    flip_right

LED ANIMATION METHODS

The LEDs on the Parrot AR.Drone can be directly controlled using these animation methods. They all take two parameters: the frequency (in Hz) as a floating point number, and the duration.

    led_blink_green_red
    led_blink_green
    led_blink_red
    led_blink_orange
    led_snake_green_red
    led_fire
    led_standard
    led_red
    led_green
    led_red_snake
    led_blank
    led_right_missile
    led_left_missile
    led_double_missile
    led_front_left_green_others_red
    led_front_right_green_others_red
    led_rear_right_green_others_red
    led_rear_left_green_others_red
    led_left_green_right_red
    led_left_red_right_green
    led_blink_standard