Added new sensor with camera normals

This commit is contained in:
Marcel Pi 2022-01-26 11:51:35 +01:00
parent 1b80afa276
commit 3b45bfd165
7 changed files with 68 additions and 0 deletions

View File

@ -5,6 +5,7 @@
- `get_ackermann_controller_settings`: to get the last ackermann controller settings applied
- `apply_ackermann_controller_settings`: to apply new ackermann controller settings
* Fixed bug causing the Traffic Manager to not be deterministic when using hybrid mode
* Added `NormalsSensor`, a new sensor with normals information
* Added support for N wheeled vehicles
## CARLA 0.9.13

View File

@ -30,6 +30,7 @@
// 2. Add a forward-declaration of the sensor here.
class ACollisionSensor;
class ADepthCamera;
class ANormalsCamera;
class ADVSCamera;
class AGnssSensor;
class AInertialMeasurementUnit;
@ -58,6 +59,7 @@ namespace sensor {
using SensorRegistry = CompositeSerializer<
std::pair<ACollisionSensor *, s11n::CollisionEventSerializer>,
std::pair<ADepthCamera *, s11n::ImageSerializer>,
std::pair<ANormalsCamera *, s11n::ImageSerializer>,
std::pair<ADVSCamera *, s11n::DVSEventArraySerializer>,
std::pair<AGnssSensor *, s11n::GnssSerializer>,
std::pair<AInertialMeasurementUnit *, s11n::IMUSerializer>,
@ -84,6 +86,7 @@ namespace sensor {
// 4. Include the sensor here.
#include "Carla/Sensor/CollisionSensor.h"
#include "Carla/Sensor/DepthCamera.h"
#include "Carla/Sensor/NormalsCamera.h"
#include "Carla/Sensor/DVSCamera.h"
#include "Carla/Sensor/GnssSensor.h"
#include "Carla/Sensor/InertialMeasurementUnit.h"

View File

@ -14,6 +14,7 @@
#include <carla/sensor/data/IMUMeasurement.h>
#include <carla/sensor/data/ObstacleDetectionEvent.h>
#include <carla/sensor/data/Image.h>
#include <carla/sensor/data/Normals.h>
#include <carla/sensor/data/LaneInvasionEvent.h>
#include <carla/sensor/data/LidarMeasurement.h>
#include <carla/sensor/data/SemanticLidarMeasurement.h>

View File

@ -1121,6 +1121,7 @@ class CameraManager(object):
'chromatic_aberration_intensity': '0.5',
'chromatic_aberration_offset': '0'}],
['sensor.camera.optical_flow', cc.Raw, 'Optical Flow', {}],
['sensor.camera.normals', cc.Raw, 'Camera Normals', {}],
]
world = self._parent.get_world()
bp_library = world.get_blueprint_library()

View File

@ -0,0 +1,32 @@
// 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/NormalsCamera.h"
#include "Carla/Sensor/PixelReader.h"
FActorDefinition ANormalsCamera::GetSensorDefinition()
{
return UActorBlueprintFunctionLibrary::MakeCameraDefinition(TEXT("normals"));
}
ANormalsCamera::ANormalsCamera(const FObjectInitializer &ObjectInitializer)
: Super(ObjectInitializer)
{
Enable16BitFormat(true);
AddPostProcessingMaterial(
TEXT("Material'/Carla/PostProcessingMaterials/PhysicLensDistortion.PhysicLensDistortion'"));
AddPostProcessingMaterial(
TEXT("Material'/Carla/PostProcessingMaterials/NormalsEffectMaterial.NormalsEffectMaterial'"));
}
void ANormalsCamera::PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds)
{
TRACE_CPUPROFILER_EVENT_SCOPE(ANormalsCamera::PostPhysTick);
FPixelReader::SendPixelsInRenderThread(*this);
}

View File

@ -0,0 +1,30 @@
// 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 "NormalsCamera.generated.h"
/// Sensor that produces "normals" images.
UCLASS()
class CARLA_API ANormalsCamera : public AShaderBasedSensor
{
GENERATED_BODY()
public:
static FActorDefinition GetSensorDefinition();
ANormalsCamera(const FObjectInitializer &ObjectInitializer);
protected:
void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds) override;
};