mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 20:13:34 +08:00
gz: increase timeout for service request (#24164)
* gz: increase timeout for service request * change error messages to warnings, specify retrying * fix typo
This commit is contained in:
@@ -141,7 +141,7 @@ int GZBridge::init()
|
|||||||
|
|
||||||
// If Gazebo has not been called, wait 2 seconds and try again.
|
// If Gazebo has not been called, wait 2 seconds and try again.
|
||||||
else {
|
else {
|
||||||
PX4_WARN("Service call timed out as Gazebo has not been detected.");
|
PX4_WARN("Service call timed out as Gazebo has not been detected. Retrying...");
|
||||||
system_usleep(2000000);
|
system_usleep(2000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ int GZBridge::init()
|
|||||||
|
|
||||||
while (scene_created == false) {
|
while (scene_created == false) {
|
||||||
if (!callSceneInfoMsgService(scene_info_service)) {
|
if (!callSceneInfoMsgService(scene_info_service)) {
|
||||||
PX4_WARN("Service call timed out as Gazebo has not been detected.");
|
PX4_WARN("Service call timed out as Gazebo has not been detected. Retrying...");
|
||||||
system_usleep(2000000);
|
system_usleep(2000000);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -919,7 +919,7 @@ bool GZBridge::callEntityFactoryService(const std::string &service, const gz::ms
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PX4_ERR("Service call timed out. Check GZ_SIM_RESOURCE_PATH is set correctly.");
|
PX4_WARN("Service call timed out. Check GZ_SIM_RESOURCE_PATH is set correctly.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,7 +932,7 @@ bool GZBridge::callSceneInfoMsgService(const std::string &service)
|
|||||||
gz::msgs::Empty req;
|
gz::msgs::Empty req;
|
||||||
gz::msgs::Scene rep;
|
gz::msgs::Scene rep;
|
||||||
|
|
||||||
if (_node.Request(service, req, 1000, rep, result)) {
|
if (_node.Request(service, req, 3000, rep, result)) {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PX4_ERR("Scene Info service call failed.");
|
PX4_ERR("Scene Info service call failed.");
|
||||||
return false;
|
return false;
|
||||||
@@ -942,7 +942,7 @@ bool GZBridge::callSceneInfoMsgService(const std::string &service)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PX4_ERR("Service call timed out. Check GZ_SIM_RESOURCE_PATH is set correctly.");
|
PX4_WARN("Service call timed out. Check GZ_SIM_RESOURCE_PATH is set correctly.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -955,7 +955,7 @@ bool GZBridge::callStringMsgService(const std::string &service, const gz::msgs::
|
|||||||
|
|
||||||
gz::msgs::Boolean rep;
|
gz::msgs::Boolean rep;
|
||||||
|
|
||||||
if (_node.Request(service, req, 1000, rep, result)) {
|
if (_node.Request(service, req, 3000, rep, result)) {
|
||||||
if (!rep.data() || !result) {
|
if (!rep.data() || !result) {
|
||||||
PX4_ERR("String service call failed");
|
PX4_ERR("String service call failed");
|
||||||
return false;
|
return false;
|
||||||
@@ -964,7 +964,7 @@ bool GZBridge::callStringMsgService(const std::string &service, const gz::msgs::
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
PX4_ERR("Service call timed out: %s", service.c_str());
|
PX4_WARN("Service call timed out: %s", service.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -977,7 +977,7 @@ bool GZBridge::callVector3dService(const std::string &service, const gz::msgs::V
|
|||||||
|
|
||||||
gz::msgs::Boolean rep;
|
gz::msgs::Boolean rep;
|
||||||
|
|
||||||
if (_node.Request(service, req, 1000, rep, result)) {
|
if (_node.Request(service, req, 3000, rep, result)) {
|
||||||
if (!rep.data() || !result) {
|
if (!rep.data() || !result) {
|
||||||
PX4_ERR("String service call failed");
|
PX4_ERR("String service call failed");
|
||||||
return false;
|
return false;
|
||||||
@@ -986,7 +986,7 @@ bool GZBridge::callVector3dService(const std::string &service, const gz::msgs::V
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
PX4_ERR("Service call timed out: %s", service.c_str());
|
PX4_WARN("Service call timed out: %s", service.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user