/* * @file env.h * * @brief description * @details description * * @copyright (c) 2006-2021, Huali Development Team * * (c) Copyright 2021, Shandong Huali electromechanical Co., Ltd.. * This is protected by international copyright laws. Knowledge of the * source code may not be used to write a similar product. This file may * only be used in accordance with a license and should not be redistributed * in any way. We appreciate your understanding and fairness. * * Change Logs: * @date @author @note * 2021-10-16 Simon the first version */ #ifndef ENV_H_ #define ENV_H_ #include #include #include "hardware.h" #include "board.h" #include "status.h" #define _VERSION "001" /* bool */ #define False 0 #define True 1 #define MIN_S16 -32768 typedef struct { volatile uint16_t AgvId; /* 状态信息 */ uint16_t Status; //小车状态 uint16_t BatteryVolt; /* 实时速度 */ uint16_t Speed; uint16_t TaskStatus; //任务状态 // uint16_t TaskCnt; uint32_t Station; //站点 uint32_t TgtStation; //目标站点 uint32_t Point; //地标 uint16_t CargoStatus; //货物状态 uint16_t NavStatus; //导航状态 uint16_t FR; // uint16_t CrossType; //十字架的类型 /* 目标速度 */ uint16_t TgtSpeed; uint16_t LiftStatus; uint16_t QYPreStatus; //没用 /* 实时操作 */ uint16_t PreStatus; uint16_t PrePoint; /* 目标操作 */ uint16_t TgtAction; //前后 uint16_t DRAction; // uint16_t Action; // uint16_t Direction; //方向 uint16_t Branch; //分支,没用到 uint16_t StopAtCross; // // 板载LED灯 uint16_t Light1Red; uint16_t Light1Yellow; uint16_t Light1Green; uint16_t OBSArea; /* rfid */ uint16_t RfidNeedHandle; uint16_t RfidType; uint8_t RfidData2; uint8_t RfidData1; uint8_t RfidData4; uint8_t RfidData3; uint8_t RfidData6; uint8_t RfidData5; uint8_t RfidData8; uint8_t RfidData7; uint16_t Led0Status; uint16_t Light2Red; uint16_t Light2Yellow; uint16_t Light2Green; uint16_t ObsStatus; //光电开关状态 uint16_t BlkNum; //用不到 uint16_t BlkStat; /* 获取次数 */ uint16_t BlkReqCnt; /* 速度类型 */ uint16_t IdleSecond; /* 电池信息 */ uint16_t Driver1Volt; uint16_t Driver2Volt; uint16_t BatteryStatus; //电池状态 /* 驱动信息 */ uint16_t DRStatus; //驱动器状态 uint8_t FFLmtSw; // uint8_t FRLmtSw; // uint8_t BFLmtSw; // uint8_t BRLmtSw; // int FAngle; int BAngle; int FPos; int BPos; short FWlkRpm; //行走电机的转速 short BWlkRpm; uint16_t FWlkZj; uint16_t BWlkZj; uint8_t FMgsOnline; uint8_t BMgsOnline; uint8_t LMgsOnline; uint8_t RMgsOnline; short FMgsOffset; // short BMgsOffset; short LMgsOffset; short RMgsOffset; uint16_t FWlkError; uint16_t BWlkError; uint16_t FStrError; uint16_t BStrError; uint16_t LogSwMain :1; uint16_t LogSwMsg :1; uint16_t LogSwCan :1; uint16_t LogSwDriver :1; uint16_t LogSwGuide :1; uint16_t LogSwRfid :1; uint16_t LogSwMns :1; uint16_t LogSwBtn :1; uint16_t LogSwRoad :1; char * TaskId; uint16_t TaskSrc; int LiftPosL; int LiftPosR; uint16_t DemoTaskStatus; uint16_t TimerChargeStatus; uint16_t HH; //时 uint16_t MM; //分 uint16_t SS; uint8_t DmS; short xValue; //x的实际值 short yValue; uint16_t cValue; short xOffset; //x的偏移量 short yOffset; uint16_t Angle; uint32_t TagNum; uint8_t AtStation; uint8_t DirStatus; uint8_t DirLiftStatus; uint8_t RoadNum_xxxxx; uint16_t TgtStationXvalue; uint16_t TgtStationYvalue; uint16_t TgtStationCvalue; // uint16_t DirPauseStatus; // uint16_t DecPressStatus; // uint16_t InTsjStatus; // uint16_t StartCvalue; // uint16_t TgtCvalue; uint16_t TsjStatus; uint16_t TsjId; uint16_t TsjFloorStatus; uint16_t TsjStationXvalue; uint16_t TsjStationYvalue; uint16_t near_time_out; uint8_t estop_flag; uint8_t reset_flag; uint16_t motor_err; } Status_t; extern Status_t S; #define TO_DIGIT(a) ((a) - '0') #define TO_ASCII(a) ((a) + '0') #define NEAR(c, t, d) (((c) < ((t) + (d))) && ((c) > ((t) - (d)))) #define FAngleReach NEAR(S.FAngle, Set.FAngle, Cfg.MtsAglAcy) #define BAngleReach NEAR(S.BAngle, Set.BAngle, Cfg.MtsAglAcy) /********************************************************************************************************* * GLOBAL CFG *********************************************************************************************************/ #define CFG_REMOTE_CTRL_NUM 8 #define CFG_RFID_TYPE_HS 0 #define CFG_RFID_TYPE_EMR 1 #define CFG_IS_RfidType(a) (((a) == CFG_RFID_TYPE_HS) || ((a) == CFG_RFID_TYPE_EMR)) #define CFG_BATTERY_TYPE_24V 24 #define CFG_BATTERY_TYPE_48V 48 #define CFG_IS_BtyType(a) (((a) == CFG_BATTERY_TYPE_24V) || ((a) == CFG_BATTERY_TYPE_48V)) #define CFG_CARGO_TYPE_NULL 0 #define CFG_CARGO_TYPE_LIFT 1 #define CFG_CARGO_TYPE_QIANYI 2 #define CFG_CARGO_TYPE_CHUANSONG 3 #define CFG_CARGO_TYPE_LIFT_SCREW 4 #define CFG_IS_CargoType(a) (((a) == CFG_CARGO_TYPE_CHUANSONG) || ((a) == CFG_CARGO_TYPE_LIFT) || ((a) == CFG_CARGO_TYPE_QIANYI) || ((a) == CFG_CARGO_TYPE_NULL)) #define CFG_OBS_TYPE_KL 0 #define CFG_OBS_TYPE_PX24 1 #define CFG_IS_ObsType(a) (((a) == CFG_OBS_TYPE_KL) || ((a) == CFG_OBS_TYPE_PX24)) //#define CFG_STEER_TYPE_SPEED 0 //#define CFG_STEER_TYPE_POSITION 1 //#define CFG_IS_SteerType(a) (((a) == CFG_STEER_TYPE_SPEED) || ((a) == CFG_STEER_TYPE_POSITION)) #define CFG_WlkMcType_Hs 0 #define CFG_WlkMcType_SenChuang 1 #define CFG_WlkMcType_Motec 2 #define CFG_WlkMcType_Leisai 3 #define CFG_WlkMcType_Curtis 4 //#define CFG_WlkMcType_RoboteQ 5 #define CFG_StrMcType_Hs 0 #define CFG_StrMcType_SenChuang 1 #define CFG_StrMcType_Motec 2 //#define CFG_StrMcType_Leisai 3 //#define CFG_StrMcType_Curtis 4 #define CFG_StrMcType_RoboteQ 5 typedef struct { uint16_t Saved; uint16_t AgvId; // 类型 uint16_t Type; uint16_t Version; // 最大转速 uint16_t MaxRpm; /* 速度因子, 一米转数 = 减速比/轮子直周长 */ uint16_t SpdFctr; uint16_t Speed; uint16_t SpdMxDft; uint16_t SpdHigh; uint16_t SpdMid; uint16_t SpdLow; //接近速度 uint16_t SpdNear; //手动速度 uint16_t SpdMan; //旋转速度 uint16_t SpdRota; //电池电压 uint16_t BtyType; //电池满电电压 uint16_t VoltFull; //电池高电压 uint16_t VoltHigh; //电池中电压 uint16_t VoltMid; //电池低电压 uint16_t VoltLow; //电池报警电压 uint16_t VoltWarn; //电池停止电压 uint16_t VoltStop; uint16_t RfidType; //depreciated uint16_t CargoType; //depreciated uint16_t ObsType; //depreciated uint16_t CscType; //depreciated uint16_t WlkMcType; uint16_t StrMcType; //depreciated /* 每度脉冲数 大齿轮*编码器线数*编码器倍数 /编码器齿轮数/360 */ uint16_t FStrPlsDeg; uint16_t BStrPlsDeg; uint16_t NavSP; uint16_t NavSI; uint16_t NavSD; uint16_t NavWP; uint16_t DftWP; uint16_t MtsAglAcy; // uint16_t SteerType; /* 角度为arctan(舵轮-横向中心线/舵轮-纵向中心线) */ short RoteAngle; // todo need Test to short int FZeroAng; int BZeroAng; uint16_t FWlkAcc; uint16_t FWlkDcc; uint16_t BWlkAcc; uint16_t BWlkDcc; uint16_t StartAct; uint16_t ZeroSt; uint32_t ipaddr; uint32_t netmask; uint32_t gateway; uint16_t dhcp; uint16_t stop_dist; /* 停止距离 */ uint16_t reduce_dist; /* 减速距离 */ } Cfg_t; extern Cfg_t Cfg; /** * @brief 初始化配置 * @param * @return */ void Cfg_Init(void); /* ********************************************************************************************************* * GOLBAL STATUS ********************************************************************************************************* */ /* 未设置状态 */ #define STATUS_INIT 0 /* 就绪状态 */ #define STATUS_READY 1 /* 运行状态 */ #define STATUS_RUN 2 /* 停止状态 */ //#define STATUS_STOP 3 /* 急停按钮急停状态 */ #define STATUS_ESTOP 4 /* 刹车停止 */ //#define STATUS_BREAK 5 /* 驱动器错误 */ #define STATUS_DRIVER_ERROR 6 /* 导航错误 */ #define STATUS_TARGET_ST_ERROR 7 /* 任务错误 */ #define STATUS_TASK_ERROR 8 /* 手动控制状态 */ #define STATUS_REMOTE_MANUAL 9 /* 1 开头为停止 */ /* 遇到障碍物停止 或者 冲突区域 */ #define STATUS_STOP_OBS 11 /* 防撞条紧急停止 */ #define STATUS_STOP_BUMPER 12 /* 冲突区域 */ //#define STATUS_STOP_BLOCK 13 /* 电压低 */ #define STATUS_STOP_LOW_POWER 15 /* 2开头为 警告 一般情况下只是警告,车辆正常运行 */ /* 车辆低电压运行:电压低但是还未到必须停止,亮黄灯提示充电 */ #define STATUS_RUN_LOW_POWER 21 /* 车辆遇到障碍物靠近:遇到障碍物比较远,低速运行 */ #define STATUS_RUN_OBS_LOW_SPEED 22 /* 正方向磁导航脱线 */ #define STATUS_ERROR_FMGS_OFFLINE 31 /* 反方向磁导航脱线 */ #define STATUS_ERROR_BMGS_OFFLINE 32 /* 正方向磁导航脱线 */ #define STATUS_ERROR_LMGS_OFFLINE 33 /* 反方向磁导航脱线 */ #define STATUS_ERROR_RMGS_OFFLINE 34 #define STATUS_ERROR_ROTE_OFFLINE 35 /* 取货物时举升不为空 */ #define STATUS_ERROR_CARGO_START_FULL 71//取货失败1/ #define STATUS_ERROR_CARGO_PICKUP_FAIL 72//取货失败2/ #define STATUS_ERROR_CARGO_RELEASE_FAIL 73//放货失败/ // //#define ERROR_STATUS_FORWARD_LIMIT 0x32//前驱动器限位保护 //#define ERROR_STATUS_FORWARD_CONNECT_FAILS 0x33//前驱动器上位机连接失败 //#define ERROR_STATUS_FORWARD_LOW_VOLT 0x34//前驱动器欠压 //#define ERROR_STATUS_FORWARD_OFFLINE 0x35//前磁导航脱线 // //#define ERROR_STATUS_BACK_LIMIT 0x3C//后驱动器限位保护 //#define ERROR_STATUS_BACK_CONNECT_FAILS 0x3D//后驱动器上位机连接失败 //#define ERROR_STATUS_BACK_OFFLINE 0x3E//后磁导航脱线 //#define ERROR_STATUS_BACK_LOW_VOLT 0x3F//后驱动器欠压 /* 初始化状态 */ #define NAV_STATUS_INIT 0 /* 在路上 */ #define NAV_STATUS_NAV 1 /* 已经进入站点 */ #define NAV_STATUS_STATION_IN 2 /* 在站点分支 */ #define NAV_STATUS_STATION_BRANCH 3 /* 到达站点 */ #define NAV_STATUS_STATION_ON 4 #define WARN_NULL 0 #define WARN_OBS_NEAR 100 #define WARN_OBS_STOP 50 #define WARN_LOW_POWER 200 /** * @brief 顶升状态定义 */ // 初始化状态,未检测状态时为此状态 #define LIFT_STATUS_INIT 0 #define LIFT_STATUS_TOP 1 #define LIFT_STATUS_BOTTOM 2 #define LIFT_STATUS_UP 3 #define LIFT_STATUS_DOWN 4 #define LIFT_STATUS_MANUAL_UP 5 #define LIFT_STATUS_MANUAL_DOWN 6 #define LIFT_STATUS_CENTER 7 #define LIFT_STATUS_MANUAL_STOP 8 /** * @brief 顶升货物状态 */ #define DIR_STATUS_INIT 0 #define DIR_STATUS_FB 1 #define DIR_STATUS_LR 2 #define DIR_STATUS_UP 3 #define DIR_STATUS_DOWN 4 #define DIR_STATUS_MANUAL_UP 5 #define DIR_STATUS_MANUAL_DOWN 6 #define DIR_STOP_STATUS 2 #define DIR_RUN_STATUS 1 //换向延时时间10=10*100ms=1s #define DIR_LIFT_TIMER 10 // 初始化状态 #define CARGO_STATUS_INIT 'I' // 无货物 #define CARGO_STATUS_NULL 'N' // 货物在中间 #define CARGO_STATUS_CENTER 'C' // 货物偏置 #define CARGO_STATUS_SIDE 'S' //#define TASK_STATUS_INIT 'I' //#define TASK_STATUS_NULL 'N' //#define TASK_STATUS_IDLE 'D' //#define TASK_STATUS_TO_ST 'T' //#define TASK_STATUS_ST_ACTION 'A' //#define TASK_STATUS_MANUAL 'M' #define BATTERY_STATUS_NULL 0 #define BATTERY_STATUS_STOP 00 #define BATTERY_STATUS_WARN 20 #define BATTERY_STATUS_LOW 40 #define BATTERY_STATUS_MID 60 #define BATTERY_STATUS_HIGH 80 #define BATTERY_STATUS_FULL 100 /* 灯光状态FF表示常亮,0表示不亮 其他的数值表示间隔多少个0.1秒切换一次 */ #define LIGHT_STATUS_OFF 0x0 #define LIGHT_STATUS_ON 0xFF #define LIGHT_STATUS_TOGGLE_05 05 #define LIGHT_STATUS_TOGGLE_1S 10 #define LIGHT_STATUS_TOGGLE_2S 20 #define IDLE_TIMEOUT 1800 #define ACT_NULL 0x0 #define ACT_RESET 0x7 #define ACT_BRAKE 0x6 #define ACT_STOP 0x5 #define ACT_FORWARD 0x1 #define ACT_FORWARD_LEFT 0x13 #define ACT_FORWARD_RIGHT 0x14 #define ACT_FORWARD_STOP_CROSS 0x15 #define ACT_BACKWARD 0x2 #define ACT_BACKWARD_LEFT 0x23 #define ACT_BACKWARD_RIGHT 0x24 #define ACT_BACKWARD_STOP_CROSS 0x25 #define ACT_LEFT 0x3 #define ACT_LEFT_FORWARD 0x31 #define ACT_LEFT_BACKWARD 0x32 #define ACT_LEFT_STOP_CROSS 0x35 #define ACT_RIGHT 0x4 #define ACT_RIGHT_FORWARD 0x41 #define ACT_RIGHT_BACKWARD 0x42 #define ACT_RIGHT_STOP_CROSS 0x45 #define ACT_MANUAL_FORWARD 0x91 #define ACT_MANUAL_BACKWARD 0x92 #define ACT_MANUAL_DRIFT_LEFT 0x93 #define ACT_MANUAL_DRIFT_RIGHT 0x94 #define ACT_MANUAL_STOP 0x95 #define ACT_MANUAL_ROTATE_LEFT 0x97 #define ACT_MANUAL_ROTATE_RIGHT 0x98 #define ACT_SPEED_NORMAL 0x80 #define ACT_SPEED_LOW 0x81 //#define ACT_SPEED_MID 0x82 //#define ACT_SPEED_HIGH 0x83 #define ACT_BRANCH_LEFT 0xA #define ACT_BRANCH_RIGHT 0xB #define ACT_ROTATE_LEFT 0xC #define ACT_ROTATE_RIGHT 0xD #define ACT_ROUND_LEFT 0xE #define ACT_ROUND_RIGHT 0xF #define ActIsManual(act) (((act) >> 4) == 9) #define ActIsNav(act) (((act)==ACT_FORWARD) || \ ((act)==ACT_FORWARD_LEFT) || \ ((act)==ACT_FORWARD_RIGHT) || \ ((act)==ACT_FORWARD_STOP_CROSS) || \ ((act)==ACT_BACKWARD) || \ ((act)==ACT_BACKWARD_LEFT) || \ ((act)==ACT_BACKWARD_RIGHT) || \ ((act)==ACT_BACKWARD_STOP_CROSS) || \ ((act)==ACT_LEFT) || \ ((act)==ACT_LEFT_FORWARD) || \ ((act)==ACT_LEFT_BACKWARD) || \ ((act)==ACT_LEFT_STOP_CROSS) || \ ((act)==ACT_RIGHT) || \ ((act)==ACT_RIGHT_FORWARD) || \ ((act)==ACT_RIGHT_BACKWARD) || \ ((act)==ACT_RIGHT_STOP_CROSS) || \ ((act)==ACT_STOP)) #define NULL_POINT 0xFFFF #define NULL_STATION NULL_POINT #define RFID_TYPE_POINT 0 #define RFID_TYPE_STATION 1 #define RFID_TYPE_CMD 2 #define RFID_TYPE_ACT 3 #define RFID_TYPE_BLOCK 4 #define RFID_TYPE_BLOCK_OUT 5 #define RFID_TYPE_OBS_AREA 6 #define DIRECTION_NULL 0x0 #define DIRECTION_FORWARD 0x1 #define DIRECTION_BACKWARD 0x2 #define DIRECTION_LEFT 0x3 #define DIRECTION_RIGHT 0x4 #define DIRECTION_ROTATE 0x5 #define OBS_STATUS_NULL 0 #define OBS_STATUS_FAR 1 // #define OBS_STATUS_NEAR 2 /** * @brief RDM Relative Direction Model 相对方向模式 */ #define RDM_PASS 0x0 /*直接通过*/ #define RDM_BRANCH_LEFT 0x1 #define RDM_BRANCH_RIGHT 0x2 #define RDM_DRIFT_LEFT 0x3 #define RDM_DRIFT_RIGHT 0x4 #define RDM_TRUN_LEFT 0x5 #define RDM_TRUN_RIGHT 0x6 #define RDM_STOP 0x7 #define RDM_STOP_CROSS 0x8 #define RDM_BACK 0xF #define RDM_LIFT_UP 0x11 #define RDM_LIFT_DOWN 0x12 #define FR_NULL 0 #define FR_FORWARD 1 #define FR_BACKWARD 2 #define BRANCH_CENTER 0 #define BRANCH_LEFT 1 #define BRANCH_RIGHT 2 #define CROSS_OFF 0 #define CROSS_FB 1 #define CROSS_LR 2 #define CROSS_XY 3 /* 因队列判满需要最后一个不存任务,因此任务总数为16个 */ #define MAX_TASK_Q 64 /* 接收命令的返回值 */ #define TASK_LIST 0 #define TASK_ASCCEPT 1 #define TASK_FINISH 2 #define TASK_LIST_FULL 9 #define TASK_ERROR_LEN 61 #define TASK_ERROR_SRC_NOT_NUM 62 #define TASK_ERROR_DST_NOT_NUM 63 #define TASK_ERROR_SRC_NOT_DEFINE 64 #define TASK_ERROR_DST_NOT_DEFINE 65 #define TASK_ERROR_PICKUP 73 // 取货失败 #define TASK_ERROR_RELEASE 74 // 放货失败 #define TRANS_STATUS_NULL 0 #define TRANS_STATUS_INIT 1 #define TRANS_STATUS_TO_SRC 2 #define TRANS_STATUS_PICKUP 3 #define TRANS_STATUS_TO_DST 4 #define TRANS_STATUS_RELEASE 5 #define TRANS_STATUS_ACTION 6 #define TRANS_STATUS_TO_STN 10 #define RUNTYPE_INIT 0 #define RUNTYPE_FR 1 #define RUNTYPE_STATION 2 #define RUNTYPE_TRANS 3 #define TIMER_STATUS_TO_CHARGE 1 #define TIMER_STATUS_TO_TASK 2 /* 任务从SRC站点取货到DST站点放货 */ typedef struct { char Id[65]; int Src; int Dst; int DstFloor; uint8_t Act; } TASK_Transport_t; typedef struct { uint8_t Status; TASK_Transport_t Elems[MAX_TASK_Q]; uint8_t Current; uint8_t Last; } TransportQueue_t; typedef struct { /* 按钮 */ uint8_t BtnRun :1; uint8_t BtnRev :1; uint8_t BtnEStop :1; uint8_t BtnCStop :1; uint8_t BtnLiftUp :1; uint8_t BtnLiftDown :1; uint8_t :2; // 遥控器 uint8_t RmcStart :1; uint8_t RmcStop :1; uint8_t RmcEStop :1; uint8_t RmcLiftUp :1; uint8_t RmcLiftDown :1; uint8_t :3; uint8_t RmcForward :1; uint8_t RmcBackward :1; uint8_t RmcDriftLeft :1; uint8_t RmcDriftRight :1; uint8_t RmcRoteLeft :1; uint8_t RmcRoteRight :1; uint8_t :2; // 避障 // OBS1 uint8_t OBS1In1 :1; uint8_t OBS1In2 :1; uint8_t OBS1In3 :1; uint8_t OBS1In4 :1; uint8_t :4; // OBS2 uint8_t OBS2In1 :1; uint8_t OBS2In2 :1; uint8_t OBS2In3 :1; uint8_t OBS2In4 :1; uint8_t :4; // OBS3 uint8_t OBS3In1 :1; uint8_t OBS3In2 :1; uint8_t OBS3In3 :1; uint8_t OBS3In4 :1; uint8_t :6; /* OBS4 */ uint8_t OBS4In1 :1; uint8_t OBS4In2 :1; uint8_t OBS4In3 :1; uint8_t OBS4In4 :1; uint8_t :6; /* NPN */ uint8_t Npn1 :1; uint8_t Npn2 :1; uint8_t Npn3 :1; uint8_t Npn4 :1; uint8_t Npn5 :1; uint8_t Npn6 :1; uint8_t Npn7 :1; uint8_t Npn8 :1; uint8_t Npn9 :1; uint8_t Npn10 :1; /* Lift */ uint8_t Lft1InTop :1; uint8_t Lft1InBottom :1; uint8_t :6; uint8_t Lft2InTop :1; uint8_t Lft2InBottom :1; uint8_t :6; uint8_t Motor1DET :1; uint8_t Motor2DET :1; } IN_t; extern IN_t I; typedef struct { /* 信号灯1 */ uint8_t Light1Red :1; uint8_t Light1Yellow :1; uint8_t Light1Green :1; uint8_t :5; // 信号灯2 uint8_t Light2Red :1; uint8_t Light2Yellow :1; uint8_t Light2Green :1; uint8_t :5; uint8_t OBS1Out1 :1; uint8_t OBS1Out2 :1; uint8_t OBS1Out3 :1; uint8_t OBS1Out4 :1; uint8_t :4; uint8_t OBS2Out1 :1; uint8_t OBS2Out2 :1; uint8_t OBS2Out3 :1; uint8_t OBS2Out4 :1; uint8_t :4; uint8_t OBS3Out1 :1; uint8_t OBS3Out2 :1; uint8_t :6; uint8_t OBS4Out1 :1; uint8_t OBS4Out2 :1; uint8_t :6; /* Lift */ uint8_t Lft1Up24 :1; uint8_t Lft1Down24 :1; uint8_t Lft1Out1 :1; uint8_t Lft1Out2 :1; uint8_t :4; uint8_t Lft2Up24 :1; uint8_t Lft2Down24 :1; uint8_t Lft2up1 :1; uint8_t Lft2Down2 :1; uint8_t :4; /* KDS */ uint8_t KDS1Out241 :1; uint8_t KDS1Out242 :1; uint8_t KDS1Out243 :1; uint8_t KDS1Out244 :1; uint8_t :4; uint8_t KDS2Out241 :1; uint8_t KDS2Out242 :1; uint8_t KDS2Out243 :1; uint8_t KDS2Out244 :1; uint8_t :4; /* Motor */ uint8_t Motor1FR :1; uint8_t Motor1EN :1; uint8_t Motor1BR :1; uint8_t :5; uint8_t Motor2FR :1; uint8_t Motor2EN :1; uint8_t Motor2BR :1; uint8_t :5; } OUT_t; extern OUT_t O; #ifndef MgsNA #define MgsNA MIN_S16 #endif #ifndef AngleNA #define AngleNA MIN_S16 #endif #ifndef PosNA #define PosNA MIN_S16 #endif #define DR_STATUS_INIT 0 #define DR_STATUS_RUN 1 /* 无冲突 */ #define BLOCK_NULL 0 /* 冲突获取 */ #define BLOCK_ACK 1 /* 冲突申请 */ #define BLOCK_REQ 2 /* 冲突释放 */ #define BLOCK_RLS 3 #define OBS_AREA_OFF 0 #define OBS_AREA_ON 0xFF #define DEMO_TASK_TIME 50 #define AGV_ON_FB (S.CrossType == CROSS_FB) #define AGV_ON_LR (S.CrossType == CROSS_LR) #define AGV_ON_CROSS (S.CrossType == CROSS_XY) #define AGV_OFF_LINE (S.CrossType == CROSS_OFF) #define DM_READ_CODE (S.DmS == 0) /** * @brief 初始化配置 * @param * @return */ void Stat_Init(void); typedef struct { uint16_t RpmNav; uint16_t RpmDft; uint16_t RpmNear; uint16_t RpmManual; uint16_t RpmRotate; uint16_t Branch; uint16_t SpeedAct; uint16_t Speed; uint16_t SpeedDrift; uint16_t RotateAct; uint16_t RotateCnt; uint16_t DRAction; uint16_t DRRpmNav; uint16_t DRRpmDft; short FStrRpm; short BStrRpm; short FWlkRpm; short BWlkRpm; short FAngle; short BAngle; short LiftRpmUp; short LiftRpmDown; int LiftUpPos; int LiftDownPos; int LiftPos; uint16_t FWlkAAcc; uint16_t FWlkMAcc; uint16_t FWlkADcc; uint16_t FWlkMDcc; uint32_t ChargeStation; short LiftRpm; uint16_t StationDcc; uint32_t TsjStation; //专为唐山修改,2排11列与3排11列不起作用 uint32_t TsjPoint; //地标 } Set_t; extern Set_t Set; void Set_Init(void); void SetSpeed(uint16_t speed); #define JSON_O_SetCfg "SetCfg" #define JSON_O_GetCfg "GetCfg" #define JSON_O_SaveCfg "SaveCfg" #define JSON_O_Status "Status" #define JSON_O_SetLog "SetLog" #define JSON_O_ClearTask "ClearTask" #define JSON_O_SetAct "SetAct" #define JSON_O_ToStation "ToStn" #define JSON_O_AddTask "AddTsk" #define JSON_O_BlkReq "BlkReq" #define JSON_O_BlkRls "BlkRls" #define JSON_O_Time "Time" #define OP_SET_ACTION 0x2 #define OP_SET_SPEED 0x4 #define OP_SET_STATION 0x5 #define OP_RUN 'R' #define OP_ADDTASK '1' #define OP_CLEAR_TASK '2' #define OP_STOP 'S' #define OP_TO_STATION 'T' #define OP_LOG ':' #define OP_GET_TASK 0xA4 #define OP_SET_TASK 0xA5 //#define OP_SAVE_TASK 0xA6 #define OP_GET_ROADINFO 0xB1 #define OP_SET_ROADINFO 0xB2 #define OP_SAVE_ROADINFO 0xB3 #define OPT_STOP 0x01 #define OPT_STOP_LIFT_UP 0x02 #define OPT_STOP_LIFT_DOWN 0x03 #define OPT_TURN_LEFT 0x04 #define OPT_TURN_RIGHT 0x05 #define OPT_SET_SPEED 0x06 #define OPT_SWITCH_LINE 0x07 #define OPT_SET_OBS 0x08 #define OPT_LEFT 0x09 #define OPT_RIGHT 0x0A typedef struct { uint16_t Station; uint8_t Opertaion; uint8_t param; } Trans_t; #define GD_MAX_STATION 128 #define GD_MAX_POINT 128 extern TransportQueue_t Trans; uint8_t FLASH_Write(uint32_t startAddr, const uint8_t *pBuffer, uint32_t size); uint16_t FLASH_ReadHalfWord(uint32_t addr) ; #endif /* ENV_H_ */