Skip to content

Commit db05b30

Browse files
committed
Fix Windows build and smoke tests
Update RPC lib version for windows build Ensure tick calls are ignored if sync mode is not active. And prevent client changes of fixed_delta_seconds triggering warning message.
1 parent db13aac commit db05b30

File tree

7 files changed

+41
-19
lines changed

7 files changed

+41
-19
lines changed

LibCarla/source/carla/client/World.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ namespace client {
7575
if (tics_correct >= 2)
7676
return id;
7777

78-
Tick(local_timeout);
78+
if (settings.synchronous_mode) {
79+
// tick if synchronous mode is active
80+
Tick(local_timeout);
81+
}
7982
}
8083

8184
log_warning("World::ApplySettings: After", number_of_attemps, " attemps, the settings were not correctly set. Please check that everything is consistent.");

LibCarla/source/carla/rpc/RpcServerInterface.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ class RpcServerInterface {
8787
* @{
8888
*/
8989
virtual Response<uint64_t> call_tick(
90-
synchronization_client_id_type const &client_id = ALL_CLIENTS,
91-
synchronization_participant_id_type const &participant_id = ALL_PARTICIPANTS) = 0;
90+
synchronization_client_id_type const &client_id,
91+
synchronization_participant_id_type const &participant_id,
92+
carla::rpc::SynchronizationTickMode synchronization_tick_mode) = 0;
9293
virtual Response<synchronization_participant_id_type> call_register_synchronization_participant(
9394
synchronization_client_id_type const &client_id,
9495
synchronization_participant_id_type const &participant_id_hint = ALL_PARTICIPANTS) = 0;

LibCarla/source/carla/rpc/ServerSynchronizationTypes.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ struct synchronization_window_participant_state {
2727
synchronization_target_game_time target_game_time;
2828
};
2929

30-
30+
enum class SynchronizationTickMode {
31+
FORCE_ENABLE_SYNC,
32+
TICK_ONLY_IF_SYNC_ENABLED
33+
};
3134

3235
} // namespace rpc
3336
} // namespace carla

PythonAPI/test/smoke/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def setUp(self):
4848

4949
def tearDown(self):
5050
self.world.apply_settings(self.settings)
51-
self.world.tick()
51+
if self.settings.synchronous_mode:
52+
# tick if synchronous mode is active
53+
self.world.tick()
5254
self.settings = None
5355
super(SyncSmokeTest, self).tearDown()

Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ class FCarlaServer::FPimpl: public carla::rpc::RpcServerInterface
239239
*/
240240
carla::rpc::Response<uint64_t> call_tick(
241241
carla::rpc::synchronization_client_id_type const &client_id,
242-
carla::rpc::synchronization_participant_id_type const &participant_id) override;
242+
carla::rpc::synchronization_participant_id_type const &participant_id,
243+
carla::rpc::SynchronizationTickMode synchronization_tick_mode) override;
243244
carla::rpc::Response<carla::rpc::synchronization_participant_id_type> call_register_synchronization_participant(
244245
carla::rpc::synchronization_client_id_type const &client_id,
245246
carla::rpc::synchronization_participant_id_type const &participant_id_hint = carla::rpc::ALL_PARTICIPANTS) override;
@@ -424,6 +425,7 @@ void FCarlaServer::FPimpl::BindActions()
424425

425426
BIND_SYNC(tick_cue) << [this]() -> R<uint64_t>
426427
{
428+
REQUIRE_CARLA_EPISODE();
427429
TRACE_CPUPROFILER_EVENT_SCOPE(TickCueReceived);
428430
UE_LOG(
429431
LogCarlaServer,
@@ -432,7 +434,7 @@ void FCarlaServer::FPimpl::BindActions()
432434
UTF8_TO_TCHAR(SynchronizationClientId().c_str()),
433435
TickParticipantId(),
434436
::rpc::this_session().id());
435-
return call_tick(SynchronizationClientId(), TickParticipantId());
437+
return call_tick(SynchronizationClientId(), TickParticipantId(), carla::rpc::SynchronizationTickMode::TICK_ONLY_IF_SYNC_ENABLED);
436438
};
437439

438440
// ~~ Load new episode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3667,12 +3669,20 @@ void FCarlaServer::FPimpl::NotifyEndEpisode()
36673669

36683670
carla::rpc::Response<uint64_t> FCarlaServer::FPimpl::call_tick(
36693671
carla::rpc::synchronization_client_id_type const &client_id,
3670-
carla::rpc::synchronization_participant_id_type const&participant_id)
3672+
carla::rpc::synchronization_participant_id_type const&participant_id,
3673+
carla::rpc::SynchronizationTickMode synchronization_tick_mode)
36713674
{
3672-
REQUIRE_CARLA_EPISODE();
36733675
auto Current = FCarlaEngine::GetFrameCounter();
3674-
auto const TargetGameTime = Episode->GetElapsedGameTime() + GetTickDeltaSeconds();
3675-
(void) call_update_synchronization_window(client_id, participant_id, TargetGameTime);
3676+
3677+
if ( (synchronization_tick_mode == carla::rpc::SynchronizationTickMode::FORCE_ENABLE_SYNC)
3678+
|| ServerSync.IsSynchronousModeActive() ) {
3679+
auto const TargetGameTime = Episode->GetElapsedGameTime() + GetTickDeltaSeconds();
3680+
ServerSync.UpdateSynchronizationWindow(client_id, participant_id, TargetGameTime);
3681+
}
3682+
else {
3683+
UE_LOG(LogCarla, Warning, TEXT("CarlaServer::call_tick[%s:%d] received, but synchronous mode not running. Tick is ignored."),
3684+
UTF8_TO_TCHAR(client_id.c_str()), participant_id);
3685+
}
36763686
return Current + 1;
36773687
}
36783688

@@ -3879,9 +3889,11 @@ double FCarlaServer::GetTickDeltaSeconds() {
38793889

38803890
void FCarlaServer::Tick()
38813891
{
3882-
(void)Pimpl->call_tick(Pimpl->SynchronizationClientId(), Pimpl->ServerSynchronizationParticipantId);
3892+
(void)Pimpl->call_tick(Pimpl->SynchronizationClientId(),
3893+
Pimpl->ServerSynchronizationParticipantId,
3894+
carla::rpc::SynchronizationTickMode::TICK_ONLY_IF_SYNC_ENABLED);
38833895
}
3884-
3896+
38853897
bool FCarlaServer::TickCueReceived()
38863898
{
38873899
return Pimpl->IsNextGameTickAllowed();
@@ -3987,12 +3999,12 @@ carla::rpc::Response<carla::rpc::VehicleTelemetryData> FCarlaServer::call_get_te
39873999
return Pimpl->call_get_telemetry_data(ActorId);
39884000
}
39894001

3990-
39914002
carla::rpc::Response<uint64_t> FCarlaServer::call_tick(
39924003
carla::rpc::synchronization_client_id_type const &client_id,
3993-
carla::rpc::synchronization_participant_id_type const&synchronization_participant)
4004+
carla::rpc::synchronization_participant_id_type const&synchronization_participant,
4005+
carla::rpc::SynchronizationTickMode synchronization_tick_mode)
39944006
{
3995-
return Pimpl->call_tick(client_id, synchronization_participant);
4007+
return Pimpl->call_tick(client_id, synchronization_participant, synchronization_tick_mode);
39964008
}
39974009

39984010
carla::rpc::Response<carla::rpc::synchronization_participant_id_type> FCarlaServer::call_register_synchronization_participant(

Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/CarlaServer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ class FCarlaServer: public carla::rpc::RpcServerInterface
123123
* @{
124124
*/
125125
carla::rpc::Response<uint64_t> call_tick(
126-
carla::rpc::synchronization_client_id_type const &client_id = carla::rpc::ALL_CLIENTS,
127-
carla::rpc::synchronization_participant_id_type const &participant_id = carla::rpc::ALL_PARTICIPANTS) override;
126+
carla::rpc::synchronization_client_id_type const &client_id,
127+
carla::rpc::synchronization_participant_id_type const &participant_id,
128+
carla::rpc::SynchronizationTickMode synchronization_tick_mode) override;
128129
carla::rpc::Response<carla::rpc::synchronization_participant_id_type> call_register_synchronization_participant(
129130
carla::rpc::synchronization_client_id_type const &client_id,
130131
carla::rpc::synchronization_participant_id_type const &participant_id_hint = carla::rpc::ALL_PARTICIPANTS) override;

Util/InstallersWin/install_rpclib.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ rem If not set set the build dir to the current dir
4040
if "%BUILD_DIR%" == "" set BUILD_DIR=%~dp0
4141
if not "%BUILD_DIR:~-1%"=="\" set BUILD_DIR=%BUILD_DIR%\
4242

43-
set RPC_VERSION=v2.2.1_c5
43+
set RPC_VERSION=carla-callbacks
4444
set RPC_SRC=rpclib-src
4545
set RPC_SRC_DIR=%BUILD_DIR%%RPC_SRC%\
4646
set RPC_INSTALL=rpclib-install

0 commit comments

Comments
 (0)