Timm Murray > UAV-Pilot-0.8 > UAV::Pilot::ARDrone::Driver

Download:
UAV-Pilot-0.8.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  2
View/Report Bugs
Source  

NAME ^

  UAV::Pilot::ARDrone::Driver

SYNOPSIS ^

    my $sender = UAV::Pilot::ARDrone::Driver->new({
        host => '192.168.1.1',
    });
    $sender->connect;
    
    $sender->at_ref( 1, 0 ); # Takeoff
    $sender->at_pcmd( 1, 1, 1.0, 0, 0, 0 ); # Progressive movement, roll
    $sender->at_ref( 0, 0 ); # Land

DESCRIPTION ^

Low-level interface for controlling the Parrot AR.Drone. If you want to write an external program or library controlling this UAV, look at UAV::Pilot::Control::ARDrone instead.

ATTRIBUTES ^

host

port

seq

do_multicast_navdata

If true, navdata will use a multicast IP connection. Mac OSX seems to be tricky to use with multicast. Default is false.

METHODS ^

connect

Initiate the connection to the UAV.

at_ref

    at_ref( $takeoff, $emergency );

Controls takeoff/landing, and also the emergency toggle. If the AR.Drone shows all red lights and won't respond to commands, send this with the emergency flag to reset it. This can also toggle emergency mode on in case the UAV flys out of control.

at_pcmd

    at_pcmd( $do_progressive, $do_combined_yaw,
        $roll, $pitch, $vert_speed, $yaw );

Controls the roll/pitch/vertical speed/yaw. Sending this once will make the AR.Drone go briefly in that direction and then return to normal. For constant motion, the AR.Drone developer documents suggest sending the command every 30ms.

The roll/pitch/vert_speed/yaw parameters are numbers between -1.0 and 1.0. Note that they will be treated as single-precision (16 bit) floats, as per the developer docs.

at_pcmd_mag

    at_pcmd_mag( $do_progressive, $do_combined_yaw,
        $roll, $pitch, $vert_speed, $angular_speed,
        $magneto, $magneto_accuracy );

Same as at_pcmd, but with additional argument for setting the current magneto heading.

For $magneto an angle of 0 means facing north, positive value is facing east, and negative is facing west. 1 and -1 are the same orientation.

The $magneto_accuracy sets the maximum deviation of where the magnetic heading differs from geomagnetic heading in degrees. Negative values indicate an invalid heading.

at_ftrim

Tells the AR.Drone that it's lying horizontally. It must be called after each startup. This command MUST NOT be sent when the drone is flying.

This is automatically called by connect().

at_calib

    at_calib( $device )

Calibrates the magnetometer. This command MUST be sent when the AR.Drone is flying.

The $device parameter should be one of the ARDRONE_CALIBRATION_DEVICE_* constants.

This will cause the AR.Drone to spin around.

at_config

    at_config( $name, $value );

Set a config option. See the list of config constants.

at_config_ids

    at_config_ids( $session_id, $user_id, $app_id );

When using multiconfiguration, send this before every at_config() call.

at_comwdg

Reset the communication watchdog.

at_ctrl

A useful but rather under-documented command for initing things like navigation data.

add_nav_collector

  add_nav_collector( $nav_collector )

Add an object that does the UAV::Pilot::NavCollector role. It will be passed a fresh nav packet each time it comes in.

multi_cmds

    $driver->multi_cmds( sub {
        $driver->at_config_ids( 1234, 5678, 9012 );
        $driver->at_config( 'foo' => 1 );
        $driver->at_config( 'bar' => 2 );
    });

Sends multiple commands in a single packet.

float_convert

    float_convert( 2.0 )

Takes a 32-bit, single-precision floating point number. The binary form is then directly converted into an integer. For example, 0.5 converts into 1056964608.

The protocol requires floating point numbers to be transferred this way in some cases. The API will take care of most of these cases for you, but there are some configuration settings that you'll have to convert yourself (like LED animations).

read_nav_packet

Fetch and parse the latest nav packet off the nav socket. Returns true if there was a new nav packet to read, false otherwise. You can get the last available nav packet by calling last_nav_packet().

This is a non-blocking IO operation.

CONSTANTS ^

Calibration Devices

    ARDRONE_CALIBRATION_DEVICE_MAGNETOMETER
    ARDRONE_CALIBRATION_DEVICE_NUMBER

Ctrl Commands

    ARDRONE_CTRL_GET_CONFIG

Networking Ports

    ARDRONE_PORT_COMMAND
    ARDRONE_PORT_COMMAND_TYPE
    ARDRONE_PORT_NAV_DATA
    ARDRONE_PORT_NAV_DATA_TYPE
    ARDRONE_PORT_VIDEO_P264_V1
    ARDRONE_PORT_VIDEO_P264_V2
    ARDRONE_PORT_VIDEO_P264_V1_TYPE
    ARDRONE_PORT_VIDEO_P264_V2_TYPE
    ARDRONE_PORT_VIDEO_H264
    ARDRONE_PORT_VIDEO_H264_TYPE
    ARDRONE_PORT_CTRL
    ARDRONE_PORT_CTRL_TYPE

Configuration

General

    ARDRONE_CONFIG_GENERAL_NUM_VERSION_CONFIG
    ARDRONE_CONFIG_GENERAL_NUM_VERSION_MB
    ARDRONE_CONFIG_GENERAL_NUM_VERSION_SOFT
    ARDRONE_CONFIG_GENERAL_DRONE_SERIAL
    ARDRONE_CONFIG_GENERAL_SOFT_BUILD_DATE
    ARDRONE_CONFIG_GENERAL_MOTOR1_SOFT
    ARDRONE_CONFIG_GENERAL_MOTOR1_HARD
    ARDRONE_CONFIG_GENERAL_MOTOR1_SUPPLIER
    ARDRONE_CONFIG_GENERAL_ARDRONE_NAME
    ARDRONE_CONFIG_GENERAL_FLYING_TIME
    ARDRONE_CONFIG_GENERAL_NAVDATA_DEMO
    ARDRONE_CONFIG_GENERAL_NAVDATA_OPTIONS
    ARDRONE_CONFIG_GENERAL_COM_WATCHDOG
    ARDRONE_CONFIG_GENERAL_VIDEO_ENABLE
    ARDRONE_CONFIG_GENERAL_VBAT_MIN

Control

    ARDRONE_CONFIG_CONTROL_ACCS_OFFSET             => 'control:accs_offset',
    ARDRONE_CONFIG_CONTROL_ACCS_GAINS              => 'control:accs_gains',
    ARDRONE_CONFIG_CONTROL_GYROS_OFFSET            => 'control:gyros_offset',
    ARDRONE_CONFIG_CONTROL_GYROS_GAINS             => 'control:gyros_gains',
    ARDRONE_CONFIG_CONTROL_GYROS110_OFFSET         => 'control:gyros110_offset',
    ARDRONE_CONFIG_CONTROL_GYROS110_GAINS          => 'control:gyros110_gains',
    ARDRONE_CONFIG_CONTROL_MAGNETO_OFFSET          => 'control:magneto_offset',
    ARDRONE_CONFIG_CONTROL_MAGNETO_RADIUS          => 'control:magneto_radius',
    ARDRONE_CONFIG_CONTROL_GYRO_OFFSET_THR_X       => 'control:gyro_offset_thr_x',
    ARDRONE_CONFIG_CONTROL_PWM_REF_GYROS           => 'control:pwm_ref_gyros',
    ARDRONE_CONFIG_CONTROL_OSCTUN_VALUE            => 'control:osctun_value',
    ARDRONE_CONFIG_CONTROL_OSCTUN_TEST             => 'control:osctun_test',
    ARDRONE_CONFIG_CONTROL_CONTROL_LEVEL           => 'control:control_level',
    ARDRONE_CONFIG_CONTROL_EULER_ANGLE_MAX         => 'control:euler_angle_max',
    ARDRONE_CONFIG_CONTROL_ALTITUDE_MAX            => 'control:altitude_max',
    ARDRONE_CONFIG_CONTROL_ALTITUDE_MIN            => 'control:altitude_min',
    ARDRONE_CONFIG_CONTROL_CONTROL_IPHONE_TILT     => 'control:control_iphone_tilt',
    ARDRONE_CONFIG_CONTROL_CONTROL_VZ_MAX          => 'control:control_vz_max',
    ARDRONE_CONFIG_CONTROL_CONTROL_YAW             => 'control:control_yaw',
    ARDRONE_CONFIG_CONTROL_OUTDOOR                 => 'control:outdoor',
    ARDRONE_CONFIG_CONTROL_FLIGHT_WITHOUT_SHELL    => 'control:flight_without_shell',
    ARDRONE_CONFIG_CONTROL_AUTONOMOUS_FLIGHT       => 'control:autonomous_flight',
    ARDRONE_CONFIG_CONTROL_MANUAL_TRIM             => 'control:manual_trim',
    ARDRONE_CONFIG_CONTROL_INDOOR_EULER_ANGLE_MAX  => 'control:indoor_euler_angle_max',
    ARDRONE_CONFIG_CONTROL_INDOOR_CONTROL_VZ_MAX   => 'control:indoor_control_vz_max',
    ARDRONE_CONFIG_CONTROL_INDOOR_CONTROL_YAW      => 'control:indoor_control_yaw',
    ARDRONE_CONFIG_CONTROL_OUTDOOR_EULER_ANGLE_MAX => 'control:outdoor_euler_angle_max',
    ARDRONE_CONFIG_CONTROL_OUTDOOR_CONTROL_VZ_MAX  => 'control:outdoor_control_vz_max',
    ARDRONE_CONFIG_CONTROL_OUTDOOR_CONTROL_YAW     => 'control:outdoor_control_yaw',
    ARDRONE_CONFIG_CONTROL_FLYING_MODE             => 'control:flying_mode',
    ARDRONE_CONFIG_CONTROL_HOVERING_RANGE          => 'control:hovering_range',
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM             => 'control:flight_anim',

Networking

    ARDRONE_CONFIG_NETWORK_SSID_SINGLE_PLAYER
    ARDRONE_CONFIG_NETWORK_WIFI_MODE
    ARDRONE_CONFIG_NETWORK_WIFI_MODE_AP
    ARDRONE_CONFIG_NETWORK_WIFI_MODE_JOIN
    ARDRONE_CONFIG_NETWORK_WIFI_MODE_STATION
    ARDRONE_CONFIG_NETWORK_OWNER_MAC

PIC

    ARDRONE_CONFIG_PIC_ULTRASOUND_FREQ
    ARDRONE_CONFIG_PIC_ULTRASOUND_WATCHDOG
    ARDRONE_CONFIG_PIC_PIC_VERSION

Video

    ARDRONE_CONFIG_VIDEO_CAMIF_FPS
    ARDRONE_CONFIG_VIDEO_CODEC_FPS
    ARDRONE_CONFIG_VIDEO_CAMIF_BUFFERS
    ARDRONE_CONFIG_VIDEO_NUM_TRACKERS
    ARDRONE_CONFIG_VIDEO_CODEC
    ARDRONE_CONFIG_VIDEO_VIDEO_SLICES
    ARDRONE_CONFIG_VIDEO_VIDEO_LIVE_SOCKET
    ARDRONE_CONFIG_VIDEO_VIDEO_STORAGE_SPACE
    ARDRONE_CONFIG_VIDEO_BITRATE
    ARDRONE_CONFIG_VIDEO_MAX_BITRATE
    ARDRONE_CONFIG_VIDEO_BITRATE_CONTROL_MODE
    ARDRONE_CONFIG_VIDEO_BITRATE_STORAGE
    ARDRONE_CONFIG_VIDEO_VIDEO_CHANNEL
    ARDRONE_CONFIG_VIDEO_VIDEO_ON_USB
    ARDRONE_CONFIG_VIDEO_VIDEO_FILE_INDEX

LEDS

    ARDRONE_CONFIG_LEDS_LEDS_ANIM

Detect

    ARDRONE_CONFIG_DETECT_ENEMY_COLORS
    ARDRONE_CONFIG_DETECT_GROUNDSTRIPE_COLORS
    ARDRONE_CONFIG_DETECT_ENEMY_WITHOUT_SHELL
    ARDRONE_CONFIG_DETECT_TYPE
    ARDRONE_CONFIG_DETECT_DETECTIONS_SELECT_H
    ARDRONE_CONFIG_DETECT_DETECTIONS_SELECT_V_HSYNC
    ARDRONE_CONFIG_DETECT_DETECTIONS_SELECT_V

Userbox

    ARDRONE_CONFIG_USERBOX_USERBOX_CMD

GPS

    ARDRONE_CONFIG_GPS_LATITUDE
    ARDRONE_CONFIG_GPS_LONGITUDE
    ARDRONE_CONFIG_GPS_ALTITUDE

Custom

    ARDRONE_CONFIG_CUSTOM_APPLICATION_ID
    ARDRONE_CONFIG_CUSTOM_APPLICATION_DESC
    ARDRONE_CONFIG_CUSTOM_PROFILE_ID
    ARDRONE_CONFIG_CUSTOM_PROFILE_DESC
    ARDRONE_CONFIG_CUSTOM_SESSION_ID
    ARDRONE_CONFIG_CUSTOM_SESSION_DESC

Flight Animation

    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_PHI_M30_DEG
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_PHI_30_DEG
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_M30_DEG
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_30_DEG
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_20DEG_YAW_200DEG
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_20DEG_YAW_M200DEG
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_TURNAROUND
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_TURNAROUND_GODOWN
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_YAW_SHAKE
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_YAW_DANCE
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_PHI_DANCE
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_DANCE
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_VZ_DANCE
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_WAVE
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_PHI_THETA_MIXED
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_DOUBLE_PHI_THETA_MIXED
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_FLIP_AHEAD
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_FLIP_BEHIND
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_FLIP_LEFT
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_FLIP_RIGHT

    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_PHI_M30_DEG_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_PHI_30_DEG_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_M30_DEG_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_30_DEG_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_20DEG_YAW_200DEG_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_20DEG_YAW_M200DEG_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_TURNAROUND_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_TURNAROUND_GODOWN_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_YAW_SHAKE_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_YAW_DANCE_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_PHI_DANCE_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_THETA_DANCE_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_VZ_DANCE_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_WAVE_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_PHI_THETA_MIXED_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_DOUBLE_PHI_THETA_MIXED_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_FLIP_AHEAD_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_FLIP_BEHIND_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_FLIP_LEFT_MAYDAY
    ARDRONE_CONFIG_CONTROL_FLIGHT_ANIM_FLIP_RIGHT_MAYDAY
syntax highlighting: