You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to create a custom camera sensor for carla simulator to render albedo(diffuse) of the image. So I create a Postprocess Material AlbedoEffectMaterial.uasset and place it under the folder Plugins/Content/PostProcessingMaterials as the following picture.
The postprocess material is:
To make the blueprints binary know this kind of material, I create a class of camera just like the official depth camera.
The code is as following: AlbedoCamera.cpp
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma// de Barcelona (UAB).//// This work is licensed under the terms of the MIT license.// For a copy, see <https://opensource.org/licenses/MIT>.
#include"Carla.h"
#include"Carla/Sensor/AlbedoCamera.h"
#include"Carla/Actor/ActorBlueprintFunctionLibrary.h"
#include"Carla/Sensor/PixelReader.h"
FActorDefinition AAlbedoCamera::GetSensorDefinition()
{
returnUActorBlueprintFunctionLibrary::MakeCameraDefinition(TEXT("albedo"));
}
AAlbedoCamera::AAlbedoCamera(const FObjectInitializer &ObjectInitializer)
: Super(ObjectInitializer)
{
AddPostProcessingMaterial(
TEXT("Material'/Carla/PostProcessingMaterials/PhysicLensDistortion.PhysicLensDistortion'"));
AddPostProcessingMaterial(
TEXT("Material'/Carla/PostProcessingMaterials/AlbedoEffectMaterial.AlbedoEffectMaterial'"));
}
voidAAlbedoCamera::PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds)
{
TRACE_CPUPROFILER_EVENT_SCOPE(AAlbedoCamera::PostPhysTick);
FPixelReader::SendPixelsInRenderThread(*this);
}
And AlbedoCamera.h
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma// de Barcelona (UAB).//// This work is licensed under the terms of the MIT license.// For a copy, see <https://opensource.org/licenses/MIT>.
#pragma once
#include"Carla/Sensor/ShaderBasedSensor.h"
#include"Carla/Actor/ActorDefinition.h"
#include"AlbedoCamera.generated.h"/// Sensor that produces "albedo" images.UCLASS()
class CARLA_API AAlbedoCamera : public AShaderBasedSensor
{
GENERATED_BODY()
public:static FActorDefinition GetSensorDefinition();
AAlbedoCamera(const FObjectInitializer &ObjectInitializer);
protected:voidPostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds) override;
};
And these two files are put under the same folder of other camera sensors.
To serialize the new kind of camera, I bind it with the pre-complemented s11n::ImageSerializer like following: std::pair<AAlbedoCamera *, s11n::ImageSerializer>, in the file LibCarla/source/carla/sensor/SensorRegistry.h.
And I remake the whole carla from source code, and launch the UEEditor succesfully.
But when I want to control the vehicle through pygame widget, and render the images through this sensor.camera.albedo, I got segmentation fault(core dumped).
I guess the problem may comes from the serialization part or the prostprocess material but I'm not quite sure. Can someone kindly helps me? Thanks a lot!
And I've checked the blueprints binary has keyword "sensor.camera.albedo" in it.
The text was updated successfully, but these errors were encountered:
I want to create a custom camera sensor for carla simulator to render albedo(diffuse) of the image. So I create a Postprocess Material
AlbedoEffectMaterial.uasset
and place it under the folderPlugins/Content/PostProcessingMaterials
as the following picture.The postprocess material is:
To make the
blueprints
binary know this kind of material, I create a class ofcamera
just like the officialdepth camera
.The code is as following:
AlbedoCamera.cpp
And
AlbedoCamera.h
And these two files are put under the same folder of other camera sensors.
To serialize the new kind of camera, I bind it with the pre-complemented
s11n::ImageSerializer
like following:std::pair<AAlbedoCamera *, s11n::ImageSerializer>
, in the fileLibCarla/source/carla/sensor/SensorRegistry.h
.And I remake the whole carla from source code, and launch the UEEditor succesfully.
But when I want to control the vehicle through
pygame
widget, and render the images through thissensor.camera.albedo
, I got segmentation fault(core dumped).I guess the problem may comes from the serialization part or the prostprocess material but I'm not quite sure. Can someone kindly helps me? Thanks a lot!
And I've checked the
blueprints
binary has keyword "sensor.camera.albedo" in it.The text was updated successfully, but these errors were encountered: