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 example, in a command like drone.camera.start_recording(FORWARD_CAMERA)
, camera
refers to the Vision Sensors, and FORWARD_CAMERA
selects the front-facing one.
Below is a list of all available methods:
Actions
drone.camera.start_recording – Records video from a Vision Sensor.
drone.camera.stop_recording – Stops recording from a Vision Sensor.
drone.camera.capture_image – Captures an image from a Vision Sensor.
Mutators
controller.screen.show_camera – Shows the selected Vision Sensor on the VEX AIR Drone Controller.
controller.screen.hide_camera – Hides the Vision Sensor feed on the controller.
controller.screen.set_overlay_reticle – Shows or hides the overlay reticle.
controller.screen.set_overlay_vision_objects – Shows or hides vision objects.
controller.screen.set_overlay_telemetry – Shows or hides telemetry data.
Getters
drone.camera.is_recording – Returns whether the Vision Sensor is recording.
drone.camera.get_recording_time – Returns the time spent recording.
Actions#
start_recording#
start_recording
records video from the selected Vision Sensor.
Usage:
drone.camera.start_recording(camera)
Parameters |
Description |
---|---|
|
The Vision Sensor to record with:
|
# Record with a camera after taking off
drone.take_off(500)
while not controller.button5.pressing():
wait (0.1, SECONDS)
controller.screen.print("Recording...")
wait(2, SECONDS)
drone.camera.start_recording(FORWARD_CAMERA)
controller.screen.show_camera(FORWARD_CAMERA)
stop_recording#
stop_recording
stops recording from the selected Vision Sensor.
Usage:
drone.camera.stop_recording(camera)
Parameters |
Description |
---|---|
|
The Vision Sensor to stop recording with:
|
# Record with a camera after taking off
drone.take_off(500)
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
if controller.button5.pressing():
controller.screen.print("Recording:")
wait(1, SECONDS)
drone.camera.start_recording(FORWARD_CAMERA)
controller.screen.show_camera(FORWARD_CAMERA)
elif controller.button6.pressing():
controller.screen.hide_camera()
drone.camera.stop_recording(FORWARD_CAMERA)
controller.screen.print("Recording stopped.")
else:
wait(0.1, SECONDS)
capture_image#
Documentation Coming Soon
Mutators#
show_camera#
show_camera
sets the current screen mode to the specified Vision Sensor feed.
Usage:
controller.screen.show_camera(camera)
Parameters |
Description |
---|---|
|
The Vision Sensor feed to display:
|
# Record with a camera after taking off
drone.take_off(500)
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
if controller.button5.pressing():
controller.screen.print("Recording:")
wait(1, SECONDS)
drone.camera.start_recording(FORWARD_CAMERA)
controller.screen.show_camera(FORWARD_CAMERA)
elif controller.button6.pressing():
controller.screen.hide_camera()
drone.camera.stop_recording(FORWARD_CAMERA)
controller.screen.print("Recording stopped.")
else:
wait(0.1, SECONDS)
hide_camera#
hide_camera
sets the current screen mode to the print area.
Usage:
controller.screen.hide_camera()
Parameters |
Description |
---|---|
This method has no parameters. |
# Record with a camera after taking off
drone.take_off(500)
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
if controller.button5.pressing():
controller.screen.print("Recording:")
wait(1, SECONDS)
drone.camera.start_recording(FORWARD_CAMERA)
controller.screen.show_camera(FORWARD_CAMERA)
elif controller.button6.pressing():
controller.screen.hide_camera()
drone.camera.stop_recording(FORWARD_CAMERA)
controller.screen.print("Recording stopped.")
else:
wait(0.1, SECONDS)
set_overlay_reticle#
set_overlay_reticle
enables or disables the overlay reticle.
Usage:
controller.screen.set_overlay_reticle(state)
Parameters |
Description |
---|---|
|
The state of the overlay reticle:
|
# Record with a camera after taking off
drone.take_off(500)
while True:
if controller.button5.pressing():
controller.screen.set_overlay_reticle(True)
elif controller.button6.pressing():
controller.screen.set_overlay_reticle(False)
else:
wait(0.1, SECONDS)
set_overlay_vision_objects#
Documentation Coming Soon
set_overlay_telemetry#
set_overlay_telemetry
enables or disables the visibility of the drone’s telemetry data on the controller’s screen.
Usage:
controller.screen.set_overlay_telemetry(state)
Parameters |
Description |
---|---|
|
The state of the telemetry data:
|
# Record with a camera after taking off
drone.take_off(500)
while True:
if controller.button5.pressing():
controller.screen.set_overlay_telemetry(True)
elif controller.button6.pressing():
controller.screen.set_overlay_telemetry(False)
else:
wait(0.1, SECONDS)
Getters#
is_recording#
is_recording
returns a Boolean indicating whether a specified Vision Sensor is currently recording.
True
– The specified Vision Sensor is recording.False
– The specified Vision Sensor is not recording.
Usage:
drone.camera.is_recording(camera)
Parameters |
Description |
---|---|
|
The Vision Sensor to check recording status of:
|
# Record with a camera after taking off
drone.take_off(500)
while True:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
if controller.button5.pressing():
if drone.camera.is_recording():
controller.screen.print("Already recording.")
controller.screen.print("Recording:")
wait(1, SECONDS)
drone.camera.start_recording(FORWARD_CAMERA)
controller.screen.show_camera(FORWARD_CAMERA)
elif controller.button6.pressing():
controller.screen.hide_camera()
drone.camera.stop_recording(FORWARD_CAMERA)
controller.screen.print("Recording stopped.")
wait(1, SECONDS)
else:
wait(0.1, SECONDS)
get_recording_time#
get_recording_time
returns the amount of time a specific Vision Sensor has been recording for in seconds.
Usage:
drone.camera.get_recording_time(camera)
Parameters |
Description |
---|---|
|
The Vision Sensor to check recording time of:
|
drone.take_off(500)
drone.camera.start_recording(FORWARD_CAMERA)
while drone.camera.is_recording:
controller.screen.clear_screen()
controller.screen.set_cursor(1, 1)
if controller.button5.pressing():
drone.camera.stop_recording(FORWARD_CAMERA)
else:
controller.screen.print("Recording for: {} seconds.".format(drone.camera.get_recording_time(FORWARD_CAMERA)))
wait(0.1, SECONDS)