diff --git a/CHANGELOG.md b/CHANGELOG.md index a89679f54..c8cbe6aa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## CARLA 0.4.4 + + * Fixed regression walkers despawning when stopping after seeing a car + * Changed, collision is only registered if player moves faster than 1 km/h + * Fixed issue walkers resume movement after sensing nothing, but the car is still there sometimes + ## CARLA 0.4.3 * Fixed issue with reward, intersect other lane wasn't sent to the client diff --git a/Carla.uplugin b/Carla.uplugin index c7dfe0cd2..8525dd2a2 100644 --- a/Carla.uplugin +++ b/Carla.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, "Version": 1, - "VersionName": "0.4.3", + "VersionName": "0.4.4", "FriendlyName": "CARLA", "Description": "", "Category": "Science", diff --git a/Resources/RELEASE.README.md b/Resources/RELEASE.README.md index 1d05ced7a..2e81990ac 100644 --- a/Resources/RELEASE.README.md +++ b/Resources/RELEASE.README.md @@ -1,6 +1,10 @@ CARLA UE4 ========= +To run the game with the second city + + $ CarlaUE4.sh /Game/Maps/CARLA_ORIGIN_1 + To run the game at fixed time-step, e.g. 30 FPS $ CarlaUE4.sh -benchmark -fps=30 diff --git a/Source/Carla/AI/WalkerAIController.cpp b/Source/Carla/AI/WalkerAIController.cpp index 334058519..0db69f343 100644 --- a/Source/Carla/AI/WalkerAIController.cpp +++ b/Source/Carla/AI/WalkerAIController.cpp @@ -204,10 +204,10 @@ void AWalkerAIController::OnMoveCompleted( void AWalkerAIController::SenseActors(const TArray Actors) { const auto *aPawn = GetPawn(); - if ((aPawn != nullptr) && IntersectsWithVehicle(*aPawn, Actors)) { + if ((Status == EWalkerStatus::Moving) && + (aPawn != nullptr) && + IntersectsWithVehicle(*aPawn, Actors)) { TryPauseMovement(); - } else if (Status == EWalkerStatus::Paused) { - TryResumeMovement(); } } diff --git a/Source/Carla/AI/WalkerSpawnerBase.cpp b/Source/Carla/AI/WalkerSpawnerBase.cpp index 0cd9fa6f4..2fa72f3be 100644 --- a/Source/Carla/AI/WalkerSpawnerBase.cpp +++ b/Source/Carla/AI/WalkerSpawnerBase.cpp @@ -116,7 +116,9 @@ void AWalkerSpawnerBase::Tick(float DeltaTime) const int32 Index = (++CurrentIndexToCheck % WalkersBlackList.Num()); auto Walker = WalkersBlackList[Index]; const auto Status = GetWalkerStatus(Walker); - if (Status != EWalkerStatus::Moving) { + if ((Status == EWalkerStatus::MoveCompleted) || + (Status == EWalkerStatus::Invalid) || + (Status == EWalkerStatus::RunOver)) { WalkersBlackList.RemoveAtSwap(Index); if ((Walker != nullptr) && (Status != EWalkerStatus::RunOver)) { Walker->Destroy(); diff --git a/Source/Carla/Carla.h b/Source/Carla/Carla.h index a8697677e..dcaaa801b 100644 --- a/Source/Carla/Carla.h +++ b/Source/Carla/Carla.h @@ -6,7 +6,7 @@ #include "ModuleManager.h" -#include "NonCopyable.h" +#include "Util/NonCopyable.h" DECLARE_LOG_CATEGORY_EXTERN(LogCarla, Log, All); DECLARE_LOG_CATEGORY_EXTERN(LogCarlaServer, Log, All); diff --git a/Source/Carla/DynamicWeather.cpp b/Source/Carla/DynamicWeather.cpp index 1bbdf98cf..ab4fdea23 100644 --- a/Source/Carla/DynamicWeather.cpp +++ b/Source/Carla/DynamicWeather.cpp @@ -3,7 +3,7 @@ #include "Carla.h" #include "DynamicWeather.h" -#include "IniFile.h" +#include "Util/IniFile.h" #include "Components/ArrowComponent.h" diff --git a/Source/Carla/Game/CarlaSettings.cpp b/Source/Carla/Game/CarlaSettings.cpp index 386553ca0..93896896b 100644 --- a/Source/Carla/Game/CarlaSettings.cpp +++ b/Source/Carla/Game/CarlaSettings.cpp @@ -5,7 +5,7 @@ #include "CommandLine.h" #include "DynamicWeather.h" -#include "IniFile.h" +#include "Util/IniFile.h" // INI file sections. #define S_CARLA_SERVER TEXT("CARLA/Server") diff --git a/Source/Carla/Game/CarlaVehicleController.cpp b/Source/Carla/Game/CarlaVehicleController.cpp index 8c57ce4f3..e5886b48f 100644 --- a/Source/Carla/Game/CarlaVehicleController.cpp +++ b/Source/Carla/Game/CarlaVehicleController.cpp @@ -245,7 +245,10 @@ void ACarlaVehicleController::OnCollisionEvent( FVector NormalImpulse, const FHitResult& Hit) { - CarlaPlayerState->RegisterCollision(Actor, OtherActor, NormalImpulse, Hit); + // Register collision only if we are moving faster than 1 km/h. + if (FMath::Abs(GetVehicleForwardSpeed()) > 1.0f) { + CarlaPlayerState->RegisterCollision(Actor, OtherActor, NormalImpulse, Hit); + } } // ============================================================================= diff --git a/Source/Carla/MapGen/DoublyConnectedEdgeList.h b/Source/Carla/MapGen/DoublyConnectedEdgeList.h index f391ebd24..2902a45c8 100644 --- a/Source/Carla/MapGen/DoublyConnectedEdgeList.h +++ b/Source/Carla/MapGen/DoublyConnectedEdgeList.h @@ -3,8 +3,8 @@ #pragma once #include "GraphTypes.h" -#include "ListView.h" #include "Position.h" +#include "Util/ListView.h" #include #include diff --git a/Source/Carla/MapGen/ListView.h b/Source/Carla/MapGen/ListView.h deleted file mode 100644 index dd2957d9e..000000000 --- a/Source/Carla/MapGen/ListView.h +++ /dev/null @@ -1,43 +0,0 @@ -// CARLA, Copyright (C) 2017 Computer Vision Center (CVC) - -#pragma once - -namespace MapGen { - - template - class CARLA_API ListView - { - public: - - using iterator = IT; - - explicit ListView(iterator begin, iterator end) : Begin(begin), End(end) {} - - template - explicit ListView(STL_CONTAINER &StlContainer) : - Begin(iterator(StlContainer.begin())), - End(iterator(StlContainer.end())) {} - - ListView(const ListView &) = default; - ListView &operator=(const ListView &) = delete; - - iterator begin() const { - return Begin; - } - - iterator end() const { - return End; - } - - bool empty() const { - return Begin == End; - } - - private: - - const iterator Begin; - - const iterator End; - }; - -} // namespace MapGen diff --git a/Source/Carla/MapGen/RoadMap.cpp b/Source/Carla/MapGen/RoadMap.cpp index 957d31b04..c088f0668 100644 --- a/Source/Carla/MapGen/RoadMap.cpp +++ b/Source/Carla/MapGen/RoadMap.cpp @@ -14,9 +14,9 @@ #define LOCTEXT_NAMESPACE "CarlaRoadMap" -/// ============================================================================ -/// -- Static local methods ---------------------------------------------------- -/// ============================================================================ +// ============================================================================= +// -- Static local methods ----------------------------------------------------- +// ============================================================================= static uint32 ClampFloatToUInt(const float Value, int32 Min, int32 Max) { @@ -31,9 +31,9 @@ static float GetRotatedAzimuthAngle(const FVector &Direction) return SphericalCoords.Y + PI; } -/// ============================================================================ -/// -- FRoadMapPixelData ------------------------------------------------------- -/// ============================================================================ +// ============================================================================= +// -- FRoadMapPixelData -------------------------------------------------------- +// ============================================================================= uint16 FRoadMapPixelData::Encode(bool IsRoad, bool HasDirection, const FVector &Direction) { @@ -58,9 +58,9 @@ FColor FRoadMapPixelData::EncodeAsColor() const } } -/// ============================================================================ -/// -- URoadMap ---------------------------------------------------------------- -/// ============================================================================ +// ============================================================================= +// -- URoadMap ----------------------------------------------------------------- +// ============================================================================= URoadMap::URoadMap(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer), diff --git a/Source/Carla/MapGen/RoadSegmentDescription.h b/Source/Carla/MapGen/RoadSegmentDescription.h index 7cf8cd4a0..8d09b9b80 100644 --- a/Source/Carla/MapGen/RoadSegmentDescription.h +++ b/Source/Carla/MapGen/RoadSegmentDescription.h @@ -3,7 +3,7 @@ #pragma once #include "GraphTypes.h" -#include "NonCopyable.h" +#include "Util/NonCopyable.h" #include diff --git a/Source/Carla/IniFile.h b/Source/Carla/Util/IniFile.h similarity index 100% rename from Source/Carla/IniFile.h rename to Source/Carla/Util/IniFile.h diff --git a/Source/Carla/Util/ListView.h b/Source/Carla/Util/ListView.h new file mode 100644 index 000000000..889abe1bc --- /dev/null +++ b/Source/Carla/Util/ListView.h @@ -0,0 +1,39 @@ +// CARLA, Copyright (C) 2017 Computer Vision Center (CVC) + +#pragma once + +template +class CARLA_API ListView +{ +public: + + using iterator = IT; + + explicit ListView(iterator begin, iterator end) : Begin(begin), End(end) {} + + template + explicit ListView(STL_CONTAINER &StlContainer) : + Begin(iterator(StlContainer.begin())), + End(iterator(StlContainer.end())) {} + + ListView(const ListView &) = default; + ListView &operator=(const ListView &) = delete; + + iterator begin() const { + return Begin; + } + + iterator end() const { + return End; + } + + bool empty() const { + return Begin == End; + } + +private: + + const iterator Begin; + + const iterator End; +}; diff --git a/Source/Carla/NonCopyable.h b/Source/Carla/Util/NonCopyable.h similarity index 72% rename from Source/Carla/NonCopyable.h rename to Source/Carla/Util/NonCopyable.h index 839037aea..4641a5ef9 100644 --- a/Source/Carla/NonCopyable.h +++ b/Source/Carla/Util/NonCopyable.h @@ -7,5 +7,5 @@ public: NonCopyable(const NonCopyable &) = delete; - void operator=(const NonCopyable &x) = delete; + void operator=(const NonCopyable &) = delete; }; diff --git a/Source/Carla/WeatherDescription.cpp b/Source/Carla/WeatherDescription.cpp index 83e9dec11..b020f8917 100644 --- a/Source/Carla/WeatherDescription.cpp +++ b/Source/Carla/WeatherDescription.cpp @@ -3,7 +3,7 @@ #include "Carla.h" #include "WeatherDescription.h" -#include "IniFile.h" +#include "Util/IniFile.h" static FString PrecipitationTypeToString(EPrecipitationType PrecipitationType) {