|
@@ -510,6 +510,7 @@ void iv::decition::BrainDecition::run() {
|
|
//有限状态机逻辑,begin
|
|
//有限状态机逻辑,begin
|
|
if(ServiceCarStatus.mbFSM_State==0)//待命
|
|
if(ServiceCarStatus.mbFSM_State==0)//待命
|
|
{
|
|
{
|
|
|
|
+ ServiceCarStatus.mbRunPause=true;
|
|
//待命停车
|
|
//待命停车
|
|
if(ServiceCarStatus.mbOvertimeCnt<=100)//待命计时
|
|
if(ServiceCarStatus.mbOvertimeCnt<=100)//待命计时
|
|
{
|
|
{
|
|
@@ -520,7 +521,7 @@ void iv::decition::BrainDecition::run() {
|
|
ServiceCarStatus.mbOvertimeEn=1;
|
|
ServiceCarStatus.mbOvertimeEn=1;
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbErrState == 1)//出现故障
|
|
|
|
|
|
+ if(ServiceCarStatus.mbErrState == 1&&ServiceCarStatus.speed==0.0)//出现故障
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbFSM_State = 3;
|
|
ServiceCarStatus.mbFSM_State = 3;
|
|
@@ -541,7 +542,7 @@ void iv::decition::BrainDecition::run() {
|
|
ServiceCarStatus.mbLastFSM_State=0;
|
|
ServiceCarStatus.mbLastFSM_State=0;
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbTakeOverEn == 1)//接管指令
|
|
|
|
|
|
+ if(ServiceCarStatus.mbTakeOverEn == 1&&ServiceCarStatus.speed==0.0)//接管指令
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
@@ -558,7 +559,7 @@ void iv::decition::BrainDecition::run() {
|
|
else if(ServiceCarStatus.mbFSM_State==1)
|
|
else if(ServiceCarStatus.mbFSM_State==1)
|
|
{
|
|
{
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbTaskCmdType == 2 || ServiceCarStatus.mbTaskCmdType == 3) //完成/取消任务
|
|
|
|
|
|
+ if((ServiceCarStatus.mbTaskCmdType == 2 || ServiceCarStatus.mbTaskCmdType == 3)&&ServiceCarStatus.speed==0.0) //完成/取消任务
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=true;
|
|
ServiceCarStatus.mbRunPause=true;
|
|
ServiceCarStatus.mbOvertimeEn=0;
|
|
ServiceCarStatus.mbOvertimeEn=0;
|
|
@@ -574,14 +575,14 @@ void iv::decition::BrainDecition::run() {
|
|
ServiceCarStatus.mbLastFSM_State=1;
|
|
ServiceCarStatus.mbLastFSM_State=1;
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbTakeOverEn == 1)//接管指令
|
|
|
|
|
|
+ if(ServiceCarStatus.mbTakeOverEn == 1&&ServiceCarStatus.speed==0.0)//接管指令
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
ServiceCarStatus.mbLastFSM_State=1;
|
|
ServiceCarStatus.mbLastFSM_State=1;
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbErrState ==1)//出现故障
|
|
|
|
|
|
+ if(ServiceCarStatus.mbErrState ==1&&ServiceCarStatus.speed==0.0)//出现故障
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbFSM_State = 3;
|
|
ServiceCarStatus.mbFSM_State = 3;
|
|
@@ -641,7 +642,7 @@ void iv::decition::BrainDecition::run() {
|
|
ServiceCarStatus.mbFSM_State = 0;
|
|
ServiceCarStatus.mbFSM_State = 0;
|
|
ServiceCarStatus.mbLastFSM_State=3;
|
|
ServiceCarStatus.mbLastFSM_State=3;
|
|
}
|
|
}
|
|
- if(ServiceCarStatus.mbTakeOverEn == 1)//接管指令
|
|
|
|
|
|
+ if(ServiceCarStatus.mbTakeOverEn == 1&&ServiceCarStatus.speed==0.0)//接管指令
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
@@ -657,14 +658,14 @@ void iv::decition::BrainDecition::run() {
|
|
ServiceCarStatus.mbOvertimeCnt=0;
|
|
ServiceCarStatus.mbOvertimeCnt=0;
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbErrState ==1)//出现故障
|
|
|
|
|
|
+ if(ServiceCarStatus.mbErrState ==1&&ServiceCarStatus.speed==0.0)//出现故障
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbFSM_State = 3;
|
|
ServiceCarStatus.mbFSM_State = 3;
|
|
ServiceCarStatus.mbLastFSM_State=4;
|
|
ServiceCarStatus.mbLastFSM_State=4;
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbArriveInitPos == 1)
|
|
|
|
|
|
+ if(ServiceCarStatus.mbArriveInitPos == 1&&ServiceCarStatus.speed==0.0)
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=true;
|
|
ServiceCarStatus.mbRunPause=true;
|
|
ServiceCarStatus.mbFSM_State = 0;
|
|
ServiceCarStatus.mbFSM_State = 0;
|
|
@@ -673,7 +674,7 @@ void iv::decition::BrainDecition::run() {
|
|
ServiceCarStatus.mbLastFSM_State=4;
|
|
ServiceCarStatus.mbLastFSM_State=4;
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbTakeOverEn == 1)//接管指令
|
|
|
|
|
|
+ if(ServiceCarStatus.mbTakeOverEn == 1&&ServiceCarStatus.speed==0.0)//接管指令
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
@@ -697,7 +698,7 @@ void iv::decition::BrainDecition::run() {
|
|
ServiceCarStatus.mbLastFSM_State=5;
|
|
ServiceCarStatus.mbLastFSM_State=5;
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- if(ServiceCarStatus.mbTakeOverEn == 1)//接管指令
|
|
|
|
|
|
+ if(ServiceCarStatus.mbTakeOverEn == 1&&ServiceCarStatus.speed==0.0)//接管指令
|
|
{
|
|
{
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbRunPause=false;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
ServiceCarStatus.mbFSM_State = 2;
|
|
@@ -1904,7 +1905,18 @@ void iv::decition::BrainDecition::UpdateUltra(const char *pdata, const int ndata
|
|
|
|
|
|
void iv::decition::BrainDecition::UpdateFSMSkipCmd(const char *pdata, const int ndatasize)
|
|
void iv::decition::BrainDecition::UpdateFSMSkipCmd(const char *pdata, const int ndatasize)
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ if(ndatasize<1)return;
|
|
|
|
+ iv::brain::fsm_skip_cmd fsm_cmd;
|
|
|
|
+ if(false == fsm_cmd.ParseFromArray(pdata,ndatasize))
|
|
|
|
+ {
|
|
|
|
+ std::cout<<"Update FSM Skip CMD Parse fail."<<std::endl;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ ServiceCarStatus.mbTaskCmdType = fsm_cmd.missioncmd();
|
|
|
|
+ ServiceCarStatus.mbStartStopWork=fsm_cmd.workcmd();
|
|
|
|
+ ServiceCarStatus.mbTakeOverEn = fsm_cmd.remotectrlcmd();
|
|
|
|
+ ServiceCarStatus.mbArriveInitPos=fsm_cmd.waitingstationarrived();
|
|
|
|
+ ServiceCarStatus.mbArriveServicePos=fsm_cmd.maintainstationarrived();
|
|
}
|
|
}
|
|
void iv::decition::BrainDecition::adjuseGpsLidarPosition(){
|
|
void iv::decition::BrainDecition::adjuseGpsLidarPosition(){
|
|
|
|
|