Skip to content

PTZ Service Interfaces

Introduction

PTZ Service Interfaces:
Provides camera gimbal angle control and image capture functionality.

PurposePython
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 NameTypeRequired/DefaultDescription
timeoutint5Service call timeout in seconds.

Return Value

TypeDescription
GetCurrentPTZFResponsestate.code == 0 indicates success; access values via response.pan, response.tilt, response.zoom, response.focus.

Example

python
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 NameTypeRequired/DefaultDescription
panfloat0.0Horizontal rotation angle in degrees.
tiltfloat0.0Vertical tilt angle in degrees.
zoomfloat1.0Zoom value.
focusint0Focus value.
relativeboolFalseIf True, values are incremental from current position; if False, absolute angles.
timeoutint30Service call timeout in seconds.

Return Value

TypeDescription
SetPTZFServiceResponsestate.code == 0 indicates success.

Example

python
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 NameTypeRequired/DefaultDescription
image_namestrRequiredImage save name (without extension).
typestr'rgb'Image type: 'rgb' for color image; 'infra' for infrared image.
timeoutint5Service call timeout in seconds.

Return Value

TypeDescription
CaptureImageResponsestate.code == 0 indicates success; response.success is a boolean; response.message contains the saved path information.

Example

python
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 NameTypeRequired/DefaultDescription
timeoutint5Service call timeout in seconds.

Return Value

TypeDescription
GetAvailableImagesResponsestate.code == 0 indicates success; response.image_names is the list of image names.

Example

python
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}")