Skip to content

Commit 252748b

Browse files
committed
Merge remote-tracking branch 'origin/ue4-dev' into mai/ue4-extend-ros2-step1-server-changes
2 parents edd365e + cca73be commit 252748b

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

LibCarla/source/carla/ThreadPool.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <future>
1818
#include <thread>
19+
#include <chrono>
1920
#include <type_traits>
2021

2122
namespace carla {
@@ -29,6 +30,11 @@ namespace carla {
2930
/// Stops the ThreadPool and joins all its threads.
3031
~ThreadPool() {
3132
Stop();
33+
// Give some time to boost asio to properly stop.
34+
// below 20ms this might be useless if there is heavy load.
35+
// Without this, segmentation faults were observed
36+
// within the boost asio code on destruction of the io_context.
37+
std::this_thread::sleep_for(std::chrono::milliseconds(20));
3238
}
3339

3440
/// Return the underlying io_context.

PythonAPI/examples/sensor_synchronization.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@
3232
# process it as you liked and the important part is that,
3333
# at the end, it should include an element into the sensor queue.
3434
def sensor_callback(sensor_data, sensor_queue, sensor_name):
35-
# Do stuff with the sensor_data data like save it to disk
36-
# Then you just need to add to the queue
35+
# Do stuff with the sensor_data data like save it to disk,
36+
# then you add it to the queue so the main loop is aware of it.
3737
sensor_queue.put((sensor_data.frame, sensor_name))
3838

39+
# # You could also put the sensor data in the queue
40+
# # and process it in the main loop
41+
# sensor_queue.put((sensor_name, sensor_data.frame, sensor_data))
42+
3943

4044
def main():
4145
# We start creating the client
@@ -105,18 +109,17 @@ def main():
105109
w_frame = world.get_snapshot().frame
106110
print("\nWorld's frame: %d" % w_frame)
107111

108-
# Now, we wait to the sensors data to be received.
109-
# As the queue is blocking, we will wait in the queue.get() methods
110-
# until all the information is processed and we continue with the next frame.
111-
# We include a timeout of 1.0 s (in the get method) and if some information is
112-
# not received in this time we continue.
112+
# Now, we wait to the sensors data to be received. The queue.get() method retrieves
113+
# and item from the queue, blocking for up to the given 1.0s if the queue is empty,
114+
# raising an Empty error if the queue hasn't been filled in that time.
113115
try:
114116
for _ in range(len(sensor_list)):
115117
s_frame = sensor_queue.get(True, 1.0)
116118
print(" Frame: %d Sensor: %s" % (s_frame[0], s_frame[1]))
117-
118119
except Empty:
119120
print(" Some of the sensor information is missed")
121+
# # Or raise an error if it is paramount that all data is received
122+
# raise RuntimeError(" Some of the sensor information is missed")
120123

121124
finally:
122125
world.apply_settings(original_settings)

Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ void ACarlaGameModeBase::BeginPlay()
190190
LoadMapLayer(GameInstance->GetCurrentMapLayer());
191191
ReadyToRegisterObjects = true;
192192

193+
if (true) { /// @todo If semantic segmentation enabled.
194+
ATagger::TagActorsInLevel(*World, true);
195+
TaggerDelegate->SetSemanticSegmentationEnabled();
196+
}
197+
193198
// HACK: fix transparency see-through issues
194199
// The problem: transparent objects are visible through walls.
195200
// This is due to a weird interaction between the SkyAtmosphere component,

Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Util/ObjectRegister.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ void UObjectRegister::RegisterSMComponents(AActor* Actor)
300300
const bool IsActorTickEnabled = Actor->IsActorTickEnabled();
301301

302302
ATrafficSignBase* TrafficSign = Cast<ATrafficSignBase>(Actor);
303-
if (!IsValid(TrafficSign) || BBs.Num() == 0)
303+
304+
if (BBs.Num() == 0)
304305
{
305306
return;
306307
}

0 commit comments

Comments
 (0)