- Manual Control example fix for asynchronous captures.

- Server Game Controller flushes render queue before sending measurements.
This commit is contained in:
CVC\jbelon 2018-02-26 14:30:37 +01:00
parent a2a6105c0e
commit f637b0a6d1
2 changed files with 12 additions and 5 deletions

View File

@ -188,11 +188,11 @@ class CarlaGame(object):
measurements, sensor_data = self.client.read_data() measurements, sensor_data = self.client.read_data()
self._main_image = sensor_data['CameraRGB'] self._main_image = sensor_data.get('CameraRGB',None)
self._mini_view_image1 = sensor_data['CameraDepth'] self._mini_view_image1 = sensor_data.get('CameraDepth' ,None)
self._mini_view_image2 = sensor_data['CameraSemSeg'] self._mini_view_image2 = sensor_data.get('CameraSemSeg',None)
if self._enable_lidar: if self._enable_lidar:
self._lidar_measurement = sensor_data['Lidar32'] self._lidar_measurement = sensor_data.get('Lidar32',None)
# Print measurements every second. # Print measurements every second.
if self._timer.elapsed_seconds_since_lap() > 1.0: if self._timer.elapsed_seconds_since_lap() > 1.0:

View File

@ -11,6 +11,7 @@
#include "Server/CarlaServer.h" #include "Server/CarlaServer.h"
#include "Server/ServerSensorDataSink.h" #include "Server/ServerSensorDataSink.h"
#include "Settings/CarlaSettings.h" #include "Settings/CarlaSettings.h"
#include "Private/RenderTargetTemp.h"
using Errc = FCarlaServer::ErrorCode; using Errc = FCarlaServer::ErrorCode;
@ -120,10 +121,16 @@ void FServerGameController::Tick(float DeltaSeconds)
// Send measurements. // Send measurements.
{ {
if(CarlaSettings->bSynchronousMode)
{
FlushRenderingCommands();
}
if (Errc::Error == Server->SendMeasurements( if (Errc::Error == Server->SendMeasurements(
DataRouter.GetPlayerState(), DataRouter.GetPlayerState(),
DataRouter.GetAgents(), DataRouter.GetAgents(),
CarlaSettings->bSendNonPlayerAgentsInfo)) { CarlaSettings->bSendNonPlayerAgentsInfo))
{
Server = nullptr; Server = nullptr;
return; return;
} }