Last Updated on : 2023-08-09 09:25:02
Pan-tilt-zoom (PTZ) control enables a camera to pan from left to right, tilt up and down, and zoom in and out of a scene.
Feature | Description |
---|---|
Basic features |
|
Advanced features |
|
Extended features |
|
Development framework
The generic features provided by IPC Product Development Kit.
Components
app_user_ptz
app_sys_ptz
app_user_event
Configure the PTZ capabilities with motor.config
and call the initialization API.
TY_SYS_PTZ_PARAM_T ptz_params;
...
// Configure the PTZ capabilities as needed.
...
// Initialize PTZ.
ty_user_ptz_start();
typedef struct {
int max_pan_step; // maximal pan step
int max_pan_angle; // maximal pan angle
int max_tilt_step; // maximal tilt step
int max_tilt_angle; // maximal tilt angle
int horizon_tilt_step; // horizontal tilt step
int pan_speed; // default pan speed
int tilt_speed; // default tilt speed
int tilt_track; // tilt track support flag
int sleep_pos_def; // sleep position support flag
int defalut_patrol_tmode; // default patrol type (non-/simple patrol)
int pan_reverse; // pan motor reverse flag
int tilt_reverse; // tilt motor reverse flag
char struct_type; // device structure type
TY_GET_OBJECT_COORDINATE_CB get_object_coordinate_cb; // determinate track source
char drv_path[DRV_PATH_NAME_LEN]; // path of PTZ driver
} TY_SYS_PTZ_PARAM_T;
/**
* @brief NONE
*
* @return OPERATE_RET
*/
OPERATE_RET ty_user_ptz_start(void);
The PTZ configuration is stored in motor.config
, which does not require parameter passing through a function.
/**
* @fn OPERATE_RET ty_sys_ptz_init(TY_SYS_PTZ_PARAM_T* params)
* @brief initialize PTZ component with user defined parameters.
* @param[in] params: user defined parameters' srtuct pointer.
* @param[out] None.
* @retval OPRT_OK: action succeed; OPRT_INVALID_PARM: invaild parameter.
* @attention None.
*/
OPERATE_RET ty_sys_ptz_init(IN CONST TY_SYS_PTZ_PARAM_T* params);
/**
* @fn int ty_sys_ptz_get_check_state(void)
* @brief check if the device is in self-check
* @param[in] None
* @param[out] None
* @retval 0: is in self check; 1: not in self check.
* @attention None
*/
int ty_sys_ptz_get_check_state(void);
/**
* @fn OPERATE_RET ty_sys_ptz_linkpos_get(OUT INT_T *x, OUT INT_T *y)
* @brief get the current target position coordinates.
* @param[in] None.
* @param[out] x: target pan pos.
* @param[out] y: target tilt pos.
* @retval OPRT_OK: succeed; OPRT_COM_ERROR: PTZ component is uninitialized.
* @attention None.
*/
int ty_sys_ptz_linkpos_get(int *x, int *y);
/**
* @fn int ty_sys_ptz_get_key_status(void)
* @brief get keying task state.
* @param[in] None.
* @retval 0: not in keying; 1: in keying.
* @attention None.
*/
int ty_sys_ptz_get_key_status(void);
/**
* @fn void ty_sys_ptz_stop(void)
* @brief stop PTZ component.
* @param[in] None.
* @param[out] None.
* @retval None.
* @attention None.
*/
void ty_sys_ptz_stop(void);
/**
* @fn OPERATE_RET ty_sys_ptz_get_motion_state(OUT UINT_T *is_move)
* @brief check if PTZ is moving(if md event is caused by PTZ moving).
* @param[in] None.
* @param[out] is_move to store result, 0: still(md event to upload); 1: in move(md event to ignore).
* @retval OPRT_OK: action succeed; OPRT_INVALID_PARM: invaild parameter.
* @attention None.
*/
OPERATE_RET ty_sys_ptz_get_motion_state(OUT UINT_T *is_move);
/**
* @fn OPERATE_RET ty_sys_ptz_pos(int *pan, int *tilt)
* @brief get PTZ position
* @param[in] None.
* @param[out] pan: current pan step.
* @param[out] tilt: current tilt step.
* @retval OPRT_OK: action succeed; OPRT_INVALID_PARM: invaild parameter.
* @attention None.
*/
OPERATE_RET ty_sys_ptz_pos(int *pan, int *tilt);
Here is an example of how to configure the montor.config file
to implement a typical patrol feature.
Configuration item | Value | Description |
---|---|---|
ENV_MOTOR_PTZ_ENABLE | 0 or 1 |
Specify whether to enable the PTZ feature.
|
ENV_MOTOR_STRUCT_TYPE | 0 or 1 |
The PTZ structure.
|
ENV_MOTOR_DRV_PATH | String | The directory of the camera: /dev/tymotor by default. |
ENV_MOTOR_MAX_PAN_STEP | Integer | The maximum step size of horizontal movement. |
ENV_MOTOR_MAX_PAN_ANGLE | Integer | The maximum angle of horizontal movement. |
ENV_MOTOR_MAX_TILT_STEP | Integer | The maximum step size of vertical movement. |
ENV_MOTOR_MAX_TILT_ANGLE | Integer | The maximum angle of vertical movement. |
ENV_MOTOR_TILT_ZERO_STEP | Integer | The step size of vertical movement when the tilt is 0 degrees. |
ENV_MOTOR_PAN_SPEED_MAX | Integer | The maximum speed of horizontal movement. |
ENV_MOTOR_TILT_SPEED_MAX | Integer | The maximum speed of vertical movement. |
ENV_MOTOR_TILT_TRACK_SUPPORT | 0 or 1 |
Specify whether vertical tracking is supported. |
ENV_MOTOR_PATROL_TYPE | 0 or 2 |
Patrol mode.
|
ENV_MOTOR_TILT_INVERSE | 0 or 1 |
The direction of the vertical motor.
|
ENV_MOTOR_PAN_INVERSE | 0 or 1 |
The direction of the horizontal motor.
|
ENV_MOTOR_MOTOR_SUP_SLEEP_POS | 0 or 1 |
Support for physical mask (privacy mode)
|
The PTZ component only provides business logic capabilities and does not include driver capabilities. Add the necessary driver resource if needed.
No, it cannot.
Self-check has the highest priority and cannot be interrupted by other operations. The modules listed from highest to lowest priority:
Yes, it will.
The camera receives the patrol schedule after the user creates it on the mobile app. Here is how the patrol schedule works:
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback