Skip to content

Commit 206f2e3

Browse files
committed
RTDEClient sendStart handle missed confirmation
In some circumstances it can happen that we read the first data package instead of the start confirmation, especially on non-RT systems. In this case, we can still assume sending start was successful.
1 parent 8459c3c commit 206f2e3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/rtde/rtde_client.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,12 +610,20 @@ bool RTDEClient::sendStart()
610610
{
611611
return tmp->accepted_;
612612
}
613+
else if (rtde_interface::DataPackage* tmp = dynamic_cast<rtde_interface::DataPackage*>(package.get()))
614+
{
615+
// There is a race condition whether the last received packet was the start confirmation or
616+
// is already a data package. In that case consider the start as successful.
617+
double timestamp;
618+
return tmp->getData("timestamp", timestamp);
619+
}
613620
else
614621
{
615622
std::stringstream ss;
616623
ss << "Did not receive answer to RTDE start request. Message received instead: " << std::endl
617624
<< package->toString();
618625
URCL_LOG_WARN("%s", ss.str().c_str());
626+
num_retries++;
619627
}
620628
}
621629
std::stringstream ss;

0 commit comments

Comments
 (0)