656 lines
19 KiB
C
656 lines
19 KiB
C
#ifndef __PTZ_STRUCT_H_
|
||
#define __PTZ_STRUCT_H_
|
||
#include "sock_utils.h"
|
||
#include "ptz_type_select.h"
|
||
#include "tmc2160.h"
|
||
#include "rotate_electricstable.h"
|
||
|
||
///注:
|
||
///_set表示实际设定的参数,_actual表示实际参数,_state表示状态
|
||
///_last表示保存上一次的参数,_plan表示规划参数,_num表示计数,_count表示计数
|
||
///_control表示控制值
|
||
typedef struct _PtzRotatePlan_
|
||
{
|
||
float max_speed;//最大转速
|
||
float start_angle;//起始点
|
||
float stop_angle;//结束点
|
||
float stop_near_angle;//刹车最近点
|
||
float stop_far_angle; //刹车最远点
|
||
float stop_angle_range;//刹车范围,即stop_near_angle和stop_far_angle之间的绝对距离
|
||
float accelerate_end_angle;//加速结束点
|
||
float decelerate_start_angle;//减速起始点
|
||
char direction;//方向
|
||
float accelerate_angle_range;//起始点和加速结束点之间的距离绝对值
|
||
float decelerate_angle_range;//减速点和停止位置之间的距离绝对值
|
||
float uniform_angle_range; //匀速运动的距离绝对值
|
||
float total_rotate_range; //需要转动的总的距离
|
||
char rotate_switch; //转动开关,1需要转动,0不需要转动
|
||
}PtzRotatePlan;
|
||
|
||
|
||
///云台角度参数
|
||
typedef struct _PtzAngleParameter_
|
||
{
|
||
float angle_min;//云台角度最小值
|
||
float angle_max;//云台角度最大值
|
||
float angle_allow_min;//云台可用角度最小值
|
||
float angle_allow_max;//云台可用角度最大值
|
||
float angle_range;//云台角度范围
|
||
}PtzAngleParameter;
|
||
|
||
|
||
typedef struct _CameraLens_
|
||
{
|
||
unsigned char foucs_state; //状态
|
||
unsigned char zoom_state; //状态
|
||
|
||
float focus_v;//聚焦反馈电压
|
||
float focus_v_bit;//聚焦反馈电压预置位控制
|
||
unsigned char focus_g; //聚焦速度等级
|
||
unsigned char focus_pwm_on;//PWM开启时间ms
|
||
unsigned char focus_pwm_off;//PWM关闭时间ms
|
||
|
||
|
||
float zoom_v;//变倍反馈电压
|
||
float zoom_v_bit;//变倍反馈电压预置位控制
|
||
unsigned char zoom_g;//变倍速度等级
|
||
unsigned char zoom_pwm_on;//PWM开启时间ms
|
||
unsigned char zoom_pwm_off;//PWM关闭时间ms
|
||
|
||
}CameraLens;
|
||
|
||
#define CAMERA_LES_FOCUS_OFF 0//聚焦关
|
||
#define CAMERA_LES_FOCUS_INC 1//聚焦加
|
||
#define CAMERA_LES_FOCUS_RED 2//聚焦减
|
||
#define CAMERA_LES_FOCUS_BIT 3//聚焦预置位控制
|
||
#define CAMERA_LES_FOCUS_STOP 4//聚焦停
|
||
|
||
#define CAMERA_LES_ZOOM_OFF 0//变倍关
|
||
#define CAMERA_LES_ZOOM_INC 1//变倍加
|
||
#define CAMERA_LES_ZOOM_RED 2//变倍减
|
||
#define CAMERA_LES_ZOOM_BIT 3//变倍预置位控制
|
||
#define CAMERA_LES_ZOOM_STOP 4//变倍停
|
||
|
||
|
||
#define CAMERA_LES_FOCUS_FV_MAX 3.3 //反馈电压最大值V
|
||
#define CAMERA_LES_FOCUS_FV_MIN 0 //反馈电压最小值V
|
||
#define CAMERA_LES_FOCUS_FV_BIT 0.06 //预置位目标电压和实际电压允许最小差值
|
||
|
||
#define CAMERA_LES_ZOOM_FV_MAX 3.3 //反馈电压最大值V
|
||
#define CAMERA_LES_ZOOM_FV_MIN 0 //反馈电压最小值V
|
||
#define CAMERA_LES_ZOOM_FV_BIT 0.06 //预置位目标电压和实际电压允许最小差值
|
||
|
||
#define CAMERA_LES_FOCUS_T 20 //PWM调速的最大周期ms
|
||
#define CAMERA_LES_ZOOM_T 20 //PWM调速的最大周期ms
|
||
|
||
#define CAMERA_LES_V_NUM 5 //反馈电压采集次数
|
||
|
||
|
||
typedef struct _PtzAs5047D_
|
||
{
|
||
///as5047d云台基准位置初始角度值
|
||
float as5047d_ptz_init_angle;
|
||
|
||
///as5047d角度相对于云台角度最大值
|
||
float as5047d_ptz_angle_max;
|
||
|
||
///磁编码器角度换算成云台角度对应的一次函数斜率K
|
||
float as5047d_ptz_angle_K;
|
||
|
||
///as5047d相对于云台的角度的滤波角度当前值
|
||
float as5047d_ptz_angle_wf_actual;
|
||
|
||
///as5047d相对于云台的角度的滤波角度上一次的值
|
||
float as5047d_ptz_angle_wf_last;
|
||
|
||
///as5047d相对于云台的角度当前实际值
|
||
float as5047d_ptz_angle_actual;
|
||
|
||
///as5047d相对于云台的角度上一次值
|
||
float as5047d_ptz_angle_last;
|
||
|
||
///云台转动范围对应的磁编码应当转动的总角度:
|
||
///as5047d_ptz_angle_max = as5047d_cycle_num * 360 + as5047d_remain_angle
|
||
///as5047d除开转动的整圈数外,多出的不满足整圈的度数
|
||
float as5047d_remain_angle;
|
||
|
||
///as5047d转动的整圈数的数值
|
||
int as5047d_cycle_num;
|
||
|
||
///as5047d转动的整圈数计数,转动一圈加减1
|
||
int as5047d_cycle_count;
|
||
int as5047d_cycle_count_last;
|
||
//int as5047d_cycle_count_last_last;
|
||
///as5047d采集到的实时角度值
|
||
float as5047d_angle_actual;
|
||
|
||
///as5047d的转向
|
||
char as5047d_dir;
|
||
|
||
///as5047d的数据读错次数
|
||
//unsigned int as5047d_read_error_count;
|
||
|
||
///as5047d采集到的上一次实时角度值
|
||
float as5047d_angle_last;
|
||
|
||
///as5047d采集到的实时角度值与上一次实时角度值的差值
|
||
float as5047d_angle_difference;
|
||
|
||
///as5047d的状态,0处于自检初始化,1 数据能够正常使用, 0xff故障
|
||
char as5047d_state;
|
||
|
||
///as5047d的数据是否全部清除,0 不需要清除, 1清除数据
|
||
char as5047d_data_reset;
|
||
|
||
|
||
///磁编码器测转速
|
||
///as5047d磁编码器转速
|
||
float as5047d_speed_actual;
|
||
///测试as5047d磁编码器转速起始角度a
|
||
float as5047d_speed_angle_a;
|
||
///测试as5047d磁编码器转速结束角度b
|
||
float as5047d_speed_angle_b;
|
||
///测试as5047d磁编码器转速起始角度a、结束角度b之间的差值
|
||
float as5047d_speed_angle_c;
|
||
///测试as5047d磁编码器转速起始角度a、结束角度b之间的上一次差值
|
||
float as5047d_speed_angle_c_last;
|
||
|
||
|
||
unsigned int time_now;
|
||
unsigned int time_end;
|
||
unsigned int time;
|
||
}PtzAs5047D;
|
||
|
||
//typedef struct _PtzJy02a_
|
||
//{
|
||
// ///jy02a电机驱动芯片返回的脉冲数,主要是计算电机转速
|
||
// unsigned int jy02a_fg_num_actual;
|
||
// unsigned int jy02a_fg_num_last;
|
||
//}PtzJy02a;
|
||
|
||
//电机驱动芯片L6235D
|
||
typedef struct _PtzL6235d_
|
||
{
|
||
char l6235d_hall_state_actual;//当前的霍尔状态,即当前收到的是哪个霍尔脉冲
|
||
char l6235d_hall_state_last;//上一次霍尔状态
|
||
|
||
unsigned int l6235d_hall_h1_count;//霍尔计数
|
||
unsigned int l6235d_hall_h2_count;
|
||
unsigned int l6235d_hall_h3_count;
|
||
unsigned int l6235d_hall_h123_count;//霍尔总数
|
||
|
||
//unsigned int l6235d_satae_save_count;//霍尔存储总数计数
|
||
//char l6235d_hall_state_save[L6235D_HALL_SAVE_NUM];//霍尔状态保存
|
||
|
||
char l6235d_motor_dir_actual;//通过霍尔判断的电机实际转向
|
||
}PtzL6235d;
|
||
|
||
///PID调速所有参数
|
||
typedef struct _PtzPidValue_
|
||
{
|
||
char mode;//调速方式选择,0默认VREF调速(pid调速);1采用向刹车输入PWM波,改变反向力矩大小调速(刹车调速)
|
||
|
||
//通过VREF调速,PID调速
|
||
float SumError;//累计误差
|
||
double KP;//比例常数
|
||
double TI;//积分常数
|
||
double TD;//微分常数
|
||
float LastError;//上一次输入偏差
|
||
float PrevError;//上上次输入偏差
|
||
float LastUT_float;//上一次PID的输出值
|
||
float T;//采样周期
|
||
double A;//三个简化参数A,B,C
|
||
double B;
|
||
double C;
|
||
float PidUT_float;//pid调速当前输出值,浮点数
|
||
unsigned int PidUT_uint;//pid调速当前输出值,整数
|
||
|
||
//通过方向输入PWM波,改变反向力矩大小调速,director调速
|
||
unsigned int director_speed_vref;//输入模拟电压等级
|
||
char director_speed_direction;//反向力矩调速的方向
|
||
unsigned short int director_speed_start_t; //刹车解除周期
|
||
unsigned short int director_speed_stop_t;//刹车周期
|
||
unsigned short int director_speed_t;//总周期
|
||
unsigned char director_speed_state;//反向力矩调速的过程
|
||
|
||
unsigned int hall_h1_count;//霍尔计数
|
||
unsigned int hall_h2_count;
|
||
unsigned int hall_h3_count;
|
||
unsigned int hall_h123_count;//霍尔总数
|
||
|
||
unsigned int hall_h1_count_last;//上次霍尔计数
|
||
unsigned int hall_h2_count_last;
|
||
unsigned int hall_h3_count_last;
|
||
unsigned int hall_h123_count_last;
|
||
|
||
unsigned int hall_h1_count_time;//霍尔计时总时间
|
||
unsigned int hall_h2_count_time;
|
||
unsigned int hall_h3_count_time;
|
||
unsigned int hall_h123_count_time;
|
||
|
||
unsigned int hall_h1_count_time_s;//霍尔计时起始时间
|
||
unsigned int hall_h2_count_time_s;
|
||
unsigned int hall_h3_count_time_s;
|
||
unsigned int hall_h123_count_time_s;
|
||
|
||
unsigned int hall_h1_count_time_e;//霍尔计时结束时间
|
||
unsigned int hall_h2_count_time_e;
|
||
unsigned int hall_h3_count_time_e;
|
||
unsigned int hall_h123_count_time_e;
|
||
|
||
|
||
char hall_h1_start_flag;//霍尔计时,起始时间标记
|
||
char hall_h2_start_flag;//0还没收到第一个霍尔脉冲,1已经收到第一个霍尔脉冲
|
||
char hall_h3_start_flag;
|
||
char hall_h123_start_flag;
|
||
|
||
|
||
float hall_h1_motor_speed;//霍尔h1传感器测出的电机转速
|
||
float hall_h2_motor_speed;//霍尔h2传感器测出的电机转速
|
||
float hall_h3_motor_speed;//霍尔h3传感器测出的电机转速
|
||
float hall_h123_motor_speed;//霍尔h3传感器测出的电机转速
|
||
|
||
char roll_start; //电机开始转动的标志,0电机还没有开始转动,1电机开始转动。
|
||
|
||
//char srm;//调速方法:0,直线调速;1,PID调速。
|
||
|
||
}PtzPidValue;
|
||
|
||
///云台故障,1故障,0无故障
|
||
typedef struct _FaultDetect_
|
||
{
|
||
char vert_sw1_fault;//垂直SW1开关故障
|
||
char vert_sw2_fault;//垂直SW2开关故障
|
||
|
||
char hori_rotate_fault;//水平转动故障
|
||
char vert_rotate_fault;//垂直转动故障
|
||
char hori_hall_fault;//水平电机霍尔故障
|
||
char vert_hall_fault;//垂直电机霍尔故障
|
||
|
||
char temperature_fault;//温度异常
|
||
char h_ntc_temp_fault;//温度异常
|
||
char v_ntc_temp_fault;//温度异常
|
||
|
||
char voltage_fault;//电压异常
|
||
char electric_current_fault;//电流异常
|
||
|
||
char Phase_curr_V;//水平电机相电流
|
||
char Phase_curr_H;//垂直电机相电流
|
||
|
||
char fault;//故障总标志,只要有故障就置为1
|
||
}FaultDetect;
|
||
|
||
///相机电源、护罩电源、辅助开关电源
|
||
typedef struct _AuxSwitchPower_
|
||
{
|
||
char aux_switch_1;
|
||
char aux_switch_2;
|
||
char aux_switch_3;
|
||
char aux_switch_4;
|
||
}AuxSwitchPower;
|
||
|
||
|
||
///云台0位偏移角度
|
||
typedef struct _PtzZeroOffsetAngle_
|
||
{
|
||
|
||
float offset_anle;//矫正偏移量
|
||
|
||
float hori_zero_offset_angle;//云台水平偏移角度
|
||
float vert_zero_offset_angle;//云台水平偏移角度
|
||
char hori_offset_switch;//水平偏移开关,1打开偏移,0关闭,2偏移数据存储正确并打开偏移开关
|
||
char vert_offset_switch;//垂直偏移开关,1打开偏移,0关闭,2偏移数据存储正确并打开偏移开关
|
||
unsigned int crc;//效验码
|
||
}PtzZeroOffsetAngle;
|
||
|
||
///云台调试端口,保存收到的UDP包的源IP地址、源MAC址,用于向保存的指定的端口和IP发送消息
|
||
typedef struct _PtzDebug_
|
||
{
|
||
char open_switch;//是否打开发送
|
||
struct sockaddr_in data_from;//IP和端口
|
||
socklen_t data_fromlen;//长度
|
||
}PtzDebug;
|
||
|
||
|
||
///上位机窗口打印
|
||
typedef struct _Ptzprintf_
|
||
{
|
||
char net_udp_printf_switch;//是否打开,1打开,0关闭
|
||
char uart_422_printf_switch;//是否打开,1打开,0关闭
|
||
char uart_485_printf_switch;//是否打开,1打开,0关闭
|
||
|
||
struct sockaddr_in printf_from;//IP和端口
|
||
socklen_t printf_fromlen;//长度
|
||
}Ptzprintf;
|
||
|
||
|
||
|
||
///云台角度定位回传
|
||
typedef struct _PtzAngleLocation_
|
||
{
|
||
char net_udp_location_switch;//是否打开,1打开,0关闭
|
||
char uart_422_location_switch;//是否打开,1打开,0关闭
|
||
char uart_485_location_switch;//是否打开,1打开,0关闭
|
||
|
||
struct sockaddr_in hori_cmd_from;//IP和端口
|
||
socklen_t hori_cmd_fromlen;//长度
|
||
char hori_cmd;//1收到水平角度控制指令,0未收到水平角度控制指令
|
||
unsigned char hori_angle[7];//存储收到的水平角度指令
|
||
|
||
struct sockaddr_in vert_cmd_from;//IP和端口
|
||
socklen_t vert_cmd_fromlen;//长度
|
||
char vert_cmd;//1收到垂直角度控制指令,0未收到垂直角度控制指令
|
||
unsigned char vert_angle[7];//存储收到的垂直角度指令
|
||
}PtzAngleLocation;
|
||
|
||
///云台区域扫描,扫描一个区域结束后回传,单步扫描到位回传
|
||
typedef struct _PtzAreaScanEnd_
|
||
{
|
||
char area_scan_end_udp_switch;//是否打开,1打开,0关闭
|
||
char area_scan_end_uart_422_switch;//是否打开,1打开,0关闭
|
||
char area_scan_end_uart_485_switch;//是否打开,1打开,0关闭
|
||
//char area_scan_cmd;//是否收到区域扫描启动指令
|
||
|
||
char area_step_scan_location_udp_switch;//单步扫描到位回传
|
||
char area_step_scan_location_uart_422_switch;//单步扫描到位回传
|
||
char area_step_scan_location_uart_485_switch;//单步扫描到位回传
|
||
|
||
struct sockaddr_in area_scan_end_from;//IP和端口
|
||
socklen_t area_scan_end_fromlen;//长度
|
||
|
||
struct sockaddr_in area_step_scan_location_from;//IP和端口
|
||
socklen_t area_step_scan_location_fromlen;//长度
|
||
}PtzAreaScanEnd;
|
||
|
||
///云台预置位到位回传
|
||
typedef struct _PtzPresetBit_
|
||
{
|
||
//预置位扫描结束
|
||
char preset_bit_scan_end_udp_switch;//是否打开,1打开,0关闭
|
||
char preset_bit_scan_end_uart_422_switch;//是否打开,1打开,0关闭
|
||
char preset_bit_scan_end_uart_485_switch;//是否打开,1打开,0关闭
|
||
//预置位扫描到达预置位
|
||
char preset_bit_scan_location_udp_switch;//是否打开,1打开,0关闭
|
||
char preset_bit_scan_location_uart_422_switch;//是否打开,1打开,0关闭
|
||
char preset_bit_scan_location_uart_485_switch;//是否打开,1打开,0关闭
|
||
//普通预置位调用
|
||
char preset_bit_location_udp_switch;//是否打开,1打开,0关闭
|
||
char preset_bit_location_uart_422_switch;//是否打开,1打开,0关闭
|
||
char preset_bit_location_uart_485_switch;//是否打开,1打开,0关闭
|
||
char preset_bit_location_num;//定位的预置位编号
|
||
char preset_bit_location_cmd;//1收到调用预置位指令,2到达预置位水平位置或垂直位置,3预置位水平位置和垂直位置都到达,0没有收到预置位指令
|
||
char preset_bit_location_cmd_source;//指令来源
|
||
|
||
struct sockaddr_in preset_bit_scan_end_from;//IP和端口
|
||
socklen_t preset_bit_scan_end_fromlen;//长度
|
||
|
||
struct sockaddr_in preset_bit_scan_location_from;//IP和端口
|
||
socklen_t preset_bit_scan_location_fromlen;//长度
|
||
|
||
struct sockaddr_in preset_bit_location_from;//IP和端口
|
||
socklen_t preset_bit_location_fromlen;//长度
|
||
}PtzPresetBit;
|
||
|
||
//保存指令来源
|
||
typedef struct _PtzCmdSave_
|
||
{
|
||
unsigned char cmd_data[7];
|
||
struct sockaddr_in cmd_from;//IP和端口
|
||
socklen_t cmd_fromlen;//长度
|
||
char cmd_data_flag; //指令保存标志,1表示接收过数据,0表示从没有接收过数据
|
||
|
||
char cmd_data_udp_flag;//UDP指令保存标志,1表示接收过UDP数据,0表示从没有接收过UDP数据
|
||
|
||
char cmd_dev;//指令来源通道号
|
||
}PtzCmdSave;
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
///用于存储云台当前的工作状态
|
||
///
|
||
///用于存储云台当前的工作状态
|
||
typedef struct _PtzState_
|
||
{
|
||
///云台地址
|
||
unsigned char address;
|
||
///云台串口波特率
|
||
int uart_422_baud;
|
||
int uart_485_baud;
|
||
/**********************电机及驱动器类型********************/
|
||
#ifdef PTZ_BLDC_MOTOR
|
||
|
||
///电机驱动芯片l6235d
|
||
PtzL6235d hori_l6235d;
|
||
PtzL6235d vert_l6235d;
|
||
#endif
|
||
|
||
#ifdef PTZ_STEP_MOTOR
|
||
|
||
#ifdef DRV8711
|
||
Drv8711Control hori_drv8711;
|
||
Drv8711Control vert_drv8711;
|
||
#endif
|
||
|
||
#ifdef TMC2160
|
||
TMC2160Control hori_tmc2160;
|
||
TMC2160Control vert_tmc2160;
|
||
#endif
|
||
|
||
|
||
char hori_dec_mode;//水平电机减速模式,0为按照设定的最大减速时间减速,1按照默认时间减速
|
||
char vert_dec_mode;//垂直电机减速模式,0为按照设定的最大减速时间减速,1按照默认时间减速
|
||
#endif
|
||
|
||
/*************************水平转动变量***********************/
|
||
///云台转动控制开关,不同的值表示不同的控制模式,为0时表示关闭
|
||
///1 向有转动 ,2 向左转动, 3角度定位(转到指定角度),4 停止转动
|
||
char hori_rotate_monitor_switch;
|
||
///云台水平角度
|
||
float hori_angle_set;
|
||
float hori_angle_actual;
|
||
float hori_angle_actual_a;//实际角度
|
||
float hori_angle_last;
|
||
float hori_angle_control;
|
||
float hori_angle_right_inc_control;//向右转动,角度增量
|
||
float hori_angle_left_inc_control;//向左转动,角度增量
|
||
///云台水平电机启停
|
||
char hori_start_stop_set;
|
||
char hori_start_stop_actual;
|
||
///云台水平转动方向
|
||
char hori_direction_set;
|
||
char hori_direction_actual;
|
||
char hori_direction_last;
|
||
char hori_direction_control;
|
||
///云台水平转速
|
||
float hori_speed_set;
|
||
float hori_speed_actual;
|
||
float hori_speed_control;
|
||
float hori_speed_as5047d_actual;//根据磁编码器算出的云台转速
|
||
float hori_speed_jy02a_actual;//根据电机驱动芯片算出的云台转速
|
||
float hori_speed_hall_actual;//根据电机霍尔传感器算出的云台转速
|
||
///云台水平电机转速
|
||
float hori_motor_speed_set;
|
||
float hori_motor_speed_actual;
|
||
float hori_motor_speed_as5047d_actual;//根据磁编码器算出的电机转速
|
||
float hori_motor_speed_jy02a_actual;//根据电机驱动芯片算出的电机转速
|
||
float hori_motor_speed_hall_actual;//根据电机霍尔传感器算出的电机转速
|
||
|
||
/*************************垂直转动变量***********************/
|
||
///云台转动控制开关
|
||
char vert_rotate_monitor_switch;
|
||
///云台垂直角度
|
||
float vert_angle_set;
|
||
float vert_angle_actual;//实际角度
|
||
float vert_angle_actual_a;//实际角度
|
||
float vert_angle_last;
|
||
float vert_angle_control;
|
||
///云台垂直电机启停
|
||
char vert_start_stop_set;
|
||
char vert_start_stop_actual;
|
||
///云台垂直转动方向
|
||
char vert_direction_set;
|
||
char vert_direction_actual;
|
||
char vert_direction_last;
|
||
char vert_direction_control;
|
||
///云台垂直转速
|
||
float vert_speed_set;
|
||
float vert_speed_actual;
|
||
float vert_speed_control;
|
||
float vert_speed_as5047d_actual;//根据磁编码器算出的云台转速
|
||
float vert_speed_jy02a_actual;//根据电机驱动芯片算出的云台转速
|
||
float vert_speed_hall_actual;//根据电机霍尔传感器算出的云台转速
|
||
///云台垂直电机转速
|
||
float vert_motor_speed_set;
|
||
float vert_motor_speed_actual;
|
||
float vert_motor_speed_as5047d_actual;//根据磁编码器算出的电机转速
|
||
float vert_motor_speed_jy02a_actual;//根据电机驱动芯片算出的电机转速
|
||
float vert_motor_speed_hall_actual;//根据电机霍尔传感器算出的电机转速
|
||
///云台PID调速参数
|
||
PtzPidValue vert_pid;
|
||
PtzPidValue hori_pid;
|
||
|
||
/**********************位置检测开关类型********************/
|
||
#ifdef PTZ_PHOTOELECTRIC_SWITCH
|
||
///水平挡片状态,遮光输出低电平,未遮光输出高电平
|
||
char hori_ps_sw3_state;
|
||
///水平挡片右转下降沿中断标志,1触发下降沿中断,0正常。
|
||
unsigned int hori_ps_sw3_right_fall;
|
||
///水平挡片右转上升沿中断标志,1触发上升沿中断,0正常。
|
||
unsigned int hori_ps_sw3_right_rise;
|
||
///水平挡片左转下降沿中断标志,1触发下降沿中断,0正常。
|
||
unsigned int hori_ps_sw3_left_fall;
|
||
///水平挡片左转上升沿中断标志,1触发上升沿中断,0正常。
|
||
unsigned int hori_ps_sw3_left_rise;
|
||
///垂直挡片状态,遮光输出低电平,未遮光输出高电平
|
||
char vert_ps_sw1_state;
|
||
char vert_ps_sw2_state;
|
||
unsigned int vert_ps_sw1_down_fall;
|
||
unsigned int vert_ps_sw1_up_rise;
|
||
unsigned int vert_ps_sw2_up_fall;
|
||
unsigned int vert_ps_sw2_down_rise;
|
||
|
||
#endif
|
||
|
||
///云台水平转动规划
|
||
PtzRotatePlan hori_rotate_plan;
|
||
///云台垂直转动规划
|
||
PtzRotatePlan vert_rotate_plan;
|
||
|
||
///云台水平自检标志,255表示自检结束
|
||
unsigned char hori_self_check;
|
||
///云台垂直自检标记,255表示自检结束
|
||
unsigned char vert_self_check;
|
||
|
||
///云台水平磁编码器
|
||
PtzAs5047D hori_as5047d;
|
||
///云台垂直磁编码器
|
||
PtzAs5047D vert_as5047d;
|
||
|
||
///云台水平角度范围参数
|
||
PtzAngleParameter hori_angleP;
|
||
///云台垂直角度范围参数
|
||
PtzAngleParameter vert_angleP;
|
||
|
||
///云台转动定位是否到达指定位置
|
||
char hori_arrive_flag;//1正在转向指定位置,0到达指定位置
|
||
///云台转动定位是否到达指定位置
|
||
char vert_arrive_flag;//1正在转向指定位置,0到达指定位置
|
||
|
||
///重复定位开关
|
||
char hori_repeat_locate_switch;//0不需要重复定位,1需要重复定位
|
||
///重复定位开关
|
||
char vert_repeat_locate_switch;//0不需要重复定位,1需要重复定位
|
||
|
||
/******************************************/
|
||
|
||
/*温度、电压、电流*/
|
||
float H_boad_temp;//水平电机侧驱动电路主板温度
|
||
float V_boad_temp;//垂直电机侧驱动电路主板温度
|
||
float temperature;
|
||
float Voltage;
|
||
float electric_current;
|
||
///故障检测
|
||
FaultDetect fault_detect;
|
||
|
||
///指令回复开关
|
||
char cmd_reply_switch;//1回复打开,0回复关闭
|
||
|
||
#ifdef PTZ_ELECTRIC_STABLE_L6235D
|
||
///电子稳定,反向力矩
|
||
ElectricStable hori_electric_stable;
|
||
ElectricStable vert_electric_stable;
|
||
#endif
|
||
///护罩电源管理
|
||
AuxSwitchPower power;
|
||
|
||
///保存当前接收到的指令
|
||
PtzCmdSave cmd_save;
|
||
|
||
///角度偏移量
|
||
PtzZeroOffsetAngle offset_angle;
|
||
|
||
///云台调试端口数据
|
||
PtzDebug debug_data;
|
||
///角度定位回传
|
||
PtzAngleLocation location_return;
|
||
///区域扫描结束回传
|
||
PtzAreaScanEnd area_scan_return;
|
||
///预置位到达回传
|
||
PtzPresetBit preset_bit_return;
|
||
|
||
//上位机窗口打印输出
|
||
Ptzprintf ptz_printf;
|
||
|
||
|
||
///云台继电器开关状态
|
||
unsigned char ptz_motor_relay_state;
|
||
|
||
///云台不自检位置数据读取状态
|
||
unsigned char no_self_check_state; //0读取云台位置参数失败,1读取位置数据成功,2读取自检数据成功后擦除位置数据
|
||
|
||
///云台不自检强制保存数据
|
||
unsigned char no_self_check_force_save; //0不强制保存,1强制保存
|
||
///强制删除位置数据
|
||
unsigned char no_self_check_force_erase; //0不强制删除,1强制删除
|
||
|
||
///预处理指令保存开关
|
||
char cmd_before_handle_swtich;//1打开预处理指令功能并保存;0关闭预处理指令功能
|
||
|
||
///长焦镜头控制
|
||
CameraLens cameralens;
|
||
|
||
|
||
// PtzWorkTime time;//云台工作时间计时
|
||
|
||
unsigned char hori_angle_state;//角度状态,0故障,1正常
|
||
unsigned char vert_angle_state;//角度状态,0故障,1正常
|
||
|
||
unsigned char hori_angle_erro_switch;//水平角度误差消除开关,初始化于角度模块中,0——关闭,1——打开
|
||
|
||
float hori_angle_error;//存储水平结构误差
|
||
|
||
/***测试用***/
|
||
//磁编码器圈数计算异常统计
|
||
unsigned int hori_jia;//++
|
||
unsigned int hori_jian;//--
|
||
unsigned int hori_cuowu;//错误
|
||
unsigned int vert_jia;//++
|
||
unsigned int vert_jian;//--
|
||
unsigned int vert_cuowu;//错误
|
||
|
||
unsigned int vert_stop_num;
|
||
}PtzState;
|
||
|
||
extern PtzState g_ptz;
|
||
|
||
typedef struct _cycle_count_
|
||
{
|
||
float intit;
|
||
float actual;
|
||
int count;
|
||
}cycle_count;
|
||
#endif |