From aae0b4bcf75c24346d795fad794d7dd372d01c07 Mon Sep 17 00:00:00 2001 From: Manuel Schweiger <58733365+mschweig@users.noreply.github.com> Date: Tue, 7 Jan 2025 22:04:09 +0100 Subject: [PATCH] Fixes TimeSync with robot (#544) Signed-off-by: Manuel Schweiger --- spot_driver/src/api/default_time_sync_api.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spot_driver/src/api/default_time_sync_api.cpp b/spot_driver/src/api/default_time_sync_api.cpp index ebfb48335..c52f35cce 100644 --- a/spot_driver/src/api/default_time_sync_api.cpp +++ b/spot_driver/src/api/default_time_sync_api.cpp @@ -1,5 +1,6 @@ // Copyright (c) 2023-2024 Boston Dynamics AI Institute LLC. All rights reserved. +#include #include #include @@ -12,6 +13,9 @@ tl::expected DefaultTimeSyncApi::getClo if (!time_sync_thread_) { return tl::make_unexpected("Time sync thread was not initialized."); } + if (!time_sync_thread_->WaitForSync(std::chrono::seconds(5))) { + return tl::make_unexpected("Failed to establish time sync before timing out."); + } if (!time_sync_thread_->HasEstablishedTimeSync()) { return tl::make_unexpected("Time sync not yet established between Spot and the local system."); }