Camera#

Introduction#

The VEX AIR Drone includes two Vision Sensors that serve as its onboard cameras—one on the front and one on the bottom. These can capture both images and video during flight. In VEXcode AIR, the word “camera” always refers to one of these Vision Sensors. For instance, when forward and downward cameras are parameter options, they are referring to the forward facing Vision Sensor and the downward facing Vision Sensor.

To transfer video recordings and images from the VEX AIR Drone Controller, connect the controller to your computer. It will appear as a mass-storage device (similar to a USB drive), allowing you to copy files directly. After ending a project, wait about a minute for the controller to finish downloading any images or recordings from the drone before attempting to copy them.

Below is a list of available blocks:

Video

Overlay

Capture

Video#

show/hide camera video#

The show/hide camera video block shows or hides the feed of the specified Vision Sensor.

move forward stack block#
    [show v] [forward v] camera video on screen

Parameters

Description

state

The state of the Vision Sensor’s feed:

  • show
  • hide

camera

Which Vision Sensor’s feed to use:

  • forward
  • downward

Examples

    when started :: hat events
    [Switch camera feeds after 3 seconds.]
    [show v] [downward v] camera video on screen
    wait (3) seconds
    [show v] [forward v] camera video on screen

    when started :: hat events
    [Hide camera feed after 3 seconds.]
    [show v] [forward v] camera video on screen
    wait (3) seconds
    [hide v] [forward v] camera video on screen

Overlay#

overlay reticle#

The overlay reticle block shows or hides the reticle overlay. A reticle is a visual marker, like a crosshair, that appears in the camera’s view to help with aiming or aligning objects.

By default, the reticle overlay is shown at the start of a project only on the downward Vision Sensor.

move forward stack block#
    overlay [show v] reticle on video

Parameters

Description

state

The state of the overlay reticle:

  • show
  • hide

Example

    when started :: hat events
    [Hide the reticle when not aligning to a landing area.]
    [show v] [downward v] camera video on screen
    take off to [500] [mm v] ▶
    overlay [hide v] reticle on video
    forever
    move with controller

overlay telemetry#

The overlay telemetry block enables or disables the visibility of telemetry data on the controller’s screen. Telemetry is live data from the drone while it is flying or running a project.

By default, the telemetry data overlay is shown at the start of a project.

move forward stack block#
    overlay [show v] telemetry on video

Parameters

Description

state

The state of the telemetry data:

  • show
  • hide

Example

    when started :: hat events
    [Clear the camera video for better visibility.]
    [show v] [forward v] camera video on screen
    take off to [500] [mm v] ▶
    overlay [hide v] telemetry on video
    forever
    move with controller

Capture#

start recording#

The start recording block starts a recording with the specified Vision Sensor.

Note: A recording will not be saved if the stop recording block is not used.

move forward stack block#
    start recording on [forward v] camera

Parameters

Description

camera

The Vision Sensor to record with:

  • forward
  • downward

Example

    when started :: hat events
    [Record a video as you fly around!]
    [show v] [forward v] camera video on screen
    take off to [500] [mm v] ▶
    start recording on [forward v] camera
    forever
    move with controller

    when controller button [7 v] [pressed v] :: hat events
    [Press button 7 to end recording.]
    stop recording on [forward v] camera
    land ▶

stop recording#

The stop recording block stops the recording of the specified Vision Sensor.

move forward stack block#
    stop recording on [forward v] camera

Parameters

Description

camera

The Vision Sensor to stop recording with:

  • forward
  • downward

Example

    when started :: hat events
    [Record a video as you fly around!]
    [show v] [forward v] camera video on screen
    take off to [500] [mm v] ▶
    start recording on [forward v] camera
    forever
    move with controller

    when controller button [7 v] [pressed v] :: hat events
    [Press button 7 to end recording.]
    stop recording on [forward v] camera
    land ▶

capture image#

The capture image block takes a picture with the specified Vision Sensor.

move forward stack block#
    capture image on [forward v] camera

Parameters

Description

camera

The Vision Sensor to take a picture with:

  • forward
  • downward

Example

    when started :: hat events
    [Take pictures while you control the drone.]
    [show v] [forward v] camera video on screen
    take off to [500] [mm v] ▶
    forever
    move with controller
    
    when controller button [5 v] [pressed v] :: hat events
    [Use button 5 to take pictures.]
    capture image on [forward v] camera

is camera recording?#

The is camera recording? block returns a Boolean indicating whether the specified Vision Sensor is currently recording.

  • True — The Vision Sensor is recording.

  • False — The Vision Sensor is not recording.

move forward stack block#
    <is [forward v] camera recording?>

Parameters

Description

camera

The Vision Sensor to check the recording status of:

  • forward
  • downward

Example

    when started :: hat events
    [Make video recordings while you control the drone.]
    [show v] [forward v] camera video on screen
    take off to [500] [mm v] ▶
    forever
    move with controller
    
    when controller button [7 v] [pressed v] :: hat events
    [Use button 7 to start and stop recording.]
    if <is [forward v] camera recording?> then
    stop recording on [forward v] camera
    else
    start recording on [forward v] camera