diff --git a/LibCarla/source/carla/client/World.cpp b/LibCarla/source/carla/client/World.cpp index 9f1ce5afc..f52a050f0 100644 --- a/LibCarla/source/carla/client/World.cpp +++ b/LibCarla/source/carla/client/World.cpp @@ -166,8 +166,8 @@ namespace client { return _episode.Lock()->GetLevelBBs(queried_tag); } - std::vector World::GetObjects() const { - return _episode.Lock()->GetObjects(); + std::vector World::GetMeshes() const { + return _episode.Lock()->GetMeshes(); } } // namespace client diff --git a/LibCarla/source/carla/client/World.h b/LibCarla/source/carla/client/World.h index de66a2800..50c19c35a 100644 --- a/LibCarla/source/carla/client/World.h +++ b/LibCarla/source/carla/client/World.h @@ -18,7 +18,7 @@ #include "carla/rpc/Actor.h" #include "carla/rpc/AttachmentType.h" #include "carla/rpc/EpisodeSettings.h" -#include "carla/rpc/Object.h" +#include "carla/rpc/Mesh.h" #include "carla/rpc/VehiclePhysicsControl.h" #include "carla/rpc/WeatherParameters.h" #include "carla/rpc/VehicleLightStateList.h" @@ -156,7 +156,7 @@ namespace client { /// Returns all the BBs of all the elements of the level std::vector GetLevelBBs(uint8_t queried_tag) const; - std::vector GetObjects() const; + std::vector GetMeshes() const; private: diff --git a/LibCarla/source/carla/client/detail/Client.cpp b/LibCarla/source/carla/client/detail/Client.cpp index 6bac02b13..becb28031 100644 --- a/LibCarla/source/carla/client/detail/Client.cpp +++ b/LibCarla/source/carla/client/detail/Client.cpp @@ -450,9 +450,9 @@ namespace detail { return _pimpl->CallAndWait("get_all_level_BBs", queried_tag); } - std::vector Client::GetObjects() const { - using return_t = std::vector; - return _pimpl->CallAndWait("get_objects"); + std::vector Client::GetMeshes() const { + using return_t = std::vector; + return _pimpl->CallAndWait("get_meshes"); } } // namespace detail diff --git a/LibCarla/source/carla/client/detail/Client.h b/LibCarla/source/carla/client/detail/Client.h index 7b721aec9..713ca1b2c 100644 --- a/LibCarla/source/carla/client/detail/Client.h +++ b/LibCarla/source/carla/client/detail/Client.h @@ -19,7 +19,7 @@ #include "carla/rpc/EpisodeSettings.h" #include "carla/rpc/LightState.h" #include "carla/rpc/MapInfo.h" -#include "carla/rpc/Object.h" +#include "carla/rpc/Mesh.h" #include "carla/rpc/TrafficLightState.h" #include "carla/rpc/VehiclePhysicsControl.h" #include "carla/rpc/VehicleLightState.h" @@ -291,7 +291,7 @@ namespace detail { /// Returns all the BBs of all the elements of the level std::vector GetLevelBBs(uint8_t queried_tag) const; - std::vector GetObjects() const; + std::vector GetMeshes() const; private: diff --git a/LibCarla/source/carla/client/detail/Simulator.h b/LibCarla/source/carla/client/detail/Simulator.h index 3b7688083..77d4587c4 100644 --- a/LibCarla/source/carla/client/detail/Simulator.h +++ b/LibCarla/source/carla/client/detail/Simulator.h @@ -231,8 +231,8 @@ namespace detail { return _client.GetLevelBBs(queried_tag); } - std::vector GetObjects() const { - return _client.GetObjects(); + std::vector GetMeshes() const { + return _client.GetMeshes(); } /// @} diff --git a/LibCarla/source/carla/rpc/Object.h b/LibCarla/source/carla/rpc/Mesh.h similarity index 75% rename from LibCarla/source/carla/rpc/Object.h rename to LibCarla/source/carla/rpc/Mesh.h index e7a8ec231..b082ad1d2 100644 --- a/LibCarla/source/carla/rpc/Object.h +++ b/LibCarla/source/carla/rpc/Mesh.h @@ -17,7 +17,7 @@ namespace carla { namespace rpc { // Name is under discussion - struct CarlaObject { + struct Mesh { Transform transform; geom::BoundingBox bounding_box; uint64_t id = 0; @@ -26,11 +26,11 @@ namespace rpc { #ifdef LIBCARLA_INCLUDED_FROM_UE4 - CarlaObject(const FCarlaObject &CarlaObject) - : transform(CarlaObject.Transform), - bounding_box(CarlaObject.BoundingBox), - id(CarlaObject.Id), - name(TCHAR_TO_UTF8(*CarlaObject.Name)) {} + Mesh(const FCarlaMesh &CarlaMesh) + : transform(CarlaMesh.Transform), + bounding_box(CarlaMesh.BoundingBox), + id(CarlaMesh.Id), + name(TCHAR_TO_UTF8(*CarlaMesh.Name)) {} #endif // LIBCARLA_INCLUDED_FROM_UE4 diff --git a/PythonAPI/carla/source/libcarla/World.cpp b/PythonAPI/carla/source/libcarla/World.cpp index a9b7d3442..99c1b38cb 100644 --- a/PythonAPI/carla/source/libcarla/World.cpp +++ b/PythonAPI/carla/source/libcarla/World.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include @@ -38,11 +38,11 @@ namespace rpc { return out; } - std::ostream &operator<<(std::ostream &out, const CarlaObject &object) { - out << "CarlaObject(id=" << object.id << ", "; - out << "name=" << object.name << ", "; - out << "transform=" << object.transform << ", "; - out << "bounding_box=" << object.bounding_box << ")"; + std::ostream &operator<<(std::ostream &out, const Mesh &mesh) { + out << "Mesh(id=" << mesh.id << ", "; + out << "name=" << mesh.name << ", "; + out << "transform=" << mesh.transform << ", "; + out << "bounding_box=" << mesh.bounding_box << ")"; return out; } @@ -89,11 +89,11 @@ static auto GetLevelBBs(const carla::client::World &self, uint8_t queried_tag) { return result; } -static auto GetObjects(const carla::client::World &self) { +static auto GetMeshes(const carla::client::World &self) { carla::PythonUtil::ReleaseGIL unlock; boost::python::list result; - for (const auto &object : self.GetObjects()) { - result.append(object); + for (const auto &geometry : self.GetMeshes()) { + result.append(geometry); } return result; } @@ -149,11 +149,11 @@ void export_world() { .def(self_ns::str(self_ns::self)) ; - class_("CarlaObject", no_init) - .def_readwrite("transform", &cr::CarlaObject::transform) - .def_readwrite("bounding_box", &cr::CarlaObject::bounding_box) - .def_readwrite("id", &cr::CarlaObject::id) - .def_readwrite("name", &cr::CarlaObject::name) + class_("Mesh", no_init) + .def_readwrite("transform", &cr::Mesh::transform) + .def_readwrite("bounding_box", &cr::Mesh::bounding_box) + .def_readwrite("id", &cr::Mesh::id) + .def_readwrite("name", &cr::Mesh::name) .def(self_ns::str(self_ns::self)) ; @@ -232,7 +232,7 @@ void export_world() { .def("get_lightmanager", CONST_CALL_WITHOUT_GIL(cc::World, GetLightManager)) .def("freeze_all_traffic_lights", &cc::World::FreezeAllTrafficLights, (arg("frozen"))) .def("get_level_bbs", &GetLevelBBs, (arg("actor_type")=cr::CityObjectLabel::None)) - .def("get_objects", &GetObjects) + .def("get_meshes", &GetMeshes) .def(self_ns::str(self_ns::self)) ; diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.cpp index 483fcd5be..8f0114db7 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.cpp @@ -12,7 +12,7 @@ #include #include "carla/opendrive/OpenDriveParser.h" #include "carla/road/element/RoadInfoSignal.h" -#include +#include #include #include @@ -155,7 +155,7 @@ void ACarlaGameModeBase::BeginPlay() Recorder->GetReplayer()->CheckPlayAfterMapLoaded(); } - RegisterLevelObjects(); + RegisterMeshes(); } @@ -350,12 +350,12 @@ TArray ACarlaGameModeBase::GetAllBBsOfLevel(uint8 TagQueried) return BoundingBoxes; } -TArray ACarlaGameModeBase::GetObjects() const +TArray ACarlaGameModeBase::GetMeshes() const { - return LevelObjects; + return Meshes; } -void ACarlaGameModeBase::RegisterLevelObjects() +void ACarlaGameModeBase::RegisterMeshes() { UWorld* World = GetWorld(); @@ -364,18 +364,18 @@ void ACarlaGameModeBase::RegisterLevelObjects() UGameplayStatics::GetAllActorsOfClass(World, AActor::StaticClass(), FoundActors); // Empties the array but doesn't change memory allocations - LevelObjects.Reset(); + Meshes.Reset(); for(AActor* Actor : FoundActors) { FString ActorName = Actor->GetName(); const char* ActorNameChar = TCHAR_TO_ANSI(*ActorName); - FCarlaObject Object; - Object.Transform = Actor->GetActorTransform(); - Object.Id = CityHash64(ActorNameChar, ActorName.Len()); - Object.Name = ActorName; + FCarlaMesh CarlaMesh; + CarlaMesh.Transform = Actor->GetActorTransform(); + CarlaMesh.Id = CityHash64(ActorNameChar, ActorName.Len()); + CarlaMesh.Name = ActorName; - LevelObjects.Add(Object); + Meshes.Add(CarlaMesh); } } \ No newline at end of file diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.h index 1616fb2d3..9cdb453d9 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.h +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaGameModeBase.h @@ -16,7 +16,7 @@ #include "Carla/Settings/CarlaSettingsDelegate.h" #include "Carla/Weather/Weather.h" #include "Carla/Traffic/TrafficLightManager.h" -#include "Carla/Util/CarlaObject.h" +#include "Carla/Util/CarlaMesh.h" #include "CoreMinimal.h" @@ -58,7 +58,7 @@ public: TArray GetAllBBsOfLevel(uint8 TagQueried = 0); UFUNCTION(Category = "Carla Game Mode", BlueprintCallable, CallInEditor, Exec) - TArray GetObjects() const; + TArray GetMeshes() const; protected: @@ -78,7 +78,7 @@ private: void ParseOpenDrive(const FString &MapName); - void RegisterLevelObjects(); + void RegisterMeshes(); UPROPERTY() UCarlaGameInstance *GameInstance = nullptr; @@ -95,7 +95,7 @@ private: UPROPERTY() ACarlaRecorder *Recorder = nullptr; - TArray LevelObjects; + TArray Meshes; /// The class of Weather to spawn. UPROPERTY(Category = "CARLA Game Mode", EditAnywhere) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp index 6bfbd3071..d5c7d034f 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/CarlaServer.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -322,7 +322,7 @@ void FCarlaServer::FPimpl::BindActions() return MakeVectorFromTArray(Result); }; - BIND_SYNC(get_objects) << [this]() -> R> + BIND_SYNC(get_meshes) << [this]() -> R> { REQUIRE_CARLA_EPISODE(); ACarlaGameModeBase* GameMode = UCarlaStatics::GetGameMode(Episode->GetWorld()); @@ -330,8 +330,8 @@ void FCarlaServer::FPimpl::BindActions() { RESPOND_ERROR("unable to find CARLA game mode"); } - TArray Result = GameMode->GetObjects(); - return MakeVectorFromTArray(Result); + TArray Result = GameMode->GetMeshes(); + return MakeVectorFromTArray(Result); }; // ~~ Weather ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~