PTZ Service Interfaces
Introduction
PTZ Service Interfaces:
Provides camera gimbal angle control and image capture functionality.
| Purpose | Python |
|---|---|
| Get PTZ State | ✔ |
| Set PTZ Angle | ✔ |
| Capture Image | ✔ |
| Get Saved Image List | ✔ |
PTZ Control
Python Interface
get_ptzf(timeout=5)
Function Description
Get the current Pan (horizontal rotation), Tilt (vertical tilt), Zoom, and Focus values of the camera gimbal.
Parameter Description
| Parameter Name | Type | Required/Default | Description |
|---|---|---|---|
timeout | int | 5 | Service call timeout in seconds. |
Return Value
| Type | Description |
|---|---|
GetCurrentPTZFResponse | state.code == 0 indicates success; access values via response.pan, response.tilt, response.zoom, response.focus. |
Example
from daystar_api.lowlevel_skills import get_ptzf
response = get_ptzf()
if response.state.code == 0:
print(f"Pan: {response.response.pan}°")
print(f"Tilt: {response.response.tilt}°")
print(f"Zoom: {response.response.zoom}")set_ptzf(pan=0.0, tilt=0.0, zoom=1.0, focus=0, relative=False, timeout=30)
Function Description
Set the Pan, Tilt, Zoom, and Focus values of the camera gimbal. Supports both absolute positioning and relative movement modes.
Parameter Description
| Parameter Name | Type | Required/Default | Description |
|---|---|---|---|
pan | float | 0.0 | Horizontal rotation angle in degrees. |
tilt | float | 0.0 | Vertical tilt angle in degrees. |
zoom | float | 1.0 | Zoom value. |
focus | int | 0 | Focus value. |
relative | bool | False | If True, values are incremental from current position; if False, absolute angles. |
timeout | int | 30 | Service call timeout in seconds. |
Return Value
| Type | Description |
|---|---|
SetPTZFServiceResponse | state.code == 0 indicates success. |
Example
from daystar_api.lowlevel_skills import set_ptzf
# Absolute positioning
set_ptzf(pan=45.0, tilt=-30.0, zoom=2.0)
# Relative movement (offset from current position)
set_ptzf(pan=10.0, tilt=5.0, relative=True)
# Reset to zero
set_ptzf(pan=0.0, tilt=0.0, zoom=1.0)Image Capture
Python Interface
capture_image(image_name, type='rgb', timeout=5)
Function Description
Capture and save an image from the camera. Images are saved to /root/data/daystar_api/images/.
Parameter Description
| Parameter Name | Type | Required/Default | Description |
|---|---|---|---|
image_name | str | Required | Image save name (without extension). |
type | str | 'rgb' | Image type: 'rgb' for color image; 'infra' for infrared image. |
timeout | int | 5 | Service call timeout in seconds. |
Return Value
| Type | Description |
|---|---|
CaptureImageResponse | state.code == 0 indicates success; response.success is a boolean; response.message contains the saved path information. |
Example
from daystar_api.lowlevel_skills import capture_image
# Capture color image
response = capture_image("photo_001")
if response.response.success:
print(f"Image saved: {response.response.message}")
# Capture infrared image
capture_image("infra_001", type="infra")get_available_images(timeout=5)
Function Description
Get a list of all saved image names. Images are stored in /root/data/daystar_api/images/.
Parameter Description
| Parameter Name | Type | Required/Default | Description |
|---|---|---|---|
timeout | int | 5 | Service call timeout in seconds. |
Return Value
| Type | Description |
|---|---|
GetAvailableImagesResponse | state.code == 0 indicates success; response.image_names is the list of image names. |
Example
from daystar_api.lowlevel_skills import get_available_images
response = get_available_images()
if response.response.success:
for img_name in response.response.image_names:
print(f"Image: {img_name}")