To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 4fa85553 authored by tiagos's avatar tiagos
Browse files

added a timeout to vicon if it isn't connected

parent e59fcb99
......@@ -125,18 +125,27 @@ int main(int argc, char* argv[]) {
return 1;
}
int attempts = 0;
ROS_INFO_STREAM("Connecting to " << hostName << " ...");
while (!client.IsConnected().Connected) {
while (!client.IsConnected().Connected && attempts < 10) {
bool ok = (client.Connect(hostName).Result == Result::Success);
if (!ok) {
ROS_ERROR("Error - connection failed...");
ros::Duration(1.0).sleep();
attempts++;
} else {
ROS_INFO("Connected successfully");
}
}
if(attempts == 10)
{
ROS_ERROR("[ViconDataPublisher] Failed to connect to Vicon.");
return 0;
}
//set data stream parameters
client.SetStreamMode(ViconDataStreamSDK::CPP::StreamMode::ServerPush); //maybe ServerPush instead of ClientPull for less latency
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment