카메라#
소개#
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.
VEX AIR 드론 컨트롤러에서 동영상과 이미지를 전송하려면 컨트롤러를 컴퓨터에 연결하세요. 컨트롤러는 USB 드라이브와 유사한 대용량 저장 장치로 인식되어 파일을 직접 복사할 수 있습니다. 프로젝트를 종료한 후, 드론에서 이미지나 동영상이 다운로드될 때까지 약 1분 정도 기다린 후 복사를 시도하세요.
아래는 사용 가능한 모든 방법의 목록입니다.
행위
start_recording– 비전 센서에서 비디오를 녹화합니다.stop_recording– 비전 센서의 녹화를 중지합니다.capture_image– 비전 센서에서 이미지를 캡처합니다.
변이 유발인자
show_camera– VEX AIR 드론 컨트롤러에서 선택된 비전 센서를 표시합니다.hide_camera– 컨트롤러에서 비전 센서 피드를 숨깁니다.set_overlay_reticle– 오버레이 레티클을 표시하거나 숨깁니다.set_overlay_telemetry– 텔레메트리 데이터를 표시하거나 숨깁니다.
게터
is_recording– 비전 센서가 녹화 중인지 여부를 반환합니다.get_recording_time– 녹화에 소요된 시간을 반환합니다.
행위#
start_recording#
start_recording 지정된 비전 센서를 사용하여 녹화를 시작합니다.
녹화물을 보고 검색하는 방법에 대한 정보는 여기를 참조하십시오.
용법:
drone.camera.start_recording(camera)
매개변수 |
설명 |
|---|---|
|
녹화에 사용할 비전 센서: |
# Press button 7 to end recording
def end_recording():
drone.camera.stop_recording(FORWARD_CAMERA)
drone.land()
controller.button7.pressed(end_recording)
# Record a video as you fly around
controller.screen.show_camera(FORWARD_CAMERA)
drone.take_off(climb_to=500)
drone.camera.start_recording(FORWARD_CAMERA)
while True:
# Move with controller
drone.move_with_vectors(
forward=controller.axis4.position(),
rightward=controller.axis3.position(),
upward=controller.axis1.position(),
rotation=controller.axis2.position()
)
wait(5, MSEC)
stop_recording#
stop_recording 지정된 비전 센서의 녹화를 중지합니다.
녹화물을 보고 검색하는 방법에 대한 정보는 여기를 참조하십시오.
용법:
drone.camera.stop_recording(camera)
매개변수 |
설명 |
|---|---|
|
비전 센서가 다음 조건으로 녹화를 중지합니다: |
# Press button 7 to end recording
def end_recording():
drone.camera.stop_recording(FORWARD_CAMERA)
drone.land()
controller.button7.pressed(end_recording)
# Record a video as you fly around
controller.screen.show_camera(FORWARD_CAMERA)
drone.take_off(climb_to=500)
drone.camera.start_recording(FORWARD_CAMERA)
while True:
# Move with controller
drone.move_with_vectors(
forward=controller.axis4.position(),
rightward=controller.axis3.position(),
upward=controller.axis1.position(),
rotation=controller.axis2.position()
)
wait(5, MSEC)
capture_image#
capture_image 은 지정된 비전 센서로 사진을 촬영합니다.
캡처된 이미지를 보고 검색하는 방법에 대한 정보는 여기를 참조하십시오.
용법:
drone.camera.capture_image(camera)
매개변수 |
설명 |
|---|---|
|
사진 촬영을 위한 비전 센서: |
# Press button 7 to take pictures
def take_picture():
drone.camera.capture_image(FORWARD_CAMERA)
controller.button7.pressed(take_picture)
# Take pictures while you control the drone
controller.screen.show_camera(FORWARD_CAMERA)
drone.take_off(climb_to=500)
while True:
# Move with controller
drone.move_with_vectors(
forward=controller.axis4.position(),
rightward=controller.axis3.position(),
upward=controller.axis1.position(),
rotation=controller.axis2.position()
)
wait(5, MSEC)
돌연변이체#
show_camera#
show_camera 은 현재 화면 모드를 지정된 비전 센서 피드로 설정합니다.
용법:
controller.screen.show_camera(camera)
매개변수 |
설명 |
|---|---|
|
표시할 비전 센서 피드: |
# Switch camera feeds after 3 seconds
controller.screen.show_camera(DOWNWARD_CAMERA)
wait(3, SECONDS)
controller.screen.show_camera(FORWARD_CAMERA)
hide_camera#
hide_camera 지정된 비전 센서의 영상을 숨깁니다.
용법:
controller.screen.hide_camera()
매개변수 |
설명 |
|---|---|
이 메서드에는 매개변수가 없습니다. |
# Hide camera feed after 3 seconds
controller.screen.show_camera(FORWARD_CAMERA)
wait(3, SECONDS)
controller.screen.hide_camera()
set_overlay_reticle#
set_overlay_reticle 은 오버레이 레티클을 활성화 또는 비활성화합니다. 레티클은 십자선과 같은 시각적 표시로, 카메라 시야에 나타나 조준이나 물체 정렬을 돕습니다.
기본적으로 조준선 오버레이는 프로젝트 시작 시 하향 비전 센서에만 True 로 설정됩니다.
Usage:
controller.screen.set_overlay_reticle(state)
매개변수 |
설명 |
|---|---|
|
오버레이 레티클의 상태: |
# Hide the reticle when not aligning to a landing area
controller.screen.show_camera(DOWNWARD_CAMERA)
drone.take_off(climb_to=500)
controller.screen.set_overlay_reticle(False)
while True:
# Move with controller
drone.move_with_vectors(
forward=controller.axis4.position(),
rightward=controller.axis3.position(),
upward=controller.axis1.position(),
rotation=controller.axis2.position()
)
wait(5, MSEC)
set_overlay_telemetry#
set_overlay_telemetry 컨트롤러 화면에 드론의 텔레메트리 데이터를 표시할지 여부를 설정합니다. 텔레메트리는 드론이 비행 중이거나 프로젝트를 실행하는 동안 수집되는 실시간 데이터입니다.
기본적으로 프로젝트 시작 시 원격 측정 데이터 오버레이는 True (참)로 설정됩니다.
Usage:
controller.screen.set_overlay_telemetry(state)
매개변수 |
설명 |
|---|---|
|
원격 측정 데이터의 상태: |
# Clear the camera video for better visibility
controller.screen.show_camera(FORWARD_CAMERA)
drone.take_off(climb_to=500)
controller.screen.set_overlay_telemetry(False)
while True:
# Move with controller
drone.move_with_vectors(
forward=controller.axis4.position(),
rightward=controller.axis3.position(),
upward=controller.axis1.position(),
rotation=controller.axis2.position()
)
wait(5, MSEC)
게터스#
is_recording#
is_recording 은 지정된 비전 센서가 현재 녹화 중인지 여부를 나타내는 부울 값을 반환합니다.
True– 지정된 비전 센서가 녹화 중입니다.False– 지정된 비전 센서가 녹화 중이 아닙니다.
용법:
drone.camera.is_recording(camera)
매개변수 |
설명 |
|---|---|
|
비전 센서는 다음 카메라의 녹화 상태를 확인합니다: |
# Use button 7 to start and stop recording
def toggle_recording():
if drone.camera.is_recording(FORWARD_CAMERA):
drone.camera.stop_recording(FORWARD_CAMERA)
else:
drone.camera.start_recording(FORWARD_CAMERA)
controller.button7.pressed(toggle_recording)
# Make video recordings while you control the drone
controller.screen.show_camera(FORWARD_CAMERA)
drone.take_off(climb_to=500)
while True:
# Move with controller
drone.move_with_vectors(
forward=controller.axis4.position(),
rightward=controller.axis3.position(),
upward=controller.axis1.position(),
rotation=controller.axis2.position()
)
wait(5, MSEC)
get_recording_time#
get_recording_time 은 특정 비전 센서가 기록한 시간을 소수점 (float) 초 단위로 반환합니다.
용법:
drone.camera.get_recording_time(camera)
매개변수 |
설명 |
|---|---|
|
비전 센서는 다음 항목의 녹화 시간을 확인합니다: |
# Record a video for 10 seconds
controller.screen.show_camera(FORWARD_CAMERA)
drone.camera.start_recording(FORWARD_CAMERA)
drone.take_off(climb_to=500)
while not (drone.camera.get_recording_time(FORWARD_CAMERA)) >= 10:
wait(5, MSEC)
drone.camera.stop_recording(FORWARD_CAMERA)