Skip to content

Commit

Permalink
Apply postprocesssetting to caputrecomp (#231) (#233)
Browse files Browse the repository at this point in the history
* add ROS2CameraType and support Depth type

Co-authored-by: yuokamoto <[email protected]>
  • Loading branch information
github-actions[bot] and yuokamoto authored Nov 17, 2023
1 parent b00c293 commit a67c5cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "Sensors/RRROS2CameraComponent.h"

#include "BufferVisualizationData.h"

URRROS2CameraComponent::URRROS2CameraComponent()
{
// component initialization
Expand All @@ -20,6 +22,14 @@ void URRROS2CameraComponent::PreInitializePublisher(UROS2NodeComponent* InROS2No
SceneCaptureComponent->FOVAngle = CameraComponent->FieldOfView;
SceneCaptureComponent->OrthoWidth = CameraComponent->OrthoWidth;

if (CameraType == EROS2CameraType::DEPTH)
{
FWeightedBlendable blendable(1.0f, GetBufferVisualizationData().GetMaterial(TEXT("SceneDepth")));
CameraComponent->PostProcessSettings.WeightedBlendables.Array.Add(blendable);
SceneCaptureComponent->PostProcessSettings = CameraComponent->PostProcessSettings;
SceneCaptureComponent->CaptureSource = ESceneCaptureSource::SCS_FinalColorHDR;
}

RenderTarget = NewObject<UTextureRenderTarget2D>(this, UTextureRenderTarget2D::StaticClass());
RenderTarget->InitCustomFormat(Width, Height, EPixelFormat::PF_B8G8R8A8, true);
SceneCaptureComponent->TextureTarget = RenderTarget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ struct FRenderRequest
FRenderCommandFence RenderFence;
};

UENUM(BlueprintType)
enum class EROS2CameraType : uint8
{
RGB UMETA(DisplayName = "RGB"),
DEPTH UMETA(DisplayName = "Depth")
};

/**
* @brief ROS 2 Camera component. Uses USceneCaptureComponent2D.
*
Expand Down Expand Up @@ -103,6 +110,9 @@ class RAPYUTASIMULATIONPLUGINS_API URRROS2CameraComponent : public URRROS2BaseSe
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 QueueSize = 2;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
EROS2CameraType CameraType = EROS2CameraType::RGB;

// ROS
/**
* @brief Update ROS 2 Msg structure from #RenderRequestQueue
Expand Down

0 comments on commit a67c5cf

Please sign in to comment.