|
@@ -29,7 +29,14 @@ namespace iv {
|
|
namespace decition {
|
|
namespace decition {
|
|
iv::decition::BrainDecition * gbrain;
|
|
iv::decition::BrainDecition * gbrain;
|
|
|
|
|
|
|
|
+//======================================= apollo_fu 2022 ===================================
|
|
|
|
+void ListenRemoteCtrl(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
|
+{
|
|
|
|
+ gbrain->UpdateRemoteCtrl(strdata,nSize);
|
|
|
|
+ gbrain->UpdateSate();
|
|
|
|
+}
|
|
|
|
|
|
|
|
+//===========================================================================================
|
|
void ListenTraceMap(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
void ListenTraceMap(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
{
|
|
{
|
|
gbrain->UpdateMap(strdata,nSize);
|
|
gbrain->UpdateMap(strdata,nSize);
|
|
@@ -154,7 +161,7 @@ iv::decition::BrainDecition::BrainDecition()
|
|
|
|
|
|
//============================= apollo_fu 2022 ============================
|
|
//============================= apollo_fu 2022 ============================
|
|
guide_pTimer = new QTimer();
|
|
guide_pTimer = new QTimer();
|
|
- guide_pTimer->setInterval(4000);//4s
|
|
|
|
|
|
+ guide_pTimer->setInterval(4000);//4s 备用
|
|
//=========================================================================
|
|
//=========================================================================
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1002,55 +1009,60 @@ void iv::decition::BrainDecition::run() {
|
|
//==============================apollo_fu 2022=====================================
|
|
//==============================apollo_fu 2022=====================================
|
|
|
|
|
|
#if 0
|
|
#if 0
|
|
- int guide_carState = 4; // 0:待命停车 1:任务中 2:返程 3:返库 4:停工停车 5:人工接管
|
|
|
|
|
|
+ int guide_carState = 5; // 0:待命停车 1:任务中 2:返程 3:返库 4:停工停车 5:云平台人工接管
|
|
bool guide_faultstate = 1;//正常1 故障0
|
|
bool guide_faultstate = 1;//正常1 故障0
|
|
bool guide_workcommand = 0;//开工1 停工0
|
|
bool guide_workcommand = 0;//开工1 停工0
|
|
bool guide_takeovercommand = 1; //进入接管1 退出接管0
|
|
bool guide_takeovercommand = 1; //进入接管1 退出接管0
|
|
bool guide_timeout = 0; //超时1 未超时0
|
|
bool guide_timeout = 0; //超时1 未超时0
|
|
int guide_task = 0; //收到任务1 完成任务2 取消任务3
|
|
int guide_task = 0; //收到任务1 完成任务2 取消任务3
|
|
|
|
+ bool guide_nearpath = 0; //靠近路线1 远离路线0
|
|
|
|
+ bool guide_mapfinish = 0; //到达终点1 未达终点0
|
|
double guide_amilng = 0.0;
|
|
double guide_amilng = 0.0;
|
|
double guide_amilat = 0.0;
|
|
double guide_amilat = 0.0;
|
|
|
|
+ int guide_lastcarState = 5;//进入云平台人工接管前的状态 0:待命停车 1:任务中 2:返程 3:返库 4:停工停车
|
|
|
|
|
|
#endif
|
|
#endif
|
|
switch (ServiceCarStatus.guide_carState) {
|
|
switch (ServiceCarStatus.guide_carState) {
|
|
case 0:
|
|
case 0:
|
|
- if(ServiceCarStatus.guide_task == 1)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_task == 1)//收到任务(目的地)
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 1;
|
|
ServiceCarStatus.guide_carState = 1;
|
|
}
|
|
}
|
|
- if(ServiceCarStatus.guide_timeout == 1)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_timeout == 1)//待命超时
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 2;
|
|
ServiceCarStatus.guide_carState = 2;
|
|
}
|
|
}
|
|
- if(ServiceCarStatus.guide_workcommand == 0)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_workcommand == 0)//停工指令
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 3;
|
|
ServiceCarStatus.guide_carState = 3;
|
|
}
|
|
}
|
|
- if(ServiceCarStatus.guide_faultstate == 0)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_faultstate == 0)//出现故障
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 4;
|
|
ServiceCarStatus.guide_carState = 4;
|
|
}
|
|
}
|
|
- if(ServiceCarStatus.guide_takeovercommand == 0)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 1)//接管指令
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 5;
|
|
ServiceCarStatus.guide_carState = 5;
|
|
|
|
+ ServiceCarStatus.guide_lastcarState = 0;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
- if(ServiceCarStatus.guide_task == 2 || ServiceCarStatus.guide_task == 3)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_task == 2 || ServiceCarStatus.guide_task == 3) //完成/取消任务
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 0;
|
|
ServiceCarStatus.guide_carState = 0;
|
|
}
|
|
}
|
|
- if(ServiceCarStatus.guide_workcommand == 0)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_workcommand == 0)//停工指令
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 3;
|
|
ServiceCarStatus.guide_carState = 3;
|
|
}
|
|
}
|
|
- if(ServiceCarStatus.guide_faultstate == 0)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_faultstate == 0)//出现故障
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 4;
|
|
ServiceCarStatus.guide_carState = 4;
|
|
}
|
|
}
|
|
- if(ServiceCarStatus.guide_takeovercommand == 0)
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 1)//接管指令
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 5;
|
|
ServiceCarStatus.guide_carState = 5;
|
|
|
|
+ ServiceCarStatus.guide_lastcarState = 1;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
@@ -1058,15 +1070,63 @@ void iv::decition::BrainDecition::run() {
|
|
{
|
|
{
|
|
ServiceCarStatus.guide_carState = 0;
|
|
ServiceCarStatus.guide_carState = 0;
|
|
}
|
|
}
|
|
|
|
+ if(ServiceCarStatus.guide_workcommand == 0)//停工指令
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 3;
|
|
|
|
+ }
|
|
|
|
+ if(ServiceCarStatus.guide_faultstate == 0)//出现故障
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 4;
|
|
|
|
+ }
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 1)//接管指令
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 5;
|
|
|
|
+ ServiceCarStatus.guide_lastcarState = 2;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case 3:
|
|
case 3:
|
|
-
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_faultstate == 0 || 1) //出现故障 || 需要添加 到达维护位置
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 4;
|
|
|
|
+ }
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 1) //接管指令
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 5;
|
|
|
|
+ ServiceCarStatus.guide_lastcarState = 3;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case 4:
|
|
case 4:
|
|
-
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_workcommand == 1)//开工指令
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 0;
|
|
|
|
+ }
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 1)//接管指令
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 5;
|
|
|
|
+ ServiceCarStatus.guide_lastcarState = 4;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case 5:
|
|
case 5:
|
|
-
|
|
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 0 && ServiceCarStatus.guide_nearpath == 0)//退出接管 && 远离路线
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 0;
|
|
|
|
+ }
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 0 && ServiceCarStatus.guide_lastcarState == 1 && ServiceCarStatus.guide_nearpath == 1)//退出接管 && 曾在任务状态 && 靠近路线
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 1;
|
|
|
|
+ }
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 0 && ServiceCarStatus.guide_lastcarState == 2 && ServiceCarStatus.guide_nearpath == 1)//退出接管 && 曾在返程状态 && 靠近路线
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 2;
|
|
|
|
+ }
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 0 && ServiceCarStatus.guide_lastcarState == 3 && ServiceCarStatus.guide_nearpath == 1)//退出接管 && 曾在返库状态 && 靠近路线
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 3;
|
|
|
|
+ }
|
|
|
|
+ if(ServiceCarStatus.guide_takeovercommand == 0 && ServiceCarStatus.guide_lastcarState == 4)//退出接管 && 曾在停工状态
|
|
|
|
+ {
|
|
|
|
+ ServiceCarStatus.guide_carState = 4;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
@@ -1702,3 +1762,10 @@ void iv::decition::BrainDecition::adjuseGpsLidarPosition(){
|
|
ServiceCarStatus.msysparam.frontGpsXiuzheng -= ServiceCarStatus.msysparam.gpsOffset_y;
|
|
ServiceCarStatus.msysparam.frontGpsXiuzheng -= ServiceCarStatus.msysparam.gpsOffset_y;
|
|
ServiceCarStatus.msysparam.rearGpsXiuzheng += ServiceCarStatus.msysparam.gpsOffset_y;
|
|
ServiceCarStatus.msysparam.rearGpsXiuzheng += ServiceCarStatus.msysparam.gpsOffset_y;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//======================================= apollo_fu 2022 ===================================
|
|
|
|
+void iv::decition::BrainDecition::UpdateRemoteCtrl(const char *pdata, const int ndatasize)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+//===========================================================================================
|