Adding 'tick_interval' property for sensors
This commit is contained in:
parent
a2974d3ca1
commit
8a8db23f86
|
@ -218,6 +218,19 @@ static void AddRecommendedValuesForSensorRoleNames(FActorDefinition &Definition)
|
||||||
AddRecommendedValuesForActorRoleName(Definition, {TEXT("front"), TEXT("back"), TEXT("left"), TEXT("right"), TEXT("front_left"), TEXT("front_right"), TEXT("back_left"), TEXT("back_right")});
|
AddRecommendedValuesForActorRoleName(Definition, {TEXT("front"), TEXT("back"), TEXT("left"), TEXT("right"), TEXT("front_left"), TEXT("front_right"), TEXT("back_left"), TEXT("back_right")});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void AddVariationsForSensor(FActorDefinition &Def)
|
||||||
|
{
|
||||||
|
FActorVariation Tick;
|
||||||
|
|
||||||
|
Tick.Id = TEXT("tick_interval");
|
||||||
|
Tick.Type = EActorAttributeType::Float;
|
||||||
|
Tick.RecommendedValues = { TEXT("0.0f") };
|
||||||
|
Tick.bRestrictToRecommended = false;
|
||||||
|
|
||||||
|
Def.Variations.Emplace(Tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FActorDefinition UActorBlueprintFunctionLibrary::MakeGenericSensorDefinition(
|
FActorDefinition UActorBlueprintFunctionLibrary::MakeGenericSensorDefinition(
|
||||||
const FString &Type,
|
const FString &Type,
|
||||||
const FString &Id)
|
const FString &Id)
|
||||||
|
@ -225,6 +238,7 @@ FActorDefinition UActorBlueprintFunctionLibrary::MakeGenericSensorDefinition(
|
||||||
FActorDefinition Definition;
|
FActorDefinition Definition;
|
||||||
FillIdAndTags(Definition, TEXT("sensor"), Type, Id);
|
FillIdAndTags(Definition, TEXT("sensor"), Type, Id);
|
||||||
AddRecommendedValuesForSensorRoleNames(Definition);
|
AddRecommendedValuesForSensorRoleNames(Definition);
|
||||||
|
AddVariationsForSensor(Definition);
|
||||||
return Definition;
|
return Definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,6 +261,7 @@ void UActorBlueprintFunctionLibrary::MakeCameraDefinition(
|
||||||
{
|
{
|
||||||
FillIdAndTags(Definition, TEXT("sensor"), TEXT("camera"), Id);
|
FillIdAndTags(Definition, TEXT("sensor"), TEXT("camera"), Id);
|
||||||
AddRecommendedValuesForSensorRoleNames(Definition);
|
AddRecommendedValuesForSensorRoleNames(Definition);
|
||||||
|
AddVariationsForSensor(Definition);
|
||||||
// FOV.
|
// FOV.
|
||||||
FActorVariation FOV;
|
FActorVariation FOV;
|
||||||
FOV.Id = TEXT("fov");
|
FOV.Id = TEXT("fov");
|
||||||
|
|
|
@ -9,19 +9,29 @@
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
|
|
||||||
#include "Carla/Actor/ActorDescription.h"
|
#include "Carla/Actor/ActorDescription.h"
|
||||||
|
#include "Carla/Actor/ActorBlueprintFunctionLibrary.h"
|
||||||
#include "Carla/Sensor/DataStream.h"
|
#include "Carla/Sensor/DataStream.h"
|
||||||
|
|
||||||
#include "Sensor.generated.h"
|
#include "Sensor.generated.h"
|
||||||
|
|
||||||
/// Base class for sensors.
|
/// Base class for sensors.
|
||||||
UCLASS(Abstract, hidecategories=(Collision, Attachment, Actor))
|
UCLASS(Abstract, hidecategories = (Collision, Attachment, Actor))
|
||||||
class CARLA_API ASensor : public AActor
|
class CARLA_API ASensor : public AActor
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void Set(const FActorDescription &) {}
|
virtual void Set(const FActorDescription &Description)
|
||||||
|
{
|
||||||
|
// set the tick interval of the sensor
|
||||||
|
if (Description.Variations.Contains("tick_interval"))
|
||||||
|
{
|
||||||
|
SetActorTickInterval(
|
||||||
|
UActorBlueprintFunctionLibrary::ActorAttributeToFloat(Description.Variations["tick_interval"],
|
||||||
|
0.0f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Replace the FDataStream associated with this sensor.
|
/// Replace the FDataStream associated with this sensor.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue