Renamed object to mesh

This commit is contained in:
doterop 2020-10-07 04:17:25 +02:00
parent 04da915ab2
commit df6e6eef65
10 changed files with 51 additions and 51 deletions

View File

@ -166,8 +166,8 @@ namespace client {
return _episode.Lock()->GetLevelBBs(queried_tag);
}
std::vector<rpc::CarlaObject> World::GetObjects() const {
return _episode.Lock()->GetObjects();
std::vector<rpc::Mesh> World::GetMeshes() const {
return _episode.Lock()->GetMeshes();
}
} // namespace client

View File

@ -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<geom::BoundingBox> GetLevelBBs(uint8_t queried_tag) const;
std::vector<rpc::CarlaObject> GetObjects() const;
std::vector<rpc::Mesh> GetMeshes() const;
private:

View File

@ -450,9 +450,9 @@ namespace detail {
return _pimpl->CallAndWait<return_t>("get_all_level_BBs", queried_tag);
}
std::vector<rpc::CarlaObject> Client::GetObjects() const {
using return_t = std::vector<rpc::CarlaObject>;
return _pimpl->CallAndWait<return_t>("get_objects");
std::vector<rpc::Mesh> Client::GetMeshes() const {
using return_t = std::vector<rpc::Mesh>;
return _pimpl->CallAndWait<return_t>("get_meshes");
}
} // namespace detail

View File

@ -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<geom::BoundingBox> GetLevelBBs(uint8_t queried_tag) const;
std::vector<rpc::CarlaObject> GetObjects() const;
std::vector<rpc::Mesh> GetMeshes() const;
private:

View File

@ -231,8 +231,8 @@ namespace detail {
return _client.GetLevelBBs(queried_tag);
}
std::vector<rpc::CarlaObject> GetObjects() const {
return _client.GetObjects();
std::vector<rpc::Mesh> GetMeshes() const {
return _client.GetMeshes();
}
/// @}

View File

@ -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

View File

@ -8,7 +8,7 @@
#include <carla/client/Actor.h>
#include <carla/client/ActorList.h>
#include <carla/client/World.h>
#include <carla/rpc/Object.h>
#include <carla/rpc/Mesh.h>
#include <carla/rpc/ObjectLabel.h>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
@ -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_<cr::CarlaObject>("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_<cr::Mesh>("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))
;

View File

@ -12,7 +12,7 @@
#include <compiler/disable-ue4-macros.h>
#include "carla/opendrive/OpenDriveParser.h"
#include "carla/road/element/RoadInfoSignal.h"
#include <carla/rpc/Object.h>
#include <carla/rpc/Mesh.h>
#include <carla/rpc/WeatherParameters.h>
#include <compiler/enable-ue4-macros.h>
@ -155,7 +155,7 @@ void ACarlaGameModeBase::BeginPlay()
Recorder->GetReplayer()->CheckPlayAfterMapLoaded();
}
RegisterLevelObjects();
RegisterMeshes();
}
@ -350,12 +350,12 @@ TArray<FBoundingBox> ACarlaGameModeBase::GetAllBBsOfLevel(uint8 TagQueried)
return BoundingBoxes;
}
TArray<FCarlaObject> ACarlaGameModeBase::GetObjects() const
TArray<FCarlaMesh> 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);
}
}

View File

@ -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<FBoundingBox> GetAllBBsOfLevel(uint8 TagQueried = 0);
UFUNCTION(Category = "Carla Game Mode", BlueprintCallable, CallInEditor, Exec)
TArray<FCarlaObject> GetObjects() const;
TArray<FCarlaMesh> 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<FCarlaObject> LevelObjects;
TArray<FCarlaMesh> Meshes;
/// The class of Weather to spawn.
UPROPERTY(Category = "CARLA Game Mode", EditAnywhere)

View File

@ -27,7 +27,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/Response.h>
#include <carla/rpc/Server.h>
#include <carla/rpc/String.h>
@ -322,7 +322,7 @@ void FCarlaServer::FPimpl::BindActions()
return MakeVectorFromTArray<cg::BoundingBox>(Result);
};
BIND_SYNC(get_objects) << [this]() -> R<std::vector<cr::CarlaObject>>
BIND_SYNC(get_meshes) << [this]() -> R<std::vector<cr::Mesh>>
{
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<FCarlaObject> Result = GameMode->GetObjects();
return MakeVectorFromTArray<cr::CarlaObject>(Result);
TArray<FCarlaMesh> Result = GameMode->GetMeshes();
return MakeVectorFromTArray<cr::Mesh>(Result);
};
// ~~ Weather ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~