|
@@ -45,6 +45,11 @@ std::string VehicleControlClient::vehicleControl(void)
|
|
// Context for the client. It could be used to convey extra information to
|
|
// Context for the client. It could be used to convey extra information to
|
|
// the server and/or tweak certain RPC behaviors.
|
|
// the server and/or tweak certain RPC behaviors.
|
|
ClientContext context;
|
|
ClientContext context;
|
|
|
|
+ gpr_timespec timespec;
|
|
|
|
+ timespec.tv_sec = 1;
|
|
|
|
+ timespec.tv_nsec = 0;
|
|
|
|
+ timespec.clock_type = GPR_TIMESPAN;
|
|
|
|
+ context.set_deadline(timespec);
|
|
|
|
|
|
// The actual RPC.
|
|
// The actual RPC.
|
|
Status status = stub_ -> vehicleControl(&context,request,&reply);
|
|
Status status = stub_ -> vehicleControl(&context,request,&reply);
|
|
@@ -71,6 +76,10 @@ std::string VehicleControlClient::vehicleControl(void)
|
|
} else {
|
|
} else {
|
|
std::cout << status.error_code() << ": " << status.error_message()
|
|
std::cout << status.error_code() << ": " << status.error_message()
|
|
<< std::endl;
|
|
<< std::endl;
|
|
|
|
+ if(status.error_code() == 4)
|
|
|
|
+ {
|
|
|
|
+ std::cout << "vehicleControl RPC connect timeout" << std::endl;
|
|
|
|
+ }
|
|
return "vehicleControl RPC failed";
|
|
return "vehicleControl RPC failed";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -87,6 +96,11 @@ std::string VehicleControlClient::uploadMap(void)
|
|
// Context for the client. It could be used to convey extra information to
|
|
// Context for the client. It could be used to convey extra information to
|
|
// the server and/or tweak certain RPC behaviors.
|
|
// the server and/or tweak certain RPC behaviors.
|
|
ClientContext context;
|
|
ClientContext context;
|
|
|
|
+ gpr_timespec timespec;
|
|
|
|
+ timespec.tv_sec = 2;
|
|
|
|
+ timespec.tv_nsec = 0;
|
|
|
|
+ timespec.clock_type = GPR_TIMESPAN;
|
|
|
|
+ context.set_deadline(timespec);
|
|
|
|
|
|
// The actual RPC.
|
|
// The actual RPC.
|
|
Status status = stub_ -> UploadMap(&context,request,&reply);
|
|
Status status = stub_ -> UploadMap(&context,request,&reply);
|
|
@@ -114,6 +128,10 @@ std::string VehicleControlClient::uploadMap(void)
|
|
} else {
|
|
} else {
|
|
std::cout << status.error_code() << ": " << status.error_message()
|
|
std::cout << status.error_code() << ": " << status.error_message()
|
|
<< std::endl;
|
|
<< std::endl;
|
|
|
|
+ if(status.error_code() == 4)
|
|
|
|
+ {
|
|
|
|
+ std::cout << "vehicleControl RPC connect timeout" << std::endl;
|
|
|
|
+ }
|
|
return "UploadMap RPC failed";
|
|
return "UploadMap RPC failed";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -130,6 +148,11 @@ std::string VehicleControlClient::changeCtrlMode(void)
|
|
// Context for the client. It could be used to convey extra information to
|
|
// Context for the client. It could be used to convey extra information to
|
|
// the server and/or tweastd::cout<<"shift:"<<shiftCMD<<std::endl;k certain RPC behaviors.
|
|
// the server and/or tweastd::cout<<"shift:"<<shiftCMD<<std::endl;k certain RPC behaviors.
|
|
ClientContext context;
|
|
ClientContext context;
|
|
|
|
+ gpr_timespec timespec;
|
|
|
|
+ timespec.tv_sec = 1;
|
|
|
|
+ timespec.tv_nsec = 0;
|
|
|
|
+ timespec.clock_type = GPR_TIMESPAN;
|
|
|
|
+ context.set_deadline(timespec);
|
|
|
|
|
|
// The actual RPC.
|
|
// The actual RPC.
|
|
Status status = stub_ -> changeCtrlMode(&context,request,&reply);
|
|
Status status = stub_ -> changeCtrlMode(&context,request,&reply);
|
|
@@ -144,6 +167,10 @@ std::string VehicleControlClient::changeCtrlMode(void)
|
|
} else {
|
|
} else {
|
|
std::cout << status.error_code() << ": " << status.error_message()
|
|
std::cout << status.error_code() << ": " << status.error_message()
|
|
<< std::endl;
|
|
<< std::endl;
|
|
|
|
+ if(status.error_code() == 4)
|
|
|
|
+ {
|
|
|
|
+ std::cout << "vehicleControl RPC connect timeout" << std::endl;
|
|
|
|
+ }
|
|
return "changeCtrlMode RPC failed";
|
|
return "changeCtrlMode RPC failed";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -160,6 +187,7 @@ void VehicleControlClient::updateMapPOIData(void)
|
|
{
|
|
{
|
|
std::cout<<"isNeedMap:"<<isNeedMap<<std::endl;
|
|
std::cout<<"isNeedMap:"<<isNeedMap<<std::endl;
|
|
std::cout<<"patrolPathID:"<<patrolPathID<<std::endl;
|
|
std::cout<<"patrolPathID:"<<patrolPathID<<std::endl;
|
|
|
|
+ emit patrolPOI_Recieved(patrolPathID);
|
|
}
|
|
}
|
|
|
|
|
|
void VehicleControlClient::updateCtrolMode(void)
|
|
void VehicleControlClient::updateCtrolMode(void)
|
|
@@ -208,3 +236,12 @@ void VehicleControlClient::set_isNeedMap(bool needMapStatus)
|
|
{
|
|
{
|
|
isNeedMap = needMapStatus;
|
|
isNeedMap = needMapStatus;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void VehicleControlClient::uploadPath_Finished_Slot(std::string pathID)
|
|
|
|
+{
|
|
|
|
+ std::cout<<"Path ID:"<<pathID<<" upload finished"<<std::endl;
|
|
|
|
+ if(isNeedMap == true)
|
|
|
|
+ {
|
|
|
|
+ isNeedMap = false;
|
|
|
|
+ }
|
|
|
|
+}
|